Completed
Push — master ( ec0df7...48d548 )
by Yannick
07:01
created
statistics-country.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 
14 14
 require_once('header.php');
Please login to merge, or discard this patch.
require/class.METAR.php 1 patch
Indentation   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -7,109 +7,109 @@  discard block
 block discarded – undo
7 7
 	public $db;
8 8
 	
9 9
 	protected $texts = Array(
10
-	    'MI' => 'Shallow',
11
-	    'PR' => 'Partial',
12
-	    'BC' => 'Low drifting',
13
-	    'BL' => 'Blowing',
14
-	    'SH' => 'Showers',
15
-	    'TS' => 'Thunderstorm',
16
-	    'FZ' => 'Freezing',
17
-	    'DZ' => 'Drizzle',
18
-	    'RA' => 'Rain',
19
-	    'SN' => 'Snow',
20
-	    'SG' => 'Snow Grains',
21
-	    'IC' => 'Ice crystals',
22
-	    'PL' => 'Ice pellets',
23
-	    'GR' => 'Hail',
24
-	    'GS' => 'Small hail',
25
-	    'UP' => 'Unknown',
26
-	    'BR' => 'Mist',
27
-	    'FG' => 'Fog',
28
-	    'FU' => 'Smoke',
29
-	    'VA' => 'Volcanic ash',
30
-	    'DU' => 'Widespread dust',
31
-	    'SA' => 'Sand',
32
-	    'HZ' => 'Haze',
33
-	    'PY' => 'Spray',
34
-	    'PO' => 'Well developed dust / sand whirls',
35
-	    'SQ' => 'Squalls',
36
-	    'FC' => 'Funnel clouds inc tornadoes or waterspouts',
37
-	    'SS' => 'Sandstorm',
38
-	    'DS' => 'Duststorm'
10
+		'MI' => 'Shallow',
11
+		'PR' => 'Partial',
12
+		'BC' => 'Low drifting',
13
+		'BL' => 'Blowing',
14
+		'SH' => 'Showers',
15
+		'TS' => 'Thunderstorm',
16
+		'FZ' => 'Freezing',
17
+		'DZ' => 'Drizzle',
18
+		'RA' => 'Rain',
19
+		'SN' => 'Snow',
20
+		'SG' => 'Snow Grains',
21
+		'IC' => 'Ice crystals',
22
+		'PL' => 'Ice pellets',
23
+		'GR' => 'Hail',
24
+		'GS' => 'Small hail',
25
+		'UP' => 'Unknown',
26
+		'BR' => 'Mist',
27
+		'FG' => 'Fog',
28
+		'FU' => 'Smoke',
29
+		'VA' => 'Volcanic ash',
30
+		'DU' => 'Widespread dust',
31
+		'SA' => 'Sand',
32
+		'HZ' => 'Haze',
33
+		'PY' => 'Spray',
34
+		'PO' => 'Well developed dust / sand whirls',
35
+		'SQ' => 'Squalls',
36
+		'FC' => 'Funnel clouds inc tornadoes or waterspouts',
37
+		'SS' => 'Sandstorm',
38
+		'DS' => 'Duststorm'
39 39
 	);
40 40
 	
41 41
 	public function __construct($dbc = null) {
42
-                $Connection = new Connection($dbc);
43
-                $this->db = $Connection->db;
44
-        }
42
+				$Connection = new Connection($dbc);
43
+				$this->db = $Connection->db;
44
+		}
45 45
 
46
-       public static function check_last_update() {
47
-    		global $globalDBdriver;
48
-    		if ($globalDBdriver == 'mysql') {
46
+	   public static function check_last_update() {
47
+			global $globalDBdriver;
48
+			if ($globalDBdriver == 'mysql') {
49 49
 			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value > DATE_SUB(NOW(), INTERVAL 20 MINUTE)";
50 50
 		} else {
51 51
 			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '20 MINUTES'";
52 52
 		}
53
-                try {
54
-                        $Connection = new Connection();
55
-                        $sth = $Connection->db->prepare($query);
56
-                        $sth->execute();
57
-                } catch(PDOException $e) {
58
-                        return "error : ".$e->getMessage();
59
-                }
60
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
61
-                $sth->closeCursor();
62
-                if ($row['nb'] > 0) return false;
63
-                else return true;
64
-        }
53
+				try {
54
+						$Connection = new Connection();
55
+						$sth = $Connection->db->prepare($query);
56
+						$sth->execute();
57
+				} catch(PDOException $e) {
58
+						return "error : ".$e->getMessage();
59
+				}
60
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
61
+				$sth->closeCursor();
62
+				if ($row['nb'] > 0) return false;
63
+				else return true;
64
+		}
65 65
 
66
-        public static function insert_last_update() {
67
-                $query = "DELETE FROM config WHERE name = 'last_update_metar';
66
+		public static function insert_last_update() {
67
+				$query = "DELETE FROM config WHERE name = 'last_update_metar';
68 68
                         INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());";
69
-                try {
70
-                        $Connection = new Connection();
71
-                        $sth = $Connection->db->prepare($query);
72
-                        $sth->execute();
73
-                } catch(PDOException $e) {
74
-                        return "error : ".$e->getMessage();
75
-                }
76
-        }
69
+				try {
70
+						$Connection = new Connection();
71
+						$sth = $Connection->db->prepare($query);
72
+						$sth->execute();
73
+				} catch(PDOException $e) {
74
+						return "error : ".$e->getMessage();
75
+				}
76
+		}
77 77
 
78 78
 
79 79
         
80
-        public function parse($data) {
81
-    		//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82
-    		$codes = implode('|', array_keys($this->texts));
83
-    		$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
84
-    		//$pieces = explode(' ',$data);
85
-    		$pieces = preg_split('/\s/',$data);
86
-    		$pos = 0;
87
-    		if ($pieces[0] == 'METAR') $pos++;
88
-    		elseif ($pieces[0] == 'SPECI') $pos++;
89
-    		if (strlen($pieces[$pos]) != 4) $pos++;
90
-    		$result = array();
91
-    		$result['location'] = $pieces[$pos];
92
-    		$pos++;
93
-    		$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
-    		$result['time'] = substr($pieces[$pos],2,4);
95
-    		$c = count($pieces);
96
-    		for($pos++; $pos < $c; $pos++) {
97
-    			$piece = $pieces[$pos];
98
-    			if ($piece == 'RMK') break;
99
-    			if ($piece == 'AUTO') $result['auto'] = true;
100
-    			if ($piece == 'COR') $result['correction'] = true;
101
-    			// Wind Speed
102
-    			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
-    				$result['wind']['direction'] = (float)$matches[1];
80
+		public function parse($data) {
81
+			//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82
+			$codes = implode('|', array_keys($this->texts));
83
+			$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
84
+			//$pieces = explode(' ',$data);
85
+			$pieces = preg_split('/\s/',$data);
86
+			$pos = 0;
87
+			if ($pieces[0] == 'METAR') $pos++;
88
+			elseif ($pieces[0] == 'SPECI') $pos++;
89
+			if (strlen($pieces[$pos]) != 4) $pos++;
90
+			$result = array();
91
+			$result['location'] = $pieces[$pos];
92
+			$pos++;
93
+			$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
+			$result['time'] = substr($pieces[$pos],2,4);
95
+			$c = count($pieces);
96
+			for($pos++; $pos < $c; $pos++) {
97
+				$piece = $pieces[$pos];
98
+				if ($piece == 'RMK') break;
99
+				if ($piece == 'AUTO') $result['auto'] = true;
100
+				if ($piece == 'COR') $result['correction'] = true;
101
+				// Wind Speed
102
+				if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
+					$result['wind']['direction'] = (float)$matches[1];
104 104
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
105
+					if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
+					elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
+					elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
108 108
 				$result['wind']['gust'] = (float)$matches[3];
109 109
 				$result['wind']['unit'] = $matches[4];
110 110
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
111 111
 				$result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0;
112
-    			}
112
+				}
113 113
 
114 114
 /*    			if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) {
115 115
     				$result['wind_direction'] = (float)$matches[1];
@@ -126,35 +126,35 @@  discard block
 block discarded – undo
126 126
     				}
127 127
     			}
128 128
     			*/
129
-    			// Temperature
130
-    			if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
-    				$temp = (float)$matches[1];
129
+				// Temperature
130
+				if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
+					$temp = (float)$matches[1];
132 132
 				if ($matches[1]{0} == 'M') {
133 133
 					$temp = ((float)substr($matches[1], 1)) * -1;
134 134
 				}
135
-    				$result['temperature'] = $temp;
136
-    				$dew = (float)$matches[2];
135
+					$result['temperature'] = $temp;
136
+					$dew = (float)$matches[2];
137 137
 				if ($matches[2]{0} == 'M') {
138 138
 					$dew = ((float)substr($matches[2], 1)) * -1;
139 139
 				}
140 140
 				$result['dew'] = $dew;
141
-    			}
142
-    			// QNH
143
-    			if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) {
144
-    			// #^(Q|A)(////|[0-9]{4})( )#
145
-    				if ($matches[1] == 'Q') {
146
-    					// hPa
147
-    					$result['QNH'] = $matches[2];
148
-    				} else {
149
-    					// inHg
150
-    					$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
151 141
 				}
152
-    				/*
142
+				// QNH
143
+				if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) {
144
+				// #^(Q|A)(////|[0-9]{4})( )#
145
+					if ($matches[1] == 'Q') {
146
+						// hPa
147
+						$result['QNH'] = $matches[2];
148
+					} else {
149
+						// inHg
150
+						$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
151
+				}
152
+					/*
153 153
     				$result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100);
154 154
     				$result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg';
155 155
     				*/
156
-    			}
157
-                     /*
156
+				}
157
+					 /*
158 158
     			// Wind Direction
159 159
     			if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) {
160 160
     				$result['wind_direction'] = $matches[1];
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     				$result['speed_variable'] = $matches[1];
166 166
     			}
167 167
     			*/
168
-    			// Visibility
169
-    			if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170
-    				if (isset($matches[3]) && strlen($matches[3]) > 0) {
168
+				// Visibility
169
+				if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170
+					if (isset($matches[3]) && strlen($matches[3]) > 0) {
171 171
 					$result['visibility'] = (float)$matches[3] * 1609.34;
172 172
 				} else {
173 173
 					if ($matches[1] == '9999') {
@@ -180,28 +180,28 @@  discard block
 block discarded – undo
180 180
 					$result['visibility'] = '> 10000';
181 181
 					$result['weather'] = "CAVOK";
182 182
 				}
183
-    			}
184
-    			// Cloud Coverage
185
-    			if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) {
186
-    				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187
-    				$type = $matches[1];
188
-    				$cloud = array();
189
-    				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
-    				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
-    				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
-    				elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
-    				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
-    				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
-    				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
-    				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197
-    				$cloud['type_code'] = $type;
198
-    				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199
-    				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200
-    				$result['cloud'][] = $cloud;
201
-    			}
202
-    			// RVR
203
-    			 if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) {
204
-    				$rvr = array();
183
+				}
184
+				// Cloud Coverage
185
+				if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) {
186
+					//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187
+					$type = $matches[1];
188
+					$cloud = array();
189
+					if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
+					elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
+					elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
+					elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
+					elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
+					elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
+					elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
+					elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197
+					$cloud['type_code'] = $type;
198
+					$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199
+					$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200
+					$result['cloud'][] = $cloud;
201
+				}
202
+				// RVR
203
+				 if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) {
204
+					$rvr = array();
205 205
 				$rvr['runway'] = $matches[1];
206 206
 				$rvr['assessment'] = $matches[2];
207 207
 				$rvr['rvr'] = $matches[3];
@@ -210,33 +210,33 @@  discard block
 block discarded – undo
210 210
 				$result['RVR'] = $rvr;
211 211
 			}
212 212
     			
213
-    			//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
214
-    			if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) {
215
-    				//print_r($matches);
216
-    				// https://github.com/davidmegginson/metar-taf/blob/master/Metar.php
217
-    				$result['RVR']['runway'] = $matches[1];
218
-        			$result['RVR']['deposits'] = $matches[2];
219
-        			$result['RVR']['extent'] = $matches[3];
220
-        			$result['RVR']['depth'] = $matches[4];
221
-        			$result['RVR']['friction'] = $matches[5];
222
-    			}
223
-    			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224
-    				//echo $piece;
225
-    				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
213
+				//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
214
+				if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) {
215
+					//print_r($matches);
216
+					// https://github.com/davidmegginson/metar-taf/blob/master/Metar.php
217
+					$result['RVR']['runway'] = $matches[1];
218
+					$result['RVR']['deposits'] = $matches[2];
219
+					$result['RVR']['extent'] = $matches[3];
220
+					$result['RVR']['depth'] = $matches[4];
221
+					$result['RVR']['friction'] = $matches[5];
222
+				}
223
+				if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224
+					//echo $piece;
225
+					//print_r($matches);
226
+					if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
+					else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
228 228
 				if (isset($matches[3])) {
229 229
 					$range = Array(
230
-					    'from' => (float)$matches[2],
231
-					    'to'   => (float)$matches[4],
232
-					    'unit' => $matches[5] ? 'FT' : 'M'
230
+						'from' => (float)$matches[2],
231
+						'to'   => (float)$matches[4],
232
+						'unit' => $matches[5] ? 'FT' : 'M'
233 233
 					);
234 234
 				}
235 235
 				$result['RVR'] = $matches[1];
236 236
 				$result['RVR_range'] = $range;
237
-    			}
238
-    			// Weather
239
-    			if (preg_match($regWeather, $piece, $matches)) {
237
+				}
238
+				// Weather
239
+				if (preg_match($regWeather, $piece, $matches)) {
240 240
 				$text = Array();
241 241
 				switch ($matches[1]) {
242 242
 					case '+':
@@ -259,35 +259,35 @@  discard block
 block discarded – undo
259 259
 				}
260 260
 				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
261 261
 				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
262
-    			}
263
-    		}
264
-    		return $result;
262
+				}
263
+			}
264
+			return $result;
265 265
         
266
-        }
266
+		}
267 267
         
268 268
 	public function getMETAR($icao) {
269
-    		global $globalMETARcycle, $globalDBdriver;
270
-    		if (isset($globalMETARcycle) && $globalMETARcycle) {
271
-            		$query = "SELECT * FROM metar WHERE metar_location = :icao";
272
-                } else {
273
-            		if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
-            		else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
275
-                }
276
-                $query_values = array(':icao' => $icao);
277
-                 try {
278
-                        $sth = $this->db->prepare($query);
279
-                        $sth->execute($query_values);
280
-                } catch(PDOException $e) {
281
-                        return "error : ".$e->getMessage();
282
-                }
283
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
284
-                if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) {
285
-            		$all = $this->downloadMETAR($icao);
286
-                }
287
-                return $all;
288
-        }
269
+			global $globalMETARcycle, $globalDBdriver;
270
+			if (isset($globalMETARcycle) && $globalMETARcycle) {
271
+					$query = "SELECT * FROM metar WHERE metar_location = :icao";
272
+				} else {
273
+					if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
+					else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
275
+				}
276
+				$query_values = array(':icao' => $icao);
277
+				 try {
278
+						$sth = $this->db->prepare($query);
279
+						$sth->execute($query_values);
280
+				} catch(PDOException $e) {
281
+						return "error : ".$e->getMessage();
282
+				}
283
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
284
+				if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) {
285
+					$all = $this->downloadMETAR($icao);
286
+				}
287
+				return $all;
288
+		}
289 289
 
290
-       public function addMETAR($location,$metar,$date) {
290
+	   public function addMETAR($location,$metar,$date) {
291 291
 		global $globalDBdriver;
292 292
 		$date = date('Y-m-d H:i:s',strtotime($date));
293 293
 		if ($globalDBdriver == 'mysql') {
@@ -295,106 +295,106 @@  discard block
 block discarded – undo
295 295
 		} else {
296 296
 			$query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);";
297 297
 		}
298
-                $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
299
-                 try {
300
-                        $sth = $this->db->prepare($query);
301
-                        $sth->execute($query_values);
302
-                } catch(PDOException $e) {
303
-                        return "error : ".$e->getMessage();
304
-                }
305
-        }
298
+				$query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
299
+				 try {
300
+						$sth = $this->db->prepare($query);
301
+						$sth->execute($query_values);
302
+				} catch(PDOException $e) {
303
+						return "error : ".$e->getMessage();
304
+				}
305
+		}
306 306
 
307
-       public function deleteMETAR($id) {
308
-                $query = "DELETE FROM metar WHERE id = :id";
309
-                $query_values = array(':id' => $id);
310
-                 try {
311
-                        $sth = $this->db->prepare($query);
312
-                        $sth->execute($query_values);
313
-                } catch(PDOException $e) {
314
-                        return "error : ".$e->getMessage();
315
-                }
316
-        }
317
-       public function deleteAllMETARLocation() {
318
-                $query = "DELETE FROM metar";
319
-                 try {
320
-                        $sth = $this->db->prepare($query);
321
-                        $sth->execute();
322
-                } catch(PDOException $e) {
323
-                        return "error : ".$e->getMessage();
324
-                }
325
-        }
307
+	   public function deleteMETAR($id) {
308
+				$query = "DELETE FROM metar WHERE id = :id";
309
+				$query_values = array(':id' => $id);
310
+				 try {
311
+						$sth = $this->db->prepare($query);
312
+						$sth->execute($query_values);
313
+				} catch(PDOException $e) {
314
+						return "error : ".$e->getMessage();
315
+				}
316
+		}
317
+	   public function deleteAllMETARLocation() {
318
+				$query = "DELETE FROM metar";
319
+				 try {
320
+						$sth = $this->db->prepare($query);
321
+						$sth->execute();
322
+				} catch(PDOException $e) {
323
+						return "error : ".$e->getMessage();
324
+				}
325
+		}
326 326
         
327
-        public function addMETARCycle() {
328
-    		global $globalDebug, $globalIVAO, $globalTransaction;
329
-    		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
330
-    		date_default_timezone_set("UTC");
331
-    		$Common = new Common();
332
-    		if (isset($globalIVAO) && $globalIVAO) {
333
-        		//$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
327
+		public function addMETARCycle() {
328
+			global $globalDebug, $globalIVAO, $globalTransaction;
329
+			if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
330
+			date_default_timezone_set("UTC");
331
+			$Common = new Common();
332
+			if (isset($globalIVAO) && $globalIVAO) {
333
+				//$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
334 334
 			$Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt');
335
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
336
-    		} else {
335
+				$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
336
+			} else {
337 337
 			//$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT');
338 338
 			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
339
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
340
-    		}
341
-    		if ($handle) {
339
+				$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
340
+			}
341
+			if ($handle) {
342 342
 			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
343 343
 			$date = '';
344
-    			//foreach(explode("\n",$cycle) as $line) {
345
-    			if ($globalTransaction) $this->db->beginTransaction();
346
-	    		while(($line = fgets($handle,4096)) !== false) {
344
+				//foreach(explode("\n",$cycle) as $line) {
345
+				if ($globalTransaction) $this->db->beginTransaction();
346
+				while(($line = fgets($handle,4096)) !== false) {
347 347
 				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
348 348
 					$date = $line;
349
-    				} elseif ($line != '') {
350
-    				    //$this->parse($line);
351
-    				    if ($date == '') $date = date('Y/m/d H:m');
352
-        			    $pos = 0;
353
-        			    $pieces = preg_split('/\s/',$line);
354
-        			    if ($pieces[0] == 'METAR') $pos++;
355
-        			    if (strlen($pieces[$pos]) != 4) $pos++;
356
-		        	    $location = $pieces[$pos];
357
-        	        	    echo $this->addMETAR($location,$line,$date);
358
-    				}
359
-    			}
360
-    			fclose($handle);
361
-    			if ($globalTransaction) $this->db->commit();
362
-    		}
363
-    		if (isset($globalDebug) && $globalDebug) echo "Done\n";
349
+					} elseif ($line != '') {
350
+						//$this->parse($line);
351
+						if ($date == '') $date = date('Y/m/d H:m');
352
+						$pos = 0;
353
+						$pieces = preg_split('/\s/',$line);
354
+						if ($pieces[0] == 'METAR') $pos++;
355
+						if (strlen($pieces[$pos]) != 4) $pos++;
356
+						$location = $pieces[$pos];
357
+							echo $this->addMETAR($location,$line,$date);
358
+					}
359
+				}
360
+				fclose($handle);
361
+				if ($globalTransaction) $this->db->commit();
362
+			}
363
+			if (isset($globalDebug) && $globalDebug) echo "Done\n";
364 364
         
365
-        }
366
-        public function downloadMETAR($icao) {
367
-    		global $globalMETARurl;
368
-    		if ($globalMETARurl == '') return array();
369
-    		date_default_timezone_set("UTC");
370
-    		$Common = new Common();
371
-    		$url = str_replace('{icao}',$icao,$globalMETARurl);
372
-    		$cycle = $Common->getData($url);
373
-    		$date = '';
374
-    		foreach(explode("\n",$cycle) as $line) {
375
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
376
-    				//echo "date : ".$line."\n";
377
-    				$date = $line;
378
-    			} 
379
-    			if ($line != '') {
380
-    			    //$this->parse($line);
381
-    			    //echo $line;
382
-    			    if ($date == '') $date = date('Y/m/d H:m');
383
-    			    $pos = 0;
384
-    			    $pieces = preg_split('/\s/',$line);
385
-    			    if ($pieces[0] == 'METAR') $pos++;
386
-    			    if (strlen($pieces[$pos]) != 4) $pos++;
387
-	        	    $location = $pieces[$pos];
388
-	        	    if (strlen($location == 4)) {
389
-	        		$this->addMETAR($location,$line,$date);
390
-	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391
-	        	    } else return array();
392
-    			}
393
-    			//echo $line."\n";
394
-    		}
395
-    		return array();
365
+		}
366
+		public function downloadMETAR($icao) {
367
+			global $globalMETARurl;
368
+			if ($globalMETARurl == '') return array();
369
+			date_default_timezone_set("UTC");
370
+			$Common = new Common();
371
+			$url = str_replace('{icao}',$icao,$globalMETARurl);
372
+			$cycle = $Common->getData($url);
373
+			$date = '';
374
+			foreach(explode("\n",$cycle) as $line) {
375
+				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
376
+					//echo "date : ".$line."\n";
377
+					$date = $line;
378
+				} 
379
+				if ($line != '') {
380
+					//$this->parse($line);
381
+					//echo $line;
382
+					if ($date == '') $date = date('Y/m/d H:m');
383
+					$pos = 0;
384
+					$pieces = preg_split('/\s/',$line);
385
+					if ($pieces[0] == 'METAR') $pos++;
386
+					if (strlen($pieces[$pos]) != 4) $pos++;
387
+					$location = $pieces[$pos];
388
+					if (strlen($location == 4)) {
389
+					$this->addMETAR($location,$line,$date);
390
+					return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391
+					} else return array();
392
+				}
393
+				//echo $line."\n";
394
+			}
395
+			return array();
396 396
         
397
-        }
397
+		}
398 398
 }
399 399
 /*
400 400
 $METAR = new METAR();
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 			}
517 517
                     }
518 518
 		    <?php
519
-            		} else {
520
-            	    ?>
519
+					} else {
520
+					?>
521 521
 		    if (map.getZoom() > 7) {
522 522
                 	var style = {
523 523
                     	    "color": "#1a3151",
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 	layer_marine_data.addLayer(layer);
537 537
 		    }
538 538
 <?php
539
-            		}
539
+					}
540 540
 ?>
541 541
 				}
542 542
 			    }
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 			}
518 518
                     }
519 519
 		    <?php
520
-            		} else {
521
-            	    ?>
520
+					} else {
521
+					?>
522 522
 		    if (map.getZoom() > 7) {
523 523
                 	var style = {
524 524
                     	    "color": "#1a3151",
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                 	layer_tracker_data.addLayer(layer);
538 538
 		    }
539 539
 <?php
540
-            		}
540
+					}
541 541
 ?>
542 542
 				}
543 543
 			    }
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 	});
353 353
 update_locationsLayer();
354 354
 <?php
355
-    // Add support for custom json via $globalMapJson
356
-    if (isset($globalMapJson) && is_array($globalMapJson)) {
355
+	// Add support for custom json via $globalMapJson
356
+	if (isset($globalMapJson) && is_array($globalMapJson)) {
357 357
 	foreach ($globalMapJson as $json) {
358
-	    if (isset($json['url'])) {
358
+		if (isset($json['url'])) {
359 359
 ?>
360 360
 update_genLayer('<?php print $json['url']; ?>');
361 361
 <?php
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
 setInterval(function(){update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>);
365 365
 <?php
366 366
 		}
367
-	    }
367
+		}
368
+	}
368 369
 	}
369
-    }
370 370
 
371 371
 ?>
372 372
 //adds the bootstrap tooltip to the map icons
Please login to merge, or discard this patch.
live-czml.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -34,30 +34,30 @@  discard block
 block discarded – undo
34 34
 
35 35
 
36 36
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
37
-    // Assuming the angles are in radians.
38
-    $c1 = cos($heading/2);
39
-    $s1 = sin($heading/2);
40
-    $c2 = cos($attitude/2);
41
-    $s2 = sin($attitude/2);
42
-    $c3 = cos($bank/2);
43
-    $s3 = sin($bank/2);
44
-    $c1c2 = $c1*$c2;
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);
37
+	// Assuming the angles are in radians.
38
+	$c1 = cos($heading/2);
39
+	$s1 = sin($heading/2);
40
+	$c2 = cos($attitude/2);
41
+	$s2 = sin($attitude/2);
42
+	$c3 = cos($bank/2);
43
+	$s3 = sin($bank/2);
44
+	$c1c2 = $c1*$c2;
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);
51 51
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
52 52
 
53 53
 }
54 54
 
55 55
 
56 56
 if (isset($_GET['download'])) {
57
-    if ($_GET['download'] == "true")
58
-    {
57
+	if ($_GET['download'] == "true")
58
+	{
59 59
 	header('Content-disposition: attachment; filename="flightairmap.json"');
60
-    }
60
+	}
61 61
 }
62 62
 header('Content-Type: text/javascript');
63 63
 
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 			$image = "images/placeholder_thumb.png";
221 221
 		}
222 222
 
223
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
224
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
225
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
226
-                if ($prev_flightaware_id != $id) {
223
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
224
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
225
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
226
+				if ($prev_flightaware_id != $id) {
227 227
 			if ($prev_flightaware_id != '') {
228 228
 				$output .= ']';
229 229
 				$output .= '}';
Please login to merge, or discard this patch.
header.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30 30
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
31
+		return strpos($key,'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
 	}
169 169
 ?>
170 170
 <?php 
171
-    if (isset($_POST['archive'])) {
171
+	if (isset($_POST['archive'])) {
172 172
 ?>
173 173
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
174 174
 <?php 
175
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
175
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
176 176
 ?>
177 177
 
178 178
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
179 179
 <?php    
180
-	    }
181
-    } else {
180
+		}
181
+	} else {
182 182
 ?>
183 183
 <?php
184 184
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 */
191 191
 ?>
192 192
 <?php 
193
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
193
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
194 194
 ?>
195 195
 <?php
196 196
 //		if (isset($globalBeta) && $globalBeta) {
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
 <script src="<?php print $globalURL; ?>/js/map-marine.2d.js.php?<?php print time(); ?>"></script>
218 218
 <?php
219 219
 		}
220
-	    }
220
+		}
221 221
 ?>
222 222
 <?php
223 223
 //	}
224 224
 ?>
225 225
 <?php
226
-    }
226
+	}
227 227
 }
228 228
 ?>
229 229
 <?php
@@ -380,15 +380,15 @@  discard block
 block discarded – undo
380 380
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
381 381
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
382 382
 <?php
383
-    if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
383
+	if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
384 384
 ?>
385 385
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
386 386
 <?php
387
-    } else {
387
+	} else {
388 388
 ?>
389 389
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
390 390
 <?php
391
-    }
391
+	}
392 392
 ?>
393 393
 			<li><hr /></li>
394 394
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -396,34 +396,34 @@  discard block
 block discarded – undo
396 396
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
397 397
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
398 398
             <?php
399
-        	if ($globalACARS) {
400
-        	    if (isset($globalDemo) && $globalDemo) {
401
-    	    ?>
399
+			if ($globalACARS) {
400
+				if (isset($globalDemo) && $globalDemo) {
401
+			?>
402 402
             <li><hr /></li>
403 403
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
404 404
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
405 405
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
406 406
             <?php
407
-        	    } else {
408
-    	    ?>
407
+				} else {
408
+			?>
409 409
             <li><hr /></li>
410 410
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
411 411
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
412 412
             <?php
413
-        	    }
414
-        	}
415
-    	    ?>
413
+				}
414
+			}
415
+			?>
416 416
     	    <?php
417
-    	        if (isset($globalAccidents) && $globalAccidents) {
418
-    	    ?>
417
+				if (isset($globalAccidents) && $globalAccidents) {
418
+			?>
419 419
             <li><hr /></li>
420 420
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
421 421
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
422 422
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
423 423
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
424 424
             <?php
425
-        	}
426
-    	    ?>
425
+			}
426
+			?>
427 427
             <li><hr /></li>
428 428
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
429 429
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
   	    <form>
466 466
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
467 467
   		    <?php
468
-  		        $Language = new Language();
469
-  		        $alllang = $Language->getLanguages();
470
-  		        foreach ($alllang as $key => $lang) {
471
-  		            print '<option value="'.$key.'"';
472
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
473
-  		            print '>'.$lang[0].'</option>';
474
-  		        }
475
-  		    ?>
468
+  				$Language = new Language();
469
+  				$alllang = $Language->getLanguages();
470
+  				foreach ($alllang as $key => $lang) {
471
+  					print '<option value="'.$key.'"';
472
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
473
+  					print '>'.$lang[0].'</option>';
474
+  				}
475
+  			?>
476 476
   		</select>
477 477
   	    </form>
478 478
   	</div>
@@ -503,18 +503,18 @@  discard block
 block discarded – undo
503 503
 ?>
504 504
     <div class="top-header clear" role="main">
505 505
 <?php
506
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
506
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
507 507
 ?>
508 508
     <div id="archive-map"></div>
509 509
 <?php
510
-    }
510
+	}
511 511
 ?>
512 512
     </div>
513 513
 <?php
514 514
 }
515 515
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
516 516
 {
517
-    ?>
517
+	?>
518 518
     <div class="top-header clear" role="main">
519 519
         <div id="map"></div>
520 520
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -525,15 +525,15 @@  discard block
 block discarded – undo
525 525
         var zoom = 13;
526 526
 //create the map
527 527
 <?php
528
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
528
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
529 529
 ?>
530 530
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
531 531
 <?php
532
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
532
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
533 533
 ?>
534 534
   map = L.map('map', { zoomControl:true });
535 535
 <?php
536
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
536
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
537 537
 ?>
538 538
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
539 539
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -541,22 +541,22 @@  discard block
 block discarded – undo
541 541
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
542 542
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
543 543
 <?php
544
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
544
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
545 545
 ?>
546 546
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
547 547
 <?php
548
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
548
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
549 549
 ?>
550 550
   map = L.map('map', { zoomControl:true });
551 551
 <?php
552
-    }
552
+	}
553 553
 ?>
554 554
   //initialize the layer group for the aircrft markers
555 555
   var layer_data = L.layerGroup();
556 556
 
557 557
   //a few title layers
558 558
 <?php
559
-    if ($globalMapProvider == 'Mapbox') {
559
+	if ($globalMapProvider == 'Mapbox') {
560 560
 ?>
561 561
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
562 562
     maxZoom: 18,
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
     token : '<?php print $globalMapboxToken; ?>'
568 568
   }).addTo(map);
569 569
 <?php
570
-    } elseif ($globalMapProvider == 'OpenStreetMap') {
570
+	} elseif ($globalMapProvider == 'OpenStreetMap') {
571 571
 ?>
572 572
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
573 573
     maxZoom: 18,
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
       '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>'
576 576
   }).addTo(map);
577 577
 <?php
578
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
578
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
579 579
 ?>
580 580
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
581 581
     maxZoom: 18,
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
585 585
   }).addTo(map);
586 586
 <?php
587
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
587
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
588 588
 ?>
589 589
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
590 590
     maxZoom: 18,
@@ -593,27 +593,27 @@  discard block
 block discarded – undo
593 593
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
594 594
   }).addTo(map);
595 595
 <?php
596
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
596
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
597 597
 ?>
598 598
     var googleLayer = new L.Google('ROADMAP');
599 599
     map.addLayer(googleLayer);
600 600
 <?php
601
-    } elseif ($globalMapProvider == 'Google-Satellite') {
601
+	} elseif ($globalMapProvider == 'Google-Satellite') {
602 602
 ?>
603 603
     var googleLayer = new L.Google('SATELLITE');
604 604
     map.addLayer(googleLayer);
605 605
 <?php
606
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
606
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
607 607
 ?>
608 608
     var googleLayer = new L.Google('HYBRID');
609 609
     map.addLayer(googleLayer);
610 610
 <?php
611
-    } elseif ($globalMapProvider == 'Google-Terrain') {
611
+	} elseif ($globalMapProvider == 'Google-Terrain') {
612 612
 ?>
613 613
     var googleLayer = new L.Google('Terrain');
614 614
     map.addLayer(googleLayer);
615 615
 <?php
616
-    }
616
+	}
617 617
 ?>
618 618
         </script>
619 619
     </div>
Please login to merge, or discard this patch.
getImages.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@  discard block
 block discarded – undo
4 4
 	$hex = str_replace("#", "", $hex);
5 5
 	$color = array();
6 6
 	if (strlen($hex) == 3) {
7
-	    $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
-	    $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
-	    $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
7
+		$color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
+		$color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
+		$color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
10 10
 	} else if (strlen($hex) == 6) {
11
-	    $color['r'] = hexdec(substr($hex, 0, 2));
12
-	    $color['g'] = hexdec(substr($hex, 2, 2));
13
-	    $color['b'] = hexdec(substr($hex, 4, 2));
11
+		$color['r'] = hexdec(substr($hex, 0, 2));
12
+		$color['g'] = hexdec(substr($hex, 2, 2));
13
+		$color['b'] = hexdec(substr($hex, 4, 2));
14 14
 	}
15 15
 	return $color;
16 16
 }
17 17
 
18 18
 
19 19
 if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { 
20
-    exit(0);
20
+	exit(0);
21 21
 }
22 22
 $color = $_GET['color'];
23 23
 if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) {
24
-    echo "Incorrect filename";
25
-    exit(0);
24
+	echo "Incorrect filename";
25
+	exit(0);
26 26
 }
27 27
 $filename = $_GET['filename'];
28 28
 if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename)) {
29
-    header('Content-type: image/png');
30
-    readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename);
31
-    exit(0);
29
+	header('Content-type: image/png');
30
+	readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename);
31
+	exit(0);
32 32
 }
33 33
 if (isset($_GET['tracker'])) {
34 34
 	$original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'vehicules'.DIRECTORY_SEPARATOR.$filename;
@@ -38,66 +38,66 @@  discard block
 block discarded – undo
38 38
 	$original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'aircrafts'.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.$filename;
39 39
 }
40 40
 if (!file_exists($original)) {
41
-    echo "File not found";
41
+	echo "File not found";
42 42
 }
43 43
 
44 44
 if (extension_loaded('gd') && function_exists('gd_info')) {
45
-    $image = imagecreatefrompng($original);
46
-    $index = imagecolorexact($image,26,49,81);
47
-    if ($index < 0) {
45
+	$image = imagecreatefrompng($original);
46
+	$index = imagecolorexact($image,26,49,81);
47
+	if ($index < 0) {
48 48
 	$index = imagecolorexact($image,25,49,79);
49
-    }
50
-    if ($index < 0) {
49
+	}
50
+	if ($index < 0) {
51 51
 	$index = imagecolorexact($image,0,0,0);
52
-    }
53
-    $c = hexToRGB($color);
54
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
52
+	}
53
+	$c = hexToRGB($color);
54
+	imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
55 55
  /*
56 56
     $ig = imagecolorat($image, 0, 0);
57 57
     imagecolortransparent($image, $ig);
58 58
    */
59 59
 
60
-    header('Content-type: image/png');
61
-    if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
60
+	header('Content-type: image/png');
61
+	if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
62 62
 	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
63 63
 	$newimg = imagecreatetruecolor($resize,$resize);
64
-        imagealphablending($newimg, false);
64
+		imagealphablending($newimg, false);
65 65
 	imagesavealpha($newimg, true);
66 66
 	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
67 67
 	if (isset($_GET['heading'])) {
68
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
69
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
70
-    	    imagealphablending($rotation, false);
71
-	    imagesavealpha($rotation, true);
72
-    	    imagepng($rotation);
73
-    	    imagedestroy($newimg);
74
-    	    imagedestroy($image);
75
-    	    imagedestroy($rotation);
68
+			$heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
69
+			$rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
70
+			imagealphablending($rotation, false);
71
+		imagesavealpha($rotation, true);
72
+			imagepng($rotation);
73
+			imagedestroy($newimg);
74
+			imagedestroy($image);
75
+			imagedestroy($rotation);
76 76
 	
77 77
 	} else {
78
-    	    imagepng($newimg);
79
-    	    imagedestroy($newimg);
80
-    	    imagedestroy($image);
81
-        }
82
-    } else {
78
+			imagepng($newimg);
79
+			imagedestroy($newimg);
80
+			imagedestroy($image);
81
+		}
82
+	} else {
83 83
 	imagealphablending($image, false);
84
-        imagesavealpha($image, true);
84
+		imagesavealpha($image, true);
85 85
 	imagepng($image);
86 86
 	imagepng($image);
87 87
 	if (is_writable('cache')) {
88
-    	    imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename);
88
+			imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename);
89
+	}
90
+		imagedestroy($image);
89 91
 	}
90
-        imagedestroy($image);
91
-    }
92 92
 } else {
93
-    header('Content-type: image/png');
94
-    if (isset($_GET['tracker'])) {
95
-        readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
96
-    } elseif (isset($_GET['marine'])) {
97
-        readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
98
-    } else {
99
-        if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
93
+	header('Content-type: image/png');
94
+	if (isset($_GET['tracker'])) {
95
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
96
+	} elseif (isset($_GET['marine'])) {
97
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
98
+	} else {
99
+		if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
100 100
 	else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
101
-    }
101
+	}
102 102
 }
103 103
 ?>
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	
21 21
 	public function getFilter($filter = array(),$where = false,$and = false) {
22 22
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	/**
83
-	* Executes the SQL statements to get the spotter information
84
-	*
85
-	* @param String $query the SQL query
86
-	* @param Array $params parameter of the query
87
-	* @param String $limitQuery the limit query
88
-	* @return Array the spotter information
89
-	*
90
-	*/
83
+	 * Executes the SQL statements to get the spotter information
84
+	 *
85
+	 * @param String $query the SQL query
86
+	 * @param Array $params parameter of the query
87
+	 * @param String $limitQuery the limit query
88
+	 * @return Array the spotter information
89
+	 *
90
+	 */
91 91
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92 92
 	{
93 93
 		date_default_timezone_set('UTC');
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 	
201 201
 	
202 202
 	/**
203
-	* Gets all the spotter information based on the latest data entry
204
-	*
205
-	* @return Array the spotter information
206
-	*
207
-	*/
203
+	 * Gets all the spotter information based on the latest data entry
204
+	 *
205
+	 * @return Array the spotter information
206
+	 *
207
+	 */
208 208
 	public function getLatestTrackerData($limit = '', $sort = '', $filter = array())
209 209
 	{
210 210
 		global $global_query;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on the callsign
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on the callsign
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
271 271
 	{
272 272
 		global $global_query;
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 
378 378
 
379 379
 	/**
380
-	* Gets all source name
381
-	*
382
-	* @param String type format of source
383
-	* @return Array list of source name
384
-	*
385
-	*/
380
+	 * Gets all source name
381
+	 *
382
+	 * @param String type format of source
383
+	 * @return Array list of source name
384
+	 *
385
+	 */
386 386
 	public function getAllSourceName($type = '',$filters = array())
387 387
 	{
388 388
 		$filter_query = $this->getFilter($filters,true,true);
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 
414 414
 	/**
415
-	* Gets a list of all idents/callsigns
416
-	*
417
-	* @return Array list of ident/callsign names
418
-	*
419
-	*/
415
+	 * Gets a list of all idents/callsigns
416
+	 *
417
+	 * @return Array list of ident/callsign names
418
+	 *
419
+	 */
420 420
 	public function getAllIdents($filters = array())
421 421
 	{
422 422
 		$filter_query = $this->getFilter($filters,true,true);
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	
485 485
 	
486 486
 	/**
487
-	* Update ident spotter data
488
-	*
489
-	* @param String $flightaware_id the ID from flightaware
490
-	* @param String $ident the flight ident
491
-	* @return String success or false
492
-	*
493
-	*/	
487
+	 * Update ident spotter data
488
+	 *
489
+	 * @param String $flightaware_id the ID from flightaware
490
+	 * @param String $ident the flight ident
491
+	 * @return String success or false
492
+	 *
493
+	 */	
494 494
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
495 495
 	{
496 496
 
497 497
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
498
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
498
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499 499
 
500 500
 		try {
501 501
 			$sth = $this->db->prepare($query);
@@ -508,18 +508,18 @@  discard block
 block discarded – undo
508 508
 
509 509
 	}
510 510
 	/**
511
-	* Update latest spotter data
512
-	*
513
-	* @param String $flightaware_id the ID from flightaware
514
-	* @param String $ident the flight ident
515
-	* @param String $arrival_airport_icao the arrival airport
516
-	* @return String success or false
517
-	*
518
-	*/	
511
+	 * Update latest spotter data
512
+	 *
513
+	 * @param String $flightaware_id the ID from flightaware
514
+	 * @param String $ident the flight ident
515
+	 * @param String $arrival_airport_icao the arrival airport
516
+	 * @return String success or false
517
+	 *
518
+	 */	
519 519
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
520 520
 	{
521 521
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
522
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
522
+				$query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523 523
 
524 524
 		try {
525 525
 			$sth = $this->db->prepare($query);
@@ -533,32 +533,32 @@  discard block
 block discarded – undo
533 533
 	}
534 534
 
535 535
 	/**
536
-	* Adds a new spotter data
537
-	*
538
-	* @param String $flightaware_id the ID from flightaware
539
-	* @param String $ident the flight ident
540
-	* @param String $aircraft_icao the aircraft type
541
-	* @param String $departure_airport_icao the departure airport
542
-	* @param String $arrival_airport_icao the arrival airport
543
-	* @param String $latitude latitude of flight
544
-	* @param String $longitude latitude of flight
545
-	* @param String $waypoints waypoints of flight
546
-	* @param String $altitude altitude of flight
547
-	* @param String $heading heading of flight
548
-	* @param String $groundspeed speed of flight
549
-	* @param String $date date of flight
550
-	* @param String $departure_airport_time departure time of flight
551
-	* @param String $arrival_airport_time arrival time of flight
552
-	* @param String $squawk squawk code of flight
553
-	* @param String $route_stop route stop of flight
554
-	* @param String $highlight highlight or not
555
-	* @param String $ModeS ModesS code of flight
556
-	* @param String $registration registration code of flight
557
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
558
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
559
-	* @param String $verticalrate vertival rate of flight
560
-	* @return String success or false
561
-	*/
536
+	 * Adds a new spotter data
537
+	 *
538
+	 * @param String $flightaware_id the ID from flightaware
539
+	 * @param String $ident the flight ident
540
+	 * @param String $aircraft_icao the aircraft type
541
+	 * @param String $departure_airport_icao the departure airport
542
+	 * @param String $arrival_airport_icao the arrival airport
543
+	 * @param String $latitude latitude of flight
544
+	 * @param String $longitude latitude of flight
545
+	 * @param String $waypoints waypoints of flight
546
+	 * @param String $altitude altitude of flight
547
+	 * @param String $heading heading of flight
548
+	 * @param String $groundspeed speed of flight
549
+	 * @param String $date date of flight
550
+	 * @param String $departure_airport_time departure time of flight
551
+	 * @param String $arrival_airport_time arrival time of flight
552
+	 * @param String $squawk squawk code of flight
553
+	 * @param String $route_stop route stop of flight
554
+	 * @param String $highlight highlight or not
555
+	 * @param String $ModeS ModesS code of flight
556
+	 * @param String $registration registration code of flight
557
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
558
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
559
+	 * @param String $verticalrate vertival rate of flight
560
+	 * @return String success or false
561
+	 */
562 562
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563 563
 	{
564 564
 		global $globalURL;
@@ -643,16 +643,16 @@  discard block
 block discarded – undo
643 643
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
644 644
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
645 645
 	
646
-                if ($latitude == '' && $longitude == '') {
647
-            		$latitude = 0;
648
-            		$longitude = 0;
649
-            	}
650
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
646
+				if ($latitude == '' && $longitude == '') {
647
+					$latitude = 0;
648
+					$longitude = 0;
649
+				}
650
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
+				$query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653 653
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
654 654
 
655
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
655
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656 656
 
657 657
 		try {
658 658
 		        
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 			$sth->execute($query_values);
661 661
 			$this->db = null;
662 662
 		} catch (PDOException $e) {
663
-		    return "error : ".$e->getMessage();
663
+			return "error : ".$e->getMessage();
664 664
 		}
665 665
 		
666 666
 		return "success";
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 	
670 670
   
671 671
 	/**
672
-	* Gets the aircraft ident within the last hour
673
-	*
674
-	* @return String the ident
675
-	*
676
-	*/
672
+	 * Gets the aircraft ident within the last hour
673
+	 *
674
+	 * @return String the ident
675
+	 *
676
+	 */
677 677
 	public function getIdentFromLastHour($ident)
678 678
 	{
679 679
 		global $globalDBdriver, $globalTimezone;
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
690 690
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
691 691
 			$query_data = array(':ident' => $ident);
692
-    		}
692
+			}
693 693
 		
694 694
 		$sth = $this->db->prepare($query);
695 695
 		$sth->execute($query_data);
696
-    		$ident_result='';
696
+			$ident_result='';
697 697
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
698 698
 		{
699 699
 			$ident_result = $row['ident'];
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
 	
705 705
 	
706 706
 	/**
707
-	* Gets the aircraft data from the last 20 seconds
708
-	*
709
-	* @return Array the spotter data
710
-	*
711
-	*/
707
+	 * Gets the aircraft data from the last 20 seconds
708
+	 *
709
+	 * @return Array the spotter data
710
+	 *
711
+	 */
712 712
 	public function getRealTimeData($q = '')
713 713
 	{
714 714
 		global $globalDBdriver;
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 	
747 747
 
748 748
 	/**
749
-	* Gets all number of flight over countries
750
-	*
751
-	* @return Array the airline country list
752
-	*
753
-	*/
749
+	 * Gets all number of flight over countries
750
+	 *
751
+	 * @return Array the airline country list
752
+	 *
753
+	 */
754 754
 /*
755 755
 	public function countAllTrackedOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
756 756
 	{
@@ -801,11 +801,11 @@  discard block
 block discarded – undo
801 801
 	
802 802
 	
803 803
 	/**
804
-	* Gets all callsigns that have flown over
805
-	*
806
-	* @return Array the callsign list
807
-	*
808
-	*/
804
+	 * Gets all callsigns that have flown over
805
+	 *
806
+	 * @return Array the callsign list
807
+	 *
808
+	 */
809 809
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
810 810
 	{
811 811
 		global $globalDBdriver;
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 
873 873
 
874 874
 	/**
875
-	* Counts all dates
876
-	*
877
-	* @return Array the date list
878
-	*
879
-	*/
875
+	 * Counts all dates
876
+	 *
877
+	 * @return Array the date list
878
+	 *
879
+	 */
880 880
 	public function countAllDates($filters = array())
881 881
 	{
882 882
 		global $globalTimezone, $globalDBdriver;
@@ -922,11 +922,11 @@  discard block
 block discarded – undo
922 922
 	
923 923
 	
924 924
 	/**
925
-	* Counts all dates during the last 7 days
926
-	*
927
-	* @return Array the date list
928
-	*
929
-	*/
925
+	 * Counts all dates during the last 7 days
926
+	 *
927
+	 * @return Array the date list
928
+	 *
929
+	 */
930 930
 	public function countAllDatesLast7Days($filters = array())
931 931
 	{
932 932
 		global $globalTimezone, $globalDBdriver;
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 			$query .= " GROUP BY date_name 
949 949
 								ORDER BY date_name ASC";
950 950
 			$query_data = array(':offset' => $offset);
951
-    		}
951
+			}
952 952
 		
953 953
 		$sth = $this->db->prepare($query);
954 954
 		$sth->execute($query_data);
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
 	}
969 969
 
970 970
 	/**
971
-	* Counts all dates during the last month
972
-	*
973
-	* @return Array the date list
974
-	*
975
-	*/
971
+	 * Counts all dates during the last month
972
+	 *
973
+	 * @return Array the date list
974
+	 *
975
+	 */
976 976
 	public function countAllDatesLastMonth($filters = array())
977 977
 	{
978 978
 		global $globalTimezone, $globalDBdriver;
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 			$query .= " GROUP BY date_name 
995 995
 								ORDER BY date_name ASC";
996 996
 			$query_data = array(':offset' => $offset);
997
-    		}
997
+			}
998 998
 		
999 999
 		$sth = $this->db->prepare($query);
1000 1000
 		$sth->execute($query_data);
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
 
1018 1018
 	/**
1019
-	* Counts all month
1020
-	*
1021
-	* @return Array the month list
1022
-	*
1023
-	*/
1019
+	 * Counts all month
1020
+	 *
1021
+	 * @return Array the month list
1022
+	 *
1023
+	 */
1024 1024
 	public function countAllMonths($filters = array())
1025 1025
 	{
1026 1026
 		global $globalTimezone, $globalDBdriver;
@@ -1065,11 +1065,11 @@  discard block
 block discarded – undo
1065 1065
 	
1066 1066
 
1067 1067
 	/**
1068
-	* Counts all dates during the last year
1069
-	*
1070
-	* @return Array the date list
1071
-	*
1072
-	*/
1068
+	 * Counts all dates during the last year
1069
+	 *
1070
+	 * @return Array the date list
1071
+	 *
1072
+	 */
1073 1073
 	public function countAllMonthsLastYear($filters)
1074 1074
 	{
1075 1075
 		global $globalTimezone, $globalDBdriver;
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 			$query .= " GROUP BY year_name, month_name
1092 1092
 								ORDER BY year_name, month_name ASC";
1093 1093
 			$query_data = array(':offset' => $offset);
1094
-    		}
1094
+			}
1095 1095
 		
1096 1096
 		$sth = $this->db->prepare($query);
1097 1097
 		$sth->execute($query_data);
@@ -1114,11 +1114,11 @@  discard block
 block discarded – undo
1114 1114
 	
1115 1115
 	
1116 1116
 	/**
1117
-	* Counts all hours
1118
-	*
1119
-	* @return Array the hour list
1120
-	*
1121
-	*/
1117
+	 * Counts all hours
1118
+	 *
1119
+	 * @return Array the hour list
1120
+	 *
1121
+	 */
1122 1122
 	public function countAllHours($orderby,$filters = array())
1123 1123
 	{
1124 1124
 		global $globalTimezone, $globalDBdriver;
@@ -1181,11 +1181,11 @@  discard block
 block discarded – undo
1181 1181
 	
1182 1182
 	
1183 1183
 	/**
1184
-	* Counts all hours by date
1185
-	*
1186
-	* @return Array the hour list
1187
-	*
1188
-	*/
1184
+	 * Counts all hours by date
1185
+	 *
1186
+	 * @return Array the hour list
1187
+	 *
1188
+	 */
1189 1189
 	public function countAllHoursByDate($date, $filters = array())
1190 1190
 	{
1191 1191
 		global $globalTimezone, $globalDBdriver;
@@ -1229,11 +1229,11 @@  discard block
 block discarded – undo
1229 1229
 	
1230 1230
 	
1231 1231
 	/**
1232
-	* Counts all hours by a ident/callsign
1233
-	*
1234
-	* @return Array the hour list
1235
-	*
1236
-	*/
1232
+	 * Counts all hours by a ident/callsign
1233
+	 *
1234
+	 * @return Array the hour list
1235
+	 *
1236
+	 */
1237 1237
 	public function countAllHoursByIdent($ident, $filters = array())
1238 1238
 	{
1239 1239
 		global $globalTimezone, $globalDBdriver;
@@ -1278,11 +1278,11 @@  discard block
 block discarded – undo
1278 1278
 	
1279 1279
 	
1280 1280
 	/**
1281
-	* Counts all flights that have flown over
1282
-	*
1283
-	* @return Integer the number of flights
1284
-	*
1285
-	*/
1281
+	 * Counts all flights that have flown over
1282
+	 *
1283
+	 * @return Integer the number of flights
1284
+	 *
1285
+	 */
1286 1286
 	public function countOverallTracked($filters = array(),$year = '',$month = '')
1287 1287
 	{
1288 1288
 		global $globalDBdriver;
@@ -1317,11 +1317,11 @@  discard block
 block discarded – undo
1317 1317
 	
1318 1318
   
1319 1319
 	/**
1320
-	* Counts all hours of today
1321
-	*
1322
-	* @return Array the hour list
1323
-	*
1324
-	*/
1320
+	 * Counts all hours of today
1321
+	 *
1322
+	 * @return Array the hour list
1323
+	 *
1324
+	 */
1325 1325
 	public function countAllHoursFromToday($filters = array())
1326 1326
 	{
1327 1327
 		global $globalTimezone, $globalDBdriver;
@@ -1361,12 +1361,12 @@  discard block
 block discarded – undo
1361 1361
 	}
1362 1362
     
1363 1363
     
1364
-     /**
1365
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1366
-	*
1367
-	* @return Integer the Barrie Spotter ID
1364
+	 /**
1365
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1366
+	  *
1367
+	  * @return Integer the Barrie Spotter ID
1368 1368
 q	*
1369
-	*/
1369
+	  */
1370 1370
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1371 1371
 	{
1372 1372
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1387,13 +1387,13 @@  discard block
 block discarded – undo
1387 1387
   
1388 1388
  
1389 1389
 	/**
1390
-	* Parses a date string
1391
-	*
1392
-	* @param String $dateString the date string
1393
-	* @param String $timezone the timezone of a user
1394
-	* @return Array the time information
1395
-	*
1396
-	*/
1390
+	 * Parses a date string
1391
+	 *
1392
+	 * @param String $dateString the date string
1393
+	 * @param String $timezone the timezone of a user
1394
+	 * @return Array the time information
1395
+	 *
1396
+	 */
1397 1397
 	public function parseDateString($dateString, $timezone = '')
1398 1398
 	{
1399 1399
 		$time_array = array();
@@ -1426,12 +1426,12 @@  discard block
 block discarded – undo
1426 1426
 	}
1427 1427
 	
1428 1428
 	/**
1429
-	* Parses the direction degrees to working
1430
-	*
1431
-	* @param Float $direction the direction in degrees
1432
-	* @return Array the direction information
1433
-	*
1434
-	*/
1429
+	 * Parses the direction degrees to working
1430
+	 *
1431
+	 * @param Float $direction the direction in degrees
1432
+	 * @return Array the direction information
1433
+	 *
1434
+	 */
1435 1435
 	public function parseDirection($direction = 0)
1436 1436
 	{
1437 1437
 		if ($direction == '') $direction = 0;
@@ -1510,12 +1510,12 @@  discard block
 block discarded – undo
1510 1510
 	
1511 1511
 	
1512 1512
 	/**
1513
-	* Gets Country from latitude/longitude
1514
-	*
1515
-	* @param Float $latitude latitute of the flight
1516
-	* @param Float $longitude longitute of the flight
1517
-	* @return String the countrie
1518
-	*/
1513
+	 * Gets Country from latitude/longitude
1514
+	 *
1515
+	 * @param Float $latitude latitute of the flight
1516
+	 * @param Float $longitude longitute of the flight
1517
+	 * @return String the countrie
1518
+	 */
1519 1519
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1520 1520
 	{
1521 1521
 		global $globalDBdriver, $globalDebug;
@@ -1552,11 +1552,11 @@  discard block
 block discarded – undo
1552 1552
 	}
1553 1553
 
1554 1554
 	/**
1555
-	* Gets Country from iso2
1556
-	*
1557
-	* @param String $iso2 ISO2 country code
1558
-	* @return String the countrie
1559
-	*/
1555
+	 * Gets Country from iso2
1556
+	 *
1557
+	 * @param String $iso2 ISO2 country code
1558
+	 * @return String the countrie
1559
+	 */
1560 1560
 	public function getCountryFromISO2($iso2)
1561 1561
 	{
1562 1562
 		global $globalDBdriver, $globalDebug;
@@ -1585,12 +1585,12 @@  discard block
 block discarded – undo
1585 1585
 
1586 1586
 	
1587 1587
 	/**
1588
-	* Gets the short url from bit.ly
1589
-	*
1590
-	* @param String $url the full url
1591
-	* @return String the bit.ly url
1592
-	*
1593
-	*/
1588
+	 * Gets the short url from bit.ly
1589
+	 *
1590
+	 * @param String $url the full url
1591
+	 * @return String the bit.ly url
1592
+	 *
1593
+	 */
1594 1594
 	public function getBitlyURL($url)
1595 1595
 	{
1596 1596
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.