Completed
Push — master ( 8357f7...e95418 )
by Yannick
09:32
created
atc-data.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@
 block discarded – undo
40 40
 //print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
41 41
 print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>';
42 42
 if ($spotter_item['atc_range'] > 0) {
43
-    print '<div><span>'._("Range").'</span>';
44
-    print $spotter_item['atc_range'];
45
-    print '</div>';
43
+	print '<div><span>'._("Range").'</span>';
44
+	print $spotter_item['atc_range'];
45
+	print '</div>';
46 46
 }
47 47
 print '</div>';
48 48
 if ($spotter_item['info'] != '') {
49
-    print '<div class="notamtext"><span>'._("Info").'</span>';
50
-    print $spotter_item['info'];
51
-    print '</div>';
49
+	print '<div class="notamtext"><span>'._("Info").'</span>';
50
+	print $spotter_item['info'];
51
+	print '</div>';
52 52
 }
53 53
 print '</div>';
54 54
 }
Please login to merge, or discard this patch.
atc-geojson.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 		date_default_timezone_set('UTC');
25 25
 		//waypoint plotting
26 26
 		$output .= '{"type": "Feature",';
27
-		    $output .= '"properties": {';
27
+			$output .= '"properties": {';
28 28
 			$output .= '"ref": "'.$spotter_item['atc_id'].'",';
29 29
 			$output .= '"ident": "'.$spotter_item['ident'].'",';
30 30
 			$output .= '"frequency": "'.$spotter_item['frequency'].'",';
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 			} else {
51 51
 				$output .= '"icon": "images/atc.png"';
52 52
 			}
53
-		    $output .= '},';
54
-		    $output .= '"geometry": {';
53
+			$output .= '},';
54
+			$output .= '"geometry": {';
55 55
 			$output .= '"type": "Point",';
56 56
 			$output .= '"coordinates": [';
57
-			    $output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
57
+				$output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
58 58
 			$output .= ']';
59
-		    $output .= '}';
59
+			$output .= '}';
60 60
 		$output .= '},';
61 61
 		$radius = $spotter_item['atc_range']*100;
62 62
 		if ($radius > 0) {
63 63
 			$output .= '{"type": "Feature",';
64
-			    $output .= '"properties": {';
64
+				$output .= '"properties": {';
65 65
 				$output .= '"ref": "'.$spotter_item['atc_id'].'",';
66 66
 				$output .= '"ident": "'.$spotter_item['ident'].'",';
67 67
 				$output .= '"frequency": "'.$spotter_item['frequency'].'",';
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 				} else {
88 88
 					$output .= '"atccolor": "#888219"';
89 89
 				}
90
-			    $output .= '},';
91
-			    $output .= '"geometry": {';
90
+				$output .= '},';
91
+				$output .= '"geometry": {';
92 92
 				$output .= '"type": "Point",';
93 93
 				$output .= '"coordinates": [';
94
-				    $output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
94
+					$output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
95 95
 				$output .= ']';
96
-			    $output .= '}';
96
+				$output .= '}';
97 97
 			$output .= '},';
98 98
 		}
99 99
 	}
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 require_once(dirname(__FILE__).'/class.Common.php');
4 4
 class aprs {
5
-    private $socket;
6
-    private $connected = false;
5
+	private $socket;
6
+	private $connected = false;
7 7
 
8
-    protected $symbols = array('!' => 'Police',
8
+	protected $symbols = array('!' => 'Police',
9 9
 	'#' => 'DIGI',
10 10
 	'$' => 'Phone',
11 11
 	'%' => 'DX Cluster',
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	'y' => 'Yagi At QTH');
90 90
 	
91 91
 
92
-    private function urshift($n, $s) {
92
+	private function urshift($n, $s) {
93 93
 	return ($n >= 0) ? ($n >> $s) :
94
-	    (($n & 0x7fffffff) >> $s) | 
94
+		(($n & 0x7fffffff) >> $s) | 
95 95
 		(0x40000000 >> ($s - 1));
96
-    }
96
+	}
97 97
 
98
-    public function parse($input) {
98
+	public function parse($input) {
99 99
 	global $globalDebug;
100 100
 	$debug = false;
101 101
 	$result = array();
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 	
108 108
 	/* Check that end was found and body has at least one byte. */
109 109
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
110
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
111
-	    return false;
110
+		if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
111
+		return false;
112 112
 	}
113 113
 	
114 114
 	if ($debug) echo 'input : '.$input."\n";
@@ -122,31 +122,31 @@  discard block
 block discarded – undo
122 122
 	/* Parse source, target and path. */
123 123
 	//FLRDF0A52>APRS,qAS,LSTB
124 124
 	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
125
-	    $ident = $matches[1];
126
-	    $all_elements = $matches[2];
127
-	    if ($ident == 'AIRCRAFT') {
125
+		$ident = $matches[1];
126
+		$all_elements = $matches[2];
127
+		if ($ident == 'AIRCRAFT') {
128 128
 		$result['format_source'] = 'famaprs';
129 129
 		$result['source_type'] = 'modes';
130
-	    } elseif ($ident == 'MARINE') {
130
+		} elseif ($ident == 'MARINE') {
131 131
 		$result['format_source'] = 'famaprs';
132 132
 		$result['source_type'] = 'ais';
133
-	    } else {
133
+		} else {
134 134
 		if ($debug) echo 'ident : '.$ident."\n";
135 135
 		$result['ident'] = $ident;
136
-	    }
136
+		}
137 137
 	} else return false;
138 138
 	$elements = explode(',',$all_elements);
139 139
 	$source = end($elements);
140 140
 	$result['source'] = $source;
141 141
 	foreach ($elements as $element) {
142
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
143
-	        //echo "ok";
144
-	        //if ($element == 'TCPIP*') return false;
145
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
142
+		if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
143
+			//echo "ok";
144
+			//if ($element == 'TCPIP*') return false;
145
+		} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
146 146
 		if ($debug) echo 'element : '.$element."\n";
147 147
 		return false;
148
-	    }
149
-	    /*
148
+		}
149
+		/*
150 150
 	    } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) {
151 151
 		//echo "ok";
152 152
 	    } else {
@@ -173,49 +173,49 @@  discard block
 block discarded – undo
173 173
 	$body_parse = substr($body,1);
174 174
 	//echo 'Body : '.$body."\n";
175 175
 	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
176
-	    $body_parse = substr($body_parse,10);
177
-	    $find = true;
178
-	    //echo $body_parse."\n";
176
+		$body_parse = substr($body_parse,10);
177
+		$find = true;
178
+		//echo $body_parse."\n";
179 179
 	}
180 180
 	if (preg_match('/^`(.*)\//',$body,$matches)) {
181
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
182
-	    $find = true;
183
-	    //echo $body_parse."\n";
181
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
182
+		$find = true;
183
+		//echo $body_parse."\n";
184 184
 	}
185 185
 	if (preg_match("/^'(.*)\//",$body,$matches)) {
186
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
187
-	    $find = true;
188
-	    //echo $body_parse."\n";
186
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
187
+		$find = true;
188
+		//echo $body_parse."\n";
189 189
 	}
190 190
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
191
-	    $find = true;
192
-	    //print_r($matches);
193
-	    $timestamp = $matches[0];
194
-	    if ($matches[4] == 'h') {
191
+		$find = true;
192
+		//print_r($matches);
193
+		$timestamp = $matches[0];
194
+		if ($matches[4] == 'h') {
195 195
 		$timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]);
196 196
 		//echo 'timestamp : '.$timestamp.' - now : '.time()."\n";
197 197
 		/*
198 198
 		if (time() + 3900 < $timestamp) $timestamp -= 86400;
199 199
 		elseif (time() - 82500 > $timestamp) $timestamp += 86400;
200 200
 		*/
201
-	    } elseif ($matches[4] == 'z' || $matches[4] == '/') {
201
+		} elseif ($matches[4] == 'z' || $matches[4] == '/') {
202 202
 		// This work or not ?
203 203
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
204
-	    }
205
-	    $body_parse = substr($body_parse,7);
206
-	    $result['timestamp'] = $timestamp;
207
-	    //echo date('Ymd H:i:s',$timestamp);
204
+		}
205
+		$body_parse = substr($body_parse,7);
206
+		$result['timestamp'] = $timestamp;
207
+		//echo date('Ymd H:i:s',$timestamp);
208 208
 	}
209 209
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
210
-	    $find = true;
211
-	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
212
-	    $body_parse = substr($body_parse,8);
213
-	    $result['timestamp'] = $timestamp;
214
-	    //echo date('Ymd H:i:s',$timestamp);
210
+		$find = true;
211
+		$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
212
+		$body_parse = substr($body_parse,8);
213
+		$result['timestamp'] = $timestamp;
214
+		//echo date('Ymd H:i:s',$timestamp);
215 215
 	}
216 216
 	//if (strlen($body_parse) > 19) {
217
-	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
218
-	    $find = true;
217
+		if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
218
+		$find = true;
219 219
 		// 4658.70N/00707.78Ez
220 220
 		//print_r(str_split($body_parse));
221 221
 		
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		$lon = intval($lon_deg);
233 233
 		if ($lat > 89 || $lon > 179) return false;
234 234
 	    
235
-	    /*
235
+		/*
236 236
 	    $tmp_5b = str_replace('.','',$lat_min);
237 237
 	    if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) {
238 238
 	        print_r($matches);
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 		$result['longitude'] = $longitude;
247 247
 		$body_parse = substr($body_parse,18);
248 248
 		$body_parse_len = strlen($body_parse);
249
-	    }
250
-	    $body_parse_len = strlen($body_parse);
251
-	    if ($body_parse_len > 0) {
249
+		}
250
+		$body_parse_len = strlen($body_parse);
251
+		if ($body_parse_len > 0) {
252 252
 		/*
253 253
 		if (!isset($result['timestamp']) && !isset($result['latitude'])) {
254 254
 			$body_split = str_split($body);
@@ -278,95 +278,95 @@  discard block
 block discarded – undo
278 278
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
279 279
 			if ($symbol_code != '_') {
280 280
 			}
281
-		    //$body_parse = substr($body_parse,1);
282
-		    //$body_parse = trim($body_parse);
283
-		    //$body_parse_len = strlen($body_parse);
284
-		    if ($body_parse_len >= 7) {
281
+			//$body_parse = substr($body_parse,1);
282
+			//$body_parse = trim($body_parse);
283
+			//$body_parse_len = strlen($body_parse);
284
+			if ($body_parse_len >= 7) {
285 285
 			
286
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
287
-		    	    $course = substr($body_parse,0,3);
288
-		    	    $tmp_s = intval($course);
289
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
290
-		    	    $speed = substr($body_parse,4,3);
291
-		    	    if ($speed != '...') {
292
-		    		//$result['speed'] = round($speed*1.852);
293
-		    		$result['speed'] = intval($speed);
294
-		    	    }
295
-		    	    $body_parse = substr($body_parse,7);
296
-		        }
297
-		        // Check PHGR, PHG, RNG
298
-		    } 
299
-		    /*
286
+				if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
287
+					$course = substr($body_parse,0,3);
288
+					$tmp_s = intval($course);
289
+					if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
290
+					$speed = substr($body_parse,4,3);
291
+					if ($speed != '...') {
292
+					//$result['speed'] = round($speed*1.852);
293
+					$result['speed'] = intval($speed);
294
+					}
295
+					$body_parse = substr($body_parse,7);
296
+				}
297
+				// Check PHGR, PHG, RNG
298
+			} 
299
+			/*
300 300
 		    else if ($body_parse_len > 0) {
301 301
 			$rest = $body_parse;
302 302
 		    }
303 303
 		    */
304
-		    if (strlen($body_parse) > 0) {
305
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
306
-		            $altitude = intval($matches[1]);
307
-		            //$result['altitude'] = round($altitude*0.3048);
308
-		            $result['altitude'] = $altitude;
309
-		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
310
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
311
-		        }
312
-		    }
304
+			if (strlen($body_parse) > 0) {
305
+				if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
306
+					$altitude = intval($matches[1]);
307
+					//$result['altitude'] = round($altitude*0.3048);
308
+					$result['altitude'] = $altitude;
309
+					//$body_parse = trim(substr($body_parse,strlen($matches[0])));
310
+					$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
311
+				}
312
+			}
313 313
 		    
314
-		    // Telemetry
315
-		    /*
314
+			// Telemetry
315
+			/*
316 316
 		    if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) {
317 317
 		        // Nothing yet...
318 318
 		    }
319 319
 		    */
320
-		    // DAO
320
+			// DAO
321 321
 		    
322
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
322
+			if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
323 323
 			    
324
-			    $dao = $matches[1];
325
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
324
+				$dao = $matches[1];
325
+				if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
326 326
 				$dao_split = str_split($dao);
327
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
328
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
327
+					$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
328
+					$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
329 329
 			    
330 330
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
331 331
 				else $result['latitude'] += $lat_off;
332 332
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
333 333
 				else $result['longitude'] += $lon_off;
334
-			    }
334
+				}
335 335
 			    
336
-		            $body_parse = substr($body_parse,6);
337
-		    }
336
+					$body_parse = substr($body_parse,6);
337
+			}
338 338
 		    
339
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
339
+			if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
340 340
 			$result['ident'] = str_replace('_',' ',$matches[1]);
341
-		    }
342
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
341
+			}
342
+			if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
343 343
 			$result['squawk'] = $matches[1];
344
-		    }
345
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
344
+			}
345
+			if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
346 346
 			$result['aircraft_icao'] = $matches[1];
347
-		    }
348
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
347
+			}
348
+			if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
349 349
 			$result['verticalrate'] = $matches[1];
350
-		    }
351
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
350
+			}
351
+			if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
352 352
 			$result['typeid'] = $matches[1];
353
-		    }
354
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
353
+			}
354
+			if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
355 355
 			$result['statusid'] = $matches[1];
356
-		    }
357
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
356
+			}
357
+			if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
358 358
 			$result['imo'] = $matches[1];
359
-		    }
360
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
359
+			}
360
+			if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
361 361
 			$result['arrival_date'] = $matches[1];
362
-		    }
363
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
362
+			}
363
+			if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
364 364
 			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
365
-		    }
366
-		    // OGN comment
365
+			}
366
+			// OGN comment
367 367
 		   // echo "Before OGN : ".$body_parse."\n";
368
-		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
369
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
368
+			//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
369
+			if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
370 370
 			$id = $matches[1];
371 371
 			//$mode = substr($id,0,2);
372 372
 			$address = substr($id,2);
@@ -396,53 +396,53 @@  discard block
 block discarded – undo
396 396
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
397 397
 			$result['stealth'] = $stealth;
398 398
 			$result['address'] = $address;
399
-		    }
399
+			}
400 400
 		    
401
-		    //Comment
402
-		    $result['comment'] = trim($body_parse);
401
+			//Comment
402
+			$result['comment'] = trim($body_parse);
403 403
 		} else {
404
-		    // parse weather
405
-		    //$body_parse = substr($body_parse,1);
406
-		    //$body_parse_len = strlen($body_parse);
404
+			// parse weather
405
+			//$body_parse = substr($body_parse,1);
406
+			//$body_parse_len = strlen($body_parse);
407 407
 
408
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
409
-			    $result['wind_dir'] = intval($matches[1]);
410
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
411
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
412
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
413
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
414
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
408
+			if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
409
+				$result['wind_dir'] = intval($matches[1]);
410
+				$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
411
+				$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
412
+				$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
413
+					$body_parse = substr($body_parse,strlen($matches[0])+1);
414
+			} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
415 415
 			$result['wind_dir'] = intval($matches[1]);
416 416
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
417 417
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
418 418
 			$result['temp'] = round(5/9*(($matches[4])-32),1);
419
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
420
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
419
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
420
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
421 421
 			$result['wind_dir'] = intval($matches[1]);
422 422
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
423 423
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
424
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
425
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
424
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
425
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
426 426
 			$result['wind_dir'] = intval($matches[1]);
427 427
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
428 428
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
429
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
430
-		    }
431
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
429
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
430
+			}
431
+			if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
432 432
 			$result['temp'] = round(5/9*(($matches[1])-32),1);
433
-		    }
433
+			}
434 434
 		}
435 435
 		} else $result['comment'] = trim($body_parse);
436 436
 
437
-	    }
437
+		}
438 438
 	//}
439 439
 	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
440 440
 	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
441 441
 	if ($debug) print_r($result);
442 442
 	return $result;
443
-    }
443
+	}
444 444
     
445
-    public function connect() {
445
+	public function connect() {
446 446
 	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
447 447
 	$aprs_connect = 0;
448 448
 	$aprs_keep = 120;
@@ -466,24 +466,24 @@  discard block
 block discarded – undo
466 466
 		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1);
467 467
 		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
468 468
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
469
-			    echo 'APRS user verified !'."\n";
470
-			    $this->connected = true;
471
-			    return true;
472
-			    break;
469
+				echo 'APRS user verified !'."\n";
470
+				$this->connected = true;
471
+				return true;
472
+				break;
473 473
 			}
474 474
 			if (time()-$authstart > 5) {
475
-			    echo 'APRS timeout'."\n";
476
-			    break;
475
+				echo 'APRS timeout'."\n";
476
+				break;
477 477
 			}
478 478
 		}
479 479
 	}
480
-    }
480
+	}
481 481
 
482
-    public function disconnect() {
482
+	public function disconnect() {
483 483
 	socket_close($this->socket);
484
-    }
484
+	}
485 485
     
486
-    public function send($data) {
486
+	public function send($data) {
487 487
 	global $globalDebug;
488 488
 	if ($this->connected === false) $this->connect();
489 489
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 		socket_close($this->socket);
493 493
 		$this->connect();
494 494
 	}
495
-    }
495
+	}
496 496
 }
497 497
 
498 498
 class APRSSpotter extends APRS {
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     <?php }; if (isset($globalTracker) && $globalTracker) { ?><td><div id="ibxtracker"><h4><?php echo _("Trackers Detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
41 41
 </tr></table></div>
42 42
 <?php
43
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
43
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
44 44
 
45 45
 ?>
46 46
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
61 61
 <?php
62 62
 	}
63
-    }
63
+	}
64 64
 ?>
65 65
 <div id="dialog" title="<?php echo _("Session has timed-out"); ?>">
66 66
   <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p>
@@ -74,34 +74,34 @@  discard block
 block discarded – undo
74 74
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
75 75
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
76 76
 <?php
77
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
77
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
78 78
 	if (isset($globalArchive) && $globalArchive == TRUE) {
79 79
 ?>
80 80
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
81 81
 <?php
82 82
 	}
83
-    }
83
+	}
84 84
 ?>
85 85
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
86 86
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
87 87
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
88 88
 <?php
89
-    if (isset($globalMap3D) && $globalMap3D) {
89
+	if (isset($globalMap3D) && $globalMap3D) {
90 90
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
91 91
 ?>
92 92
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
93 93
 <?php
94
-        } else {
95
-    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
94
+		} else {
95
+			if (isset($globalMapSatellites) && $globalMapSatellites) {
96 96
 ?>
97 97
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
98 98
 <?php
99
-	    }
99
+		}
100 100
 ?>
101 101
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
102 102
 <?php
103 103
 	}
104
-    }
104
+	}
105 105
 ?>
106 106
     </ul>
107 107
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 ?>
176 176
         </div>
177 177
 <?php
178
-    if (isset($globalArchive) && $globalArchive == TRUE) {
178
+	if (isset($globalArchive) && $globalArchive == TRUE) {
179 179
 ?>
180 180
         <div class="sidebar-pane" id="archive">
181 181
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	    </form>
236 236
 	</div>
237 237
 <?php
238
-    }
238
+	}
239 239
 ?>
240 240
         <div class="sidebar-pane" id="settings">
241 241
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -246,56 +246,56 @@  discard block
 block discarded – undo
246 246
 			    <?php
247 247
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
248 248
 				else $MapType = $_COOKIE['MapType'];
249
-			    ?>
249
+				?>
250 250
 			    <?php
251 251
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
252
-			    ?>
252
+				?>
253 253
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
254 254
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
255 255
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
256 256
 			    <?php
257 257
 				}
258
-			    ?>
258
+				?>
259 259
 			    <?php
260
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
261
-			    ?>
260
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
261
+				?>
262 262
 			    <?php
263
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
264
-			    ?>
263
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
264
+				?>
265 265
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
266 266
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
267 267
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
268 268
 			    <?php
269
-				    }
270
-			    ?>
269
+					}
270
+				?>
271 271
 			    <?php
272
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
273
-			    ?>
272
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
273
+				?>
274 274
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
275 275
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
276 276
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
277 277
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
278 278
 			    <?php
279
-				    }
280
-			    ?>
279
+					}
280
+				?>
281 281
 			    <?php
282
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
283
-			    ?>
282
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
283
+				?>
284 284
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
285 285
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
286 286
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
287 287
 			    <?php
288
-				    }
289
-			    ?>
288
+					}
289
+				?>
290 290
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
291 291
 			    <?php
292 292
 				}
293
-			    ?>
293
+				?>
294 294
 			    <?php
295
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
295
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
296 296
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
297 297
 					else $MapBoxId = $_COOKIE['MapTypeId'];
298
-			    ?>
298
+				?>
299 299
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
300 300
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
301 301
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -309,13 +309,13 @@  discard block
 block discarded – undo
309 309
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
310 310
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
311 311
 			    <?php
312
-				    }
313
-			    ?>
312
+					}
313
+				?>
314 314
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
315 315
 			</select>
316 316
 		    </li>
317 317
 <?php
318
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
318
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
319 319
 ?>
320 320
 		    <li><?php echo _("Type of Terrain:"); ?>
321 321
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 			</select>
326 326
 		    </li>
327 327
 <?php
328
-    }
328
+	}
329 329
 ?>
330 330
 <?php
331
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
331
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
332 332
 ?>
333 333
 		    
334 334
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
@@ -337,75 +337,75 @@  discard block
 block discarded – undo
337 337
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
338 338
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
339 339
 <?php
340
-    }
340
+	}
341 341
 ?>
342 342
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
343 343
 <?php
344
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
344
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
345 345
 ?>
346 346
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
347 347
 <?php
348
-    }
349
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
348
+	}
349
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
350 350
 ?>
351 351
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
352 352
 <?php
353
-    }
353
+	}
354 354
 ?>
355 355
 
356 356
 		    <?php
357 357
 			if (function_exists('array_column')) {
358
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
359
-		    ?>
358
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
359
+			?>
360 360
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
361 361
 		    <?php
362
-			    }
362
+				}
363 363
 			} elseif (isset($globalSources)) {
364
-			    $dispolar = false;
365
-			    foreach ($globalSources as $testsource) {
366
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
367
-			    }
368
-			    if ($dispolar) {
369
-		    ?>
364
+				$dispolar = false;
365
+				foreach ($globalSources as $testsource) {
366
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
367
+				}
368
+				if ($dispolar) {
369
+			?>
370 370
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
371 371
 		    <?php
372
-			    }
373
-		        }
374
-		    ?>
372
+				}
373
+				}
374
+			?>
375 375
 <?php
376
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
376
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
377 377
 ?>
378 378
 
379 379
 		    <?php
380 380
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
381
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
382
-		    ?>
381
+					if (extension_loaded('gd') && function_exists('gd_info')) {
382
+			?>
383 383
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
384 384
 		    <?php 
385 385
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
386
-		    ?>
386
+			?>
387 387
 		    <li><?php echo _("Aircraft icon color:"); ?>
388 388
 			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
389 389
 		    </li>
390 390
 		    <?php
391 391
 				}
392
-			    }
393
-		        }
394
-		    ?>
392
+				}
393
+				}
394
+			?>
395 395
 		    <?php
396 396
 			if (isset($globalMarine) && $globalMarine === TRUE) {
397
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
398
-		    ?>
397
+				if (extension_loaded('gd') && function_exists('gd_info')) {
398
+			?>
399 399
 		    <li><?php echo _("Marine icon color:"); ?>
400 400
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
401 401
 		    </li>
402 402
 		    <?php
403
-			    }
404
-		        }
405
-		    ?>
403
+				}
404
+				}
405
+			?>
406 406
 		    <?php
407 407
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
408
-		    ?>
408
+			?>
409 409
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
410 410
 			<div class="range">
411 411
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
 		    </li>
415 415
 		    <?php
416 416
 			}
417
-		    ?>
417
+			?>
418 418
 <?php
419
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
419
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
420 420
 ?>
421 421
 <?php
422 422
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		    </li>
438 438
 <?php
439 439
 	}
440
-    }
440
+	}
441 441
 ?>
442 442
 		    <li><?php echo _("Distance unit:"); ?>
443 443
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -470,19 +470,19 @@  discard block
 block discarded – undo
470 470
 		    <ul>
471 471
 		    <?php
472 472
 			if (!isset($globalAircraft) || $globalAircraft) {
473
-		    ?>
473
+			?>
474 474
 		    <?php
475 475
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
476
-		    ?>
476
+			?>
477 477
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
478 478
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
479 479
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
480 480
 		    <?php
481 481
 			}
482
-		    ?>
482
+			?>
483 483
 		    <?php
484 484
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
485
-		    ?>
485
+			?>
486 486
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
487 487
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
488 488
 			<?php } ?>
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 			<?php } ?>
492 492
 		    <?php
493 493
 			}
494
-		    ?>
494
+			?>
495 495
 		    <li><?php echo _("Display airlines:"); ?>
496 496
 		    <br/>
497 497
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -511,14 +511,14 @@  discard block
 block discarded – undo
511 511
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
512 512
 					}
513 513
 				}
514
-			    ?>
514
+				?>
515 515
 			</select>
516 516
 		    </li>
517 517
 		    <?php
518 518
 			$Spotter = new Spotter();
519 519
 			$allalliancenames = $Spotter->getAllAllianceNames();
520 520
 			if (!empty($allalliancenames)) {
521
-		    ?>
521
+			?>
522 522
 		    <li><?php echo _("Display alliance:"); ?>
523 523
 		    <br/>
524 524
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -532,18 +532,18 @@  discard block
 block discarded – undo
532 532
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
533 533
 					}
534 534
 				}
535
-			    ?>
535
+				?>
536 536
 			</select>
537 537
 		    </li>
538 538
 		    <?php
539 539
 			}
540
-		    ?>
540
+			?>
541 541
 		    <?php
542 542
 			}
543
-		    ?>
543
+			?>
544 544
 		    <?php
545 545
 			if (isset($globalAPRS) && $globalAPRS) {
546
-		    ?>
546
+			?>
547 547
 		    <li><?php echo _("Display APRS sources name:"); ?>
548 548
 			<select class="selectpicker" multiple onchange="sources(this);">
549 549
 			    <?php
@@ -555,18 +555,18 @@  discard block
 block discarded – undo
555 555
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
556 556
 					}
557 557
 				}
558
-			    ?>
558
+				?>
559 559
 			</select>
560 560
 		    </li>
561 561
 		    <?php
562 562
 			}
563
-		    ?>
563
+			?>
564 564
 		    <?php
565 565
 			if (!isset($globalAircraft) && $globalAircraft) {
566
-		    ?>
566
+			?>
567 567
 		    <?php
568 568
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
569
-		    ?>
569
+			?>
570 570
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
571 571
 			<select class="selectpicker" onchange="airlinestype(this);">
572 572
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -577,14 +577,14 @@  discard block
 block discarded – undo
577 577
 		    </li>
578 578
 		    <?php
579 579
 			}
580
-		    ?>
580
+			?>
581 581
 		    <li>
582 582
 			<?php echo _("Display flight with ident:"); ?>
583 583
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
584 584
 		    </li>
585 585
 		    <?php
586 586
 			}
587
-		    ?>
587
+			?>
588 588
 		</ul>
589 589
 	    </form>
590 590
 	    <form method="post">
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 	    </form>
594 594
     	</div>
595 595
 <?php
596
-    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
596
+	if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
597 597
 ?>
598 598
         <div class="sidebar-pane" id="satellites">
599 599
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -633,14 +633,14 @@  discard block
 block discarded – undo
633 633
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
634 634
 					}
635 635
 				}
636
-			    ?>
636
+				?>
637 637
 			</select>
638 638
 		    </li>
639 639
 		</ul>
640 640
 	    </form>
641 641
 	</div>
642 642
 <?php
643
-    }
643
+	}
644 644
 ?>
645 645
     </div>
646 646
 </div>
Please login to merge, or discard this patch.
header.php 1 patch
Indentation   +67 added lines, -67 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]);
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 ?>
169 169
 <?php 
170
-    if (isset($_POST['archive'])) {
170
+	if (isset($_POST['archive'])) {
171 171
 ?>
172 172
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
173 173
 <?php 
174
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
174
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
175 175
 ?>
176 176
 
177 177
 <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>
178 178
 <?php    
179
-	    }
180
-    } else {
179
+		}
180
+	} else {
181 181
 ?>
182 182
 <?php
183 183
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 */
190 190
 ?>
191 191
 <?php 
192
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
192
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
193 193
 ?>
194 194
 <?php
195 195
 //		if (isset($globalBeta) && $globalBeta) {
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 <script src="<?php print $globalURL; ?>/js/map-marine.2d.js.php?<?php print time(); ?>"></script>
217 217
 <?php
218 218
 		}
219
-	    }
219
+		}
220 220
 ?>
221 221
 <?php
222 222
 //	}
223 223
 ?>
224 224
 <?php
225
-    }
225
+	}
226 226
 }
227 227
 ?>
228 228
 <?php
@@ -398,24 +398,24 @@  discard block
 block discarded – undo
398 398
       <ul class="nav navbar-nav">
399 399
 
400 400
 <?php 
401
-    $sub = false;
402
-    if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) {
401
+	$sub = false;
402
+	if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) {
403 403
 	$sub = true;
404
-    }
404
+	}
405 405
 ?>
406 406
 <?php
407
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
407
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
408 408
 ?>
409 409
     <li class="dropdown">
410 410
 <?php
411
-    if ($sub) {
411
+	if ($sub) {
412 412
 ?>
413 413
       	<li class="dropdown">
414 414
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a>
415 415
 	<ul class="dropdown-menu multi-level">
416 416
       	<li class="dropdown-submenu">
417 417
 <?php
418
-    }
418
+	}
419 419
 ?>
420 420
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
421 421
           <ul class="dropdown-menu">
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
424 424
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
425 425
 <?php
426
-    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
426
+	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
427 427
 ?>
428 428
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
429 429
 <?php
430
-    } 
431
-    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
430
+	} 
431
+	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
432 432
 
433 433
 ?>
434 434
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
435 435
 <?php
436
-    }
436
+	}
437 437
 ?>
438 438
 			<li><hr /></li>
439 439
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -441,34 +441,34 @@  discard block
 block discarded – undo
441 441
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
442 442
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
443 443
             <?php
444
-        	if ($globalACARS) {
445
-        	    if (isset($globalDemo) && $globalDemo) {
446
-    	    ?>
444
+			if ($globalACARS) {
445
+				if (isset($globalDemo) && $globalDemo) {
446
+			?>
447 447
             <li><hr /></li>
448 448
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
449 449
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
450 450
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
451 451
             <?php
452
-        	    } else {
453
-    	    ?>
452
+				} else {
453
+			?>
454 454
             <li><hr /></li>
455 455
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
456 456
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
457 457
             <?php
458
-        	    }
459
-        	}
460
-    	    ?>
458
+				}
459
+			}
460
+			?>
461 461
     	    <?php
462
-    	        if (isset($globalAccidents) && $globalAccidents) {
463
-    	    ?>
462
+				if (isset($globalAccidents) && $globalAccidents) {
463
+			?>
464 464
             <li><hr /></li>
465 465
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
466 466
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
467 467
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
468 468
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
469 469
             <?php
470
-        	}
471
-    	    ?>
470
+			}
471
+			?>
472 472
             <li><hr /></li>
473 473
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
474 474
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
@@ -491,14 +491,14 @@  discard block
 block discarded – undo
491 491
     </ul>
492 492
 <?php
493 493
 	}
494
-    }
494
+	}
495 495
 ?>
496 496
 <?php
497
-    if (isset($globalMarine) && $globalMarine) {
497
+	if (isset($globalMarine) && $globalMarine) {
498 498
 ?>
499 499
     <li class="dropdown">
500 500
 <?php
501
-        if ($sub) {
501
+		if ($sub) {
502 502
 ?>
503 503
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a>
504 504
 	<ul class="dropdown-menu multi-level">
@@ -523,14 +523,14 @@  discard block
 block discarded – undo
523 523
 	}
524 524
 ?>
525 525
 <?php
526
-    }
526
+	}
527 527
 ?>
528 528
 <?php
529
-    if (isset($globalTracker) && $globalTracker) {
529
+	if (isset($globalTracker) && $globalTracker) {
530 530
 ?>
531 531
     <li class="dropdown">
532 532
 <?php
533
-        if ($sub) {
533
+		if ($sub) {
534 534
 ?>
535 535
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
536 536
 	<ul class="dropdown-menu multi-level">
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	}
556 556
 ?>
557 557
 <?php
558
-    }
558
+	}
559 559
 ?>
560 560
 
561 561
         <li class="dropdown">
@@ -564,12 +564,12 @@  discard block
 block discarded – undo
564 564
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
565 565
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
566 566
 <?php
567
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
567
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
568 568
 ?>
569 569
 		<li><hr /></li>
570 570
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
571 571
 <?php
572
-    }
572
+	}
573 573
 ?>
574 574
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
575 575
                 <li><hr /></li>
@@ -590,14 +590,14 @@  discard block
 block discarded – undo
590 590
   	    <form>
591 591
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
592 592
   		    <?php
593
-  		        $Language = new Language();
594
-  		        $alllang = $Language->getLanguages();
595
-  		        foreach ($alllang as $key => $lang) {
596
-  		            print '<option value="'.$key.'"';
597
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
598
-  		            print '>'.$lang[0].'</option>';
599
-  		        }
600
-  		    ?>
593
+  				$Language = new Language();
594
+  				$alllang = $Language->getLanguages();
595
+  				foreach ($alllang as $key => $lang) {
596
+  					print '<option value="'.$key.'"';
597
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
598
+  					print '>'.$lang[0].'</option>';
599
+  				}
600
+  			?>
601 601
   		</select>
602 602
   	    </form>
603 603
   	</div>
@@ -628,18 +628,18 @@  discard block
 block discarded – undo
628 628
 ?>
629 629
     <div class="top-header clear" role="main">
630 630
 <?php
631
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
631
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
632 632
 ?>
633 633
     <div id="archive-map"></div>
634 634
 <?php
635
-    }
635
+	}
636 636
 ?>
637 637
     </div>
638 638
 <?php
639 639
 }
640 640
 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))
641 641
 {
642
-    ?>
642
+	?>
643 643
     <div class="top-header clear" role="main">
644 644
         <div id="map"></div>
645 645
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -650,15 +650,15 @@  discard block
 block discarded – undo
650 650
         var zoom = 13;
651 651
 //create the map
652 652
 <?php
653
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
653
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
654 654
 ?>
655 655
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
656 656
 <?php
657
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
657
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
658 658
 ?>
659 659
   map = L.map('map', { zoomControl:true });
660 660
 <?php
661
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
661
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
662 662
 ?>
663 663
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
664 664
     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);
@@ -666,22 +666,22 @@  discard block
 block discarded – undo
666 666
     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);
667 667
     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);
668 668
 <?php
669
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
669
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
670 670
 ?>
671 671
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
672 672
 <?php
673
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
673
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
674 674
 ?>
675 675
   map = L.map('map', { zoomControl:true });
676 676
 <?php
677
-    }
677
+	}
678 678
 ?>
679 679
   //initialize the layer group for the aircrft markers
680 680
   var layer_data = L.layerGroup();
681 681
 
682 682
   //a few title layers
683 683
 <?php
684
-    if ($globalMapProvider == 'Mapbox') {
684
+	if ($globalMapProvider == 'Mapbox') {
685 685
 ?>
686 686
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
687 687
     maxZoom: 18,
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
     token : '<?php print $globalMapboxToken; ?>'
693 693
   }).addTo(map);
694 694
 <?php
695
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
695
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
696 696
 ?>
697 697
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
698 698
     maxZoom: 18,
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
702 702
   }).addTo(map);
703 703
 <?php
704
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
704
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
705 705
 ?>
706 706
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
707 707
     maxZoom: 18,
@@ -710,27 +710,27 @@  discard block
 block discarded – undo
710 710
       '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"'
711 711
   }).addTo(map);
712 712
 <?php
713
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
713
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
714 714
 ?>
715 715
     var googleLayer = new L.Google('ROADMAP');
716 716
     map.addLayer(googleLayer);
717 717
 <?php
718
-    } elseif ($globalMapProvider == 'Google-Satellite') {
718
+	} elseif ($globalMapProvider == 'Google-Satellite') {
719 719
 ?>
720 720
     var googleLayer = new L.Google('SATELLITE');
721 721
     map.addLayer(googleLayer);
722 722
 <?php
723
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
723
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
724 724
 ?>
725 725
     var googleLayer = new L.Google('HYBRID');
726 726
     map.addLayer(googleLayer);
727 727
 <?php
728
-    } elseif ($globalMapProvider == 'Google-Terrain') {
728
+	} elseif ($globalMapProvider == 'Google-Terrain') {
729 729
 ?>
730 730
     var googleLayer = new L.Google('Terrain');
731 731
     map.addLayer(googleLayer);
732 732
 <?php
733
-    } elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
733
+	} elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
734 734
 	$customid = $globalMapProvider;
735 735
 ?>
736 736
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
@@ -740,8 +740,8 @@  discard block
 block discarded – undo
740 740
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
741 741
     }).addTo(map);
742 742
 <?php
743
-    //} elseif ($globalMapProvider == 'OpenStreetMap') {
744
-    } else {
743
+	//} elseif ($globalMapProvider == 'OpenStreetMap') {
744
+	} else {
745 745
 ?>
746 746
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
747 747
     maxZoom: 18,
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
   }).addTo(map);
751 751
 
752 752
 <?php
753
-    }
753
+	}
754 754
 ?>
755 755
         </script>
756 756
     </div>
Please login to merge, or discard this patch.
statistics.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -79,24 +79,24 @@  discard block
 block discarded – undo
79 79
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
80 80
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
81 81
 	<?php
82
-	    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
82
+		if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
83 83
  	?>
84 84
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
85 85
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
86 86
         <?php
87
-    	    }
88
-	    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
89
-    	?>
87
+			}
88
+		if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
89
+		?>
90 90
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
91 91
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
92 92
     	<?php
93
-    	    }
94
-    	?>
93
+			}
94
+		?>
95 95
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
96 96
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
97 97
         <?php
98
-    		if ($airline_icao == '') {
99
-    	?>
98
+			if ($airline_icao == '') {
99
+		?>
100 100
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
101 101
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
102 102
 	<?php
@@ -139,39 +139,39 @@  discard block
 block discarded – undo
139 139
             <div class="col-md-6">
140 140
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
141 141
                  <?php
142
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
143
-		    if (count($aircraft_array) == 0) print _("No data available");
144
-		    else {
145
-                    print '<div id="chart1" class="chart" width="100%"></div><script>';
146
-                    $aircraft_data = '';
147
-                    foreach($aircraft_array as $aircraft_item)
148
-                    {
149
-                        if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
150
-                        else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
151
-                    }
152
-                    $aircraft_data = substr($aircraft_data, 0, -1);
153
-		    print 'var series = ['.$aircraft_data.'];';
154
-		    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
155
-		    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
156
-		    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
157
-                    print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
158
-                    print 'dataset';
159
-                    print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
160
-                    print '</script>';
161
-                  }
162
-                  ?>
142
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
143
+			if (count($aircraft_array) == 0) print _("No data available");
144
+			else {
145
+					print '<div id="chart1" class="chart" width="100%"></div><script>';
146
+					$aircraft_data = '';
147
+					foreach($aircraft_array as $aircraft_item)
148
+					{
149
+						if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
150
+						else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
151
+					}
152
+					$aircraft_data = substr($aircraft_data, 0, -1);
153
+			print 'var series = ['.$aircraft_data.'];';
154
+			print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
155
+			print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
156
+			print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
157
+					print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
158
+					print 'dataset';
159
+					print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
160
+					print '</script>';
161
+				  }
162
+				  ?>
163 163
                 <div class="more">
164 164
             	    <?php
165
-            		if ($year != '' && $month != '') {
166
-            	    ?>
165
+					if ($year != '' && $month != '') {
166
+					?>
167 167
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
168 168
             	    <?php
169
-            		} else {
170
-            	    ?>
169
+					} else {
170
+					?>
171 171
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
172 172
             	    <?php
173
-            		}
174
-            	    ?>
173
+					}
174
+					?>
175 175
                 </div>
176 176
             </div>
177 177
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -224,29 +224,29 @@  discard block
 block discarded – undo
224 224
             <div class="col-md-6">
225 225
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
226 226
                  <?php
227
-                    $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month);
228
-		    if (count($marine_array) == 0) print _("No data available");
229
-		    else {
230
-                    print '<div id="chart1" class="chart" width="100%"></div><script>';
231
-                    $marine_data = '';
232
-                    foreach($marine_array as $marine_item)
233
-                    {
234
-                        $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
235
-                    }
236
-                    $marine_data = substr($marine_data, 0, -1);
237
-		    print 'var series = ['.$marine_data.'];';
238
-		    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
239
-		    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
240
-		    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
241
-                    print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
242
-                    print 'dataset';
243
-                    print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
244
-                    print '</script>';
245
-                  }
246
-                  ?>
227
+					$marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month);
228
+			if (count($marine_array) == 0) print _("No data available");
229
+			else {
230
+					print '<div id="chart1" class="chart" width="100%"></div><script>';
231
+					$marine_data = '';
232
+					foreach($marine_array as $marine_item)
233
+					{
234
+						$marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
235
+					}
236
+					$marine_data = substr($marine_data, 0, -1);
237
+			print 'var series = ['.$marine_data.'];';
238
+			print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
239
+			print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
240
+			print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
241
+					print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
242
+					print 'dataset';
243
+					print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
244
+					print '</script>';
245
+				  }
246
+				  ?>
247 247
                 <div class="more">
248 248
             	    <?php
249
-            	    /*
249
+					/*
250 250
             		if ($year != '' && $month != '') {
251 251
             	    ?>
252 252
             	    <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             	    <?php
258 258
             		}
259 259
             		*/
260
-            	    ?>
260
+					?>
261 261
                 </div>
262 262
             </div>
263 263
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -272,29 +272,29 @@  discard block
 block discarded – undo
272 272
             <div class="col-md-6">
273 273
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
274 274
                  <?php
275
-                  $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
276
-		    if (count($tracker_array) == 0) print _("No data available");
277
-		    else {
278
-                    print '<div id="chart1" class="chart" width="100%"></div><script>';
279
-                    $tracker_data = '';
280
-                    foreach($tracker_array as $tracker_item)
281
-                    {
282
-                        $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
283
-                    }
284
-                    $tracker_data = substr($tracker_data, 0, -1);
285
-		    print 'var series = ['.$tracker_data.'];';
286
-		    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
287
-		    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
288
-		    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
289
-                    print 'var trackertype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
290
-                    print 'dataset';
291
-                    print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
292
-                    print '</script>';
293
-                  }
294
-                  ?>
275
+				  $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
276
+			if (count($tracker_array) == 0) print _("No data available");
277
+			else {
278
+					print '<div id="chart1" class="chart" width="100%"></div><script>';
279
+					$tracker_data = '';
280
+					foreach($tracker_array as $tracker_item)
281
+					{
282
+						$tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
283
+					}
284
+					$tracker_data = substr($tracker_data, 0, -1);
285
+			print 'var series = ['.$tracker_data.'];';
286
+			print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
287
+			print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
288
+			print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
289
+					print 'var trackertype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
290
+					print 'dataset';
291
+					print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
292
+					print '</script>';
293
+				  }
294
+				  ?>
295 295
                 <div class="more">
296 296
             	    <?php
297
-            	    /*
297
+					/*
298 298
             		if ($year != '' && $month != '') {
299 299
             	    ?>
300 300
             	    <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             	    <?php
306 306
             		}
307 307
             		*/
308
-            	    ?>
308
+					?>
309 309
                 </div>
310 310
             </div>
311 311
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 $marine = false;
6 6
 $usecoord = false;
7 7
 if (isset($_GET['tracker'])) {
8
-    $tracker = true;
8
+	$tracker = true;
9 9
 }
10 10
 if (isset($_GET['marine'])) {
11
-    $marine = true;
11
+	$marine = true;
12 12
 }
13 13
 if ($tracker) {
14
-    require_once('require/class.Tracker.php');
15
-    require_once('require/class.TrackerLive.php');
16
-    require_once('require/class.TrackerArchive.php');
14
+	require_once('require/class.Tracker.php');
15
+	require_once('require/class.TrackerLive.php');
16
+	require_once('require/class.TrackerArchive.php');
17 17
 } elseif ($marine) {
18
-    require_once('require/class.Marine.php');
19
-    require_once('require/class.MarineLive.php');
20
-    require_once('require/class.MarineArchive.php');
18
+	require_once('require/class.Marine.php');
19
+	require_once('require/class.MarineLive.php');
20
+	require_once('require/class.MarineArchive.php');
21 21
 } else {
22
-    require_once('require/class.Spotter.php');
23
-    require_once('require/class.SpotterLive.php');
24
-    require_once('require/class.SpotterArchive.php');
22
+	require_once('require/class.Spotter.php');
23
+	require_once('require/class.SpotterLive.php');
24
+	require_once('require/class.SpotterArchive.php');
25 25
 }
26 26
 
27 27
 $begintime = microtime(true);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $Common = new Common();
42 42
 
43 43
 if (isset($_GET['download'])) {
44
-    if ($_GET['download'] == "true")
45
-    {
44
+	if ($_GET['download'] == "true")
45
+	{
46 46
 	header('Content-disposition: attachment; filename="flightairmap.json"');
47
-    }
47
+	}
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
@@ -498,17 +498,17 @@  discard block
 block discarded – undo
498 498
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
499 499
 				
500 500
 				if (
501
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
502
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
501
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
502
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
503 503
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
504 504
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
505
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
506
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
507
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
508
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
509
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
510
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
511
-				    ) {
505
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
506
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
507
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
508
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
509
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
510
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
511
+					) {
512 512
 					if ($tracker) {
513 513
 						if ($from_archive || $globalArchive) {
514 514
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -597,65 +597,65 @@  discard block
 block discarded – undo
597 597
 				}
598 598
 				
599 599
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
600
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
601
-				     && (isset($spotter_item['departure_airport']) 
602
-				        && $spotter_item['departure_airport'] != 'NA' 
603
-				        && isset($spotter_item['arrival_airport']) 
604
-				        && $spotter_item['arrival_airport'] != 'NA' 
605
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
606
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
607
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
609
-				    if (isset($spotter_item['departure_airport_latitude'])) {
600
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
601
+					 && (isset($spotter_item['departure_airport']) 
602
+						&& $spotter_item['departure_airport'] != 'NA' 
603
+						&& isset($spotter_item['arrival_airport']) 
604
+						&& $spotter_item['arrival_airport'] != 'NA' 
605
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
606
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
607
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
609
+					if (isset($spotter_item['departure_airport_latitude'])) {
610 610
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
611
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
611
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
612 612
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
613 613
 					if (isset($dairport[0]['latitude'])) {
614
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
614
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
615 615
 					}
616
-				    }
617
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
616
+					}
617
+					if (isset($spotter_item['arrival_airport_latitude'])) {
618 618
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
619
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
619
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
620 620
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
621 621
 					if (isset($aairport[0]['latitude'])) {
622
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
622
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
623 623
 					}
624
-				    }
625
-				    $output_air  = substr($output_air, 0, -1);
626
-				    $output_air .= ']}},';
627
-				    $output .= $output_air;
628
-				    unset($output_air);
624
+					}
625
+					$output_air  = substr($output_air, 0, -1);
626
+					$output_air .= ']}},';
627
+					$output .= $output_air;
628
+					unset($output_air);
629 629
 				}
630 630
 
631 631
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
632 632
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
633 633
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
634
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635
-				     && (isset($spotter_item['arrival_airport']) 
636
-				        && $spotter_item['arrival_airport'] != 'NA' 
637
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
638
-				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
639
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
640
-				    $havedata = false;
641
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
643
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
634
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635
+					 && (isset($spotter_item['arrival_airport']) 
636
+						&& $spotter_item['arrival_airport'] != 'NA' 
637
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
638
+							|| (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
639
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
640
+					$havedata = false;
641
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
643
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
644 644
 
645
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
645
+					if (isset($spotter_item['arrival_airport_latitude'])) {
646 646
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
647 647
 					$havedata = true;
648
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
648
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
649 649
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
650 650
 					if (isset($aairport[0]['latitude'])) {
651
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
652
-					    $havedata = true;
651
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
652
+						$havedata = true;
653 653
 					}
654
-				    }
655
-				    //$output_dest  = substr($output_dest, 0, -1);
656
-				    $output_dest .= ']}},';
657
-				    if ($havedata) $output .= $output_dest;
658
-				    unset($output_dest);
654
+					}
655
+					//$output_dest  = substr($output_dest, 0, -1);
656
+					$output_dest .= ']}},';
657
+					if ($havedata) $output .= $output_dest;
658
+					unset($output_dest);
659 659
 				}
660 660
 			}
661 661
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.