Completed
Push — master ( c396ef...4342b6 )
by Yannick
34:34
created
require/class.Elevation.php 3 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -53,6 +53,11 @@  discard block
 block discarded – undo
53 53
 		$this->openedFiles = [];
54 54
 	}
55 55
 
56
+	/**
57
+	 * @param string $fileName
58
+	 * @param double $row
59
+	 * @param double $column
60
+	 */
56 61
 	private function getElevationAtPosition($fileName, $row, $column) {
57 62
 		if (!array_key_exists($fileName, $this->openedFiles)) {
58 63
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
@@ -153,6 +158,9 @@  discard block
 block discarded – undo
153 158
 		else return $zN;
154 159
 	}
155 160
 
161
+	/**
162
+	 * @param integer $numPrefix
163
+	 */
156 164
 	private function getDeg($deg, $numPrefix) {
157 165
 		$deg = abs($deg);
158 166
 		$d   = floor($deg);     // round degrees
@@ -167,6 +175,9 @@  discard block
 block discarded – undo
167 175
 		return $d;
168 176
 	}
169 177
 
178
+	/**
179
+	 * @param double $deg
180
+	 */
170 181
 	private function getSec($deg) {
171 182
 		$deg = abs($deg);
172 183
 		$sec = round($deg * 3600, 4);
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			default:
42 42
 				throw new \Exception("bad resolution can be only one of 1,3");
43 43
 		}
44
-		register_shutdown_function(function () {
44
+		register_shutdown_function(function() {
45 45
 			$this->closeAllFiles();
46 46
 		});
47 47
 	}
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 
56 56
 	private function getElevationAtPosition($fileName, $row, $column) {
57 57
 		if (!array_key_exists($fileName, $this->openedFiles)) {
58
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
58
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
59 59
 				throw new \Exception("File '{$fileName}' not exists.");
60 60
 			}
61
-			$file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r");
61
+			$file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r");
62 62
 			if ($file === false) {
63 63
 				throw new \Exception("Cant open file '{$fileName}' for reading.");
64 64
 			}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			throw new \Exception("Not implemented yet");
73 73
 		}
74 74
 		$aRow     = $this->measPerDeg - $row;
75
-		$position = ($this->measPerDeg * ($aRow - 1)) + $column;
75
+		$position = ($this->measPerDeg*($aRow - 1)) + $column;
76 76
 		$position *= 2;
77 77
 		fseek($file, $position);
78 78
 		$short  = fread($file, 2);
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 		$latSec = $this->getSec($lat);
111 111
 		$lonSec = $this->getSec($lon);
112 112
 
113
-		$Xn = round($latSec / $this->resolution, 3);
114
-		$Yn = round($lonSec / $this->resolution, 3);
113
+		$Xn = round($latSec/$this->resolution, 3);
114
+		$Yn = round($lonSec/$this->resolution, 3);
115 115
 
116 116
 		$a1 = round($Xn);
117 117
 		$a2 = round($Yn);
@@ -143,39 +143,39 @@  discard block
 block discarded – undo
143 143
 		$b3 = $this->getElevationAtPosition($fName, $b1, $b2);
144 144
 		$c3 = $this->getElevationAtPosition($fName, $c1, $c2);
145 145
 
146
-		$n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2);
147
-		$n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3);
148
-		$n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1);
146
+		$n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2);
147
+		$n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3);
148
+		$n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1);
149 149
 
150
-		$d  = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3;
151
-		$zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3;
150
+		$d  = -$n1*$a1 - $n2*$a2 - $n3*$a3;
151
+		$zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3;
152 152
 		if ($zN > 10000) return 0;
153 153
 		else return $zN;
154 154
 	}
155 155
 
156 156
 	private function getDeg($deg, $numPrefix) {
157 157
 		$deg = abs($deg);
158
-		$d   = floor($deg);     // round degrees
158
+		$d   = floor($deg); // round degrees
159 159
 		if ($numPrefix >= 3) {
160 160
 			if ($d < 100) {
161
-				$d = '0' . $d;
161
+				$d = '0'.$d;
162 162
 			}
163 163
 		} // pad with leading zeros
164 164
 		if ($d < 10) {
165
-			$d = '0' . $d;
165
+			$d = '0'.$d;
166 166
 		}
167 167
 		return $d;
168 168
 	}
169 169
 
170 170
 	private function getSec($deg) {
171 171
 		$deg = abs($deg);
172
-		$sec = round($deg * 3600, 4);
173
-		$m   = fmod(floor($sec / 60), 60);
172
+		$sec = round($deg*3600, 4);
173
+		$m   = fmod(floor($sec/60), 60);
174 174
 		$s   = round(fmod($sec, 60), 4);
175
-		return ($m * 60) + $s;
175
+		return ($m*60) + $s;
176 176
 	}
177 177
 
178
-	public function download($lat,$lon, $debug = false) {
178
+	public function download($lat, $lon, $debug = false) {
179 179
 		if ($lat < 0) {
180 180
 			$latd = 'S'.$this->getDeg($lat, 2);
181 181
 		} else {
@@ -186,20 +186,20 @@  discard block
 block discarded – undo
186 186
 		} else {
187 187
 			$lond = 'W'.$this->getDeg($lon, 3);
188 188
 		}
189
-		$fileName  = $latd.$lond.".hgt";
190
-		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
189
+		$fileName = $latd.$lond.".hgt";
190
+		if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
191 191
 			$Common = new Common();
192 192
 			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
193
-			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/'.$latd.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
194
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
193
+			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/'.$latd.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
194
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) {
195 195
 				if ($debug) echo "File '{$fileName}.gz' not exists.";
196 196
 				return false;
197 197
 			}
198 198
 			if ($debug) echo 'Done'."\n";
199 199
 			if ($debug) echo 'Decompress '.$fileName.' ....';
200
-			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
200
+			$Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName);
201 201
 			if ($debug) echo 'Done'."\n";
202
-			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
202
+			unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
203 203
 		}
204 204
 		return true;
205 205
 	}
@@ -212,22 +212,22 @@  discard block
 block discarded – undo
212 212
 		try {
213 213
 			$sth = $db->prepare($query);
214 214
 			$sth->execute($query_values);
215
-		} catch(PDOException $e) {
215
+		} catch (PDOException $e) {
216 216
 			return "error : ".$e->getMessage();
217 217
 		}
218 218
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
219
-			$this->download($data['latitude'],$data['longitude'],true);
219
+			$this->download($data['latitude'], $data['longitude'], true);
220 220
 		}
221 221
 		$query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 10';
222 222
 		$query_values = array();
223 223
 		try {
224 224
 			$sth = $db->prepare($query);
225 225
 			$sth->execute($query_values);
226
-		} catch(PDOException $e) {
226
+		} catch (PDOException $e) {
227 227
 			return "error : ".$e->getMessage();
228 228
 		}
229 229
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
230
-			$this->download($data['latitude'],$data['longitude'],true);
230
+			$this->download($data['latitude'], $data['longitude'], true);
231 231
 		}
232 232
 	}
233 233
 }
Please login to merge, or discard this patch.
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	private $openedFiles = [];
29 29
 
30 30
 	public function __construct($htgFilesDestination = '', $resolution = 3) {
31
-		if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/';
31
+		if ($htgFilesDestination == '') {
32
+			$htgFilesDestination = dirname(__FILE__).'/../data/';
33
+		}
32 34
 		$this->htgFilesDestination = $htgFilesDestination;
33 35
 		$this->resolution          = $resolution;
34 36
 		switch ($resolution) {
@@ -149,8 +151,11 @@  discard block
 block discarded – undo
149 151
 
150 152
 		$d  = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3;
151 153
 		$zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3;
152
-		if ($zN > 10000) return 0;
153
-		else return $zN;
154
+		if ($zN > 10000) {
155
+			return 0;
156
+		} else {
157
+			return $zN;
158
+		}
154 159
 	}
155 160
 
156 161
 	private function getDeg($deg, $numPrefix) {
@@ -189,16 +194,26 @@  discard block
 block discarded – undo
189 194
 		$fileName  = $latd.$lond.".hgt";
190 195
 		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
191 196
 			$Common = new Common();
192
-			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
197
+			if ($debug) {
198
+				echo 'Downloading '.$fileName.'.gz ...';
199
+			}
193 200
 			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/'.$latd.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
194 201
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
195
-				if ($debug) echo "File '{$fileName}.gz' not exists.";
202
+				if ($debug) {
203
+					echo "File '{$fileName}.gz' not exists.";
204
+				}
196 205
 				return false;
197 206
 			}
198
-			if ($debug) echo 'Done'."\n";
199
-			if ($debug) echo 'Decompress '.$fileName.' ....';
207
+			if ($debug) {
208
+				echo 'Done'."\n";
209
+			}
210
+			if ($debug) {
211
+				echo 'Decompress '.$fileName.' ....';
212
+			}
200 213
 			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
201
-			if ($debug) echo 'Done'."\n";
214
+			if ($debug) {
215
+				echo 'Done'."\n";
216
+			}
202 217
 			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
203 218
 		}
204 219
 		return true;
Please login to merge, or discard this patch.
index.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 /*
20 20
 } else {
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 */
24 24
 }
25 25
 
26
-$raceid = filter_input(INPUT_GET,'raceid',FILTER_SANITIZE_NUMBER_INT);
26
+$raceid = filter_input(INPUT_GET, 'raceid', FILTER_SANITIZE_NUMBER_INT);
27 27
 if ($raceid != '') {
28
-	setcookie('filter_race',$raceid);
28
+	setcookie('filter_race', $raceid);
29 29
 }
30 30
 
31 31
 $title = _("Home");
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		    <div class="form-group">
249 249
 			<label><?php echo _("From:"); ?></label>
250 250
 			<div class='input-group date' id='datetimepicker1'>
251
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
251
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i", $_COOKIE['archive_begin']).' UTC'; ?>" required />
252 252
 			    <span class="input-group-addon">
253 253
 				<span class="glyphicon glyphicon-calendar"></span>
254 254
 			    </span>
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		    <div class="form-group">
258 258
 			<label><?php echo _("To:"); ?></label>
259 259
 			<div class='input-group date' id='datetimepicker2'>
260
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
260
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i", $_COOKIE['archive_end']).' UTC'; ?>" />
261 261
 			    <span class="input-group-addon">
262 262
 				<span class="glyphicon glyphicon-calendar"></span>
263 263
 			    </span>
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 		    <li><?php echo _("Type of Terrain:"); ?>
427 427
 			<select  class="selectpicker" onchange="terrainType(this);">
428 428
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
429
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
430
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
431
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
429
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
430
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
431
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option>
432 432
 			</select>
433 433
 		    </li>
434 434
 <?php
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
494 494
 <?php
495 495
     }
496
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
496
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
497 497
 ?>
498 498
 		    <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>
499 499
 <?php
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
 					$Spotter = new Spotter();
675 675
 					$allairlinenames = $Spotter->getAllAirlineNames();
676 676
 				}
677
-				foreach($allairlinenames as $airline) {
677
+				foreach ($allairlinenames as $airline) {
678 678
 					$airline_name = $airline['airline_name'];
679
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
680
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
679
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
680
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
681 681
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
682 682
 					} else {
683 683
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
697 697
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
698 698
 			    <?php
699
-				foreach($allalliancenames as $alliance) {
699
+				foreach ($allalliancenames as $alliance) {
700 700
 					$alliance_name = $alliance['alliance'];
701 701
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
702 702
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
 				*/
733 733
 				$Source = new Source();
734 734
 				$datasource = $Source->getLocationInfoByType('gs');
735
-				foreach($datasource as $src) {
736
-					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) {
735
+				foreach ($datasource as $src) {
736
+					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) {
737 737
 						echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>';
738 738
 					} else {
739 739
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
842 842
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
843 843
 					
844
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
844
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
845 845
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
846 846
 					} else {
847 847
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
56 56
 </tr></table></div>
57 57
 <?php
58
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
58
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60 60
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
61 61
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
82 82
 <?php
83 83
 	}
84
-    }
84
+	}
85 85
 ?>
86 86
 
87 87
 <div id="sidebar" class="sidebar collapsed">
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
93 93
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
94 94
 <?php
95
-    //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
95
+	//if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
96 96
 	if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) {
97 97
 ?>
98 98
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
99 99
 <?php
100 100
 	}
101
-    //}
101
+	//}
102 102
 ?>
103 103
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
104 104
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 ?>
113 113
 
114 114
 <?php
115
-    if (isset($globalMap3D) && $globalMap3D) {
115
+	if (isset($globalMap3D) && $globalMap3D) {
116 116
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
117 117
 ?>
118 118
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
123 123
 <?php
124 124
 	}
125
-    }
125
+	}
126 126
 ?>
127 127
     </ul>
128 128
 
@@ -306,15 +306,15 @@  discard block
 block discarded – undo
306 306
 		    </div>
307 307
 		</li>
308 308
 		<?php
309
-		    if (isset($globalDemo) && $globalDemo) {
309
+			if (isset($globalDemo) && $globalDemo) {
310 310
 		?>
311 311
 		<li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li>
312 312
 		<?php
313
-		    } else {
313
+			} else {
314 314
 		?>
315 315
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
316 316
 		<?php
317
-		    }
317
+			}
318 318
 		?>
319 319
 	    </ul>
320 320
 	    <ul>
@@ -333,82 +333,82 @@  discard block
 block discarded – undo
333 333
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
334 334
 					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
335 335
 					else $MapType = $_COOKIE['MapType'];
336
-			    ?>
336
+				?>
337 337
 			<select  class="selectpicker" onchange="mapType(this);">
338 338
 			    <?php
339 339
 				} else {
340 340
 					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
341 341
 					else $MapType = $_COOKIE['MapType3D'];
342
-			    ?>
342
+				?>
343 343
 			<select  class="selectpicker" onchange="mapType3D(this);">
344 344
 			    <?php
345 345
 				}
346
-			    ?>
346
+				?>
347 347
 			    <?php
348 348
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
349
-			    ?>
349
+				?>
350 350
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
351 351
 			    <?php
352 352
 				} else {
353
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354
-			    ?>
353
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354
+				?>
355 355
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
356 356
 			    <?php
357
-				    }
358
-			    ?>
357
+					}
358
+				?>
359 359
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
360 360
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
361 361
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
362 362
 			    <?php
363
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364
-			    ?>
363
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364
+				?>
365 365
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
366 366
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
367 367
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
368 368
 			    <?php
369
-				    }
370
-			    ?>
369
+					}
370
+				?>
371 371
 			    <?php
372
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
373
-			    ?>
372
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
373
+				?>
374 374
 			    <?php
375 375
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
376
-			    ?>
376
+				?>
377 377
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') print ' selected'; ?>>Here-Aerial</option>
378 378
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') print ' selected'; ?>>Here-Hybrid</option>
379 379
 			    <option value="Here-Road"<?php if ($MapType == 'Here-Road') print ' selected'; ?>>Here-Road</option>
380 380
 			    <?php
381 381
 					}
382
-			    ?>
382
+				?>
383 383
 			    <?php
384 384
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
385
-			    ?>
385
+				?>
386 386
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
387 387
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
388 388
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
389 389
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
390 390
 			    <?php
391 391
 					}
392
-			    ?>
392
+				?>
393 393
 			    <?php
394 394
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
395
-			    ?>
395
+				?>
396 396
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
397 397
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
398 398
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
399 399
 			    <?php
400 400
 					}
401
-			    ?>
401
+				?>
402 402
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
403 403
 			    <?php
404
-				    }
405
-			    ?>
404
+					}
405
+				?>
406 406
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
407 407
 			    <?php
408
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
408
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
409 409
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
410 410
 					else $MapBoxId = $_COOKIE['MapTypeId'];
411
-			    ?>
411
+				?>
412 412
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
413 413
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
414 414
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
424 424
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
425 425
 			    <?php
426
-				    }
427
-			    ?>
426
+					}
427
+				?>
428 428
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
429 429
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
430 430
 			    <?php
431 431
 				}
432
-			    ?>
432
+				?>
433 433
 			</select>
434 434
 		    </li>
435 435
 <?php
436
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
436
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
437 437
 ?>
438 438
 		    <li><?php echo _("Type of Terrain:"); ?>
439 439
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -444,18 +444,18 @@  discard block
 block discarded – undo
444 444
 			</select>
445 445
 		    </li>
446 446
 <?php
447
-    }
447
+	}
448 448
 ?>
449 449
 
450 450
 <?php
451
-    if (isset($globalMap3D) && $globalMap3D) {
451
+	if (isset($globalMap3D) && $globalMap3D) {
452 452
 ?>
453 453
 		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
454 454
 <?php
455
-    }
455
+	}
456 456
 ?>
457 457
 <?php
458
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
458
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
459 459
 ?>
460 460
 		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
461 461
 
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
479 479
 <?php
480 480
 	}
481
-    }
482
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
481
+	}
482
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
483 483
 ?>
484 484
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
485 485
 <?php
486
-    }
486
+	}
487 487
 ?>
488 488
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
489 489
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
@@ -502,88 +502,88 @@  discard block
 block discarded – undo
502 502
 ?>
503 503
 		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
504 504
 <?php
505
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
505
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
506 506
 ?>
507 507
 		    <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>
508 508
 		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
509 509
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
510 510
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
511 511
 <?php
512
-    }
513
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
512
+	}
513
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
514 514
 ?>
515 515
 		    <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>
516 516
 <?php
517
-    }
517
+	}
518 518
 ?>
519 519
 		    <?php
520 520
 			if (function_exists('array_column')) {
521
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522
-		    ?>
521
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522
+			?>
523 523
 		    <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>
524 524
 		    <?php
525
-			    }
525
+				}
526 526
 			} elseif (isset($globalSources)) {
527
-			    $dispolar = false;
528
-			    foreach ($globalSources as $testsource) {
529
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
530
-			    }
531
-			    if ($dispolar) {
532
-		    ?>
527
+				$dispolar = false;
528
+				foreach ($globalSources as $testsource) {
529
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
530
+				}
531
+				if ($dispolar) {
532
+			?>
533 533
 		    <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>
534 534
 		    <?php
535
-			    }
536
-		        }
537
-		    ?>
535
+				}
536
+				}
537
+			?>
538 538
 <?php
539
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
539
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
540 540
 ?>
541 541
 		    <?php
542 542
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
543
-		    ?>
543
+			?>
544 544
 		    <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMap2DAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li>
545 545
 		    <?php
546 546
 			}
547
-		    ?>
547
+			?>
548 548
 		    <?php
549 549
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
550
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
551
-		    ?>
550
+					if (extension_loaded('gd') && function_exists('gd_info')) {
551
+			?>
552 552
 		    <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>
553 553
 		    <?php 
554 554
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
555
-		    ?>
555
+			?>
556 556
 			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
557 557
 		    <?php
558 558
 				}
559
-			    }
560
-		        }
561
-		    ?>
559
+				}
560
+				}
561
+			?>
562 562
 		    <?php
563 563
 			if (isset($globalMarine) && $globalMarine === TRUE) {
564
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
565
-		    ?>
564
+				if (extension_loaded('gd') && function_exists('gd_info')) {
565
+			?>
566 566
 		    <li><?php echo _("Marine icon color:"); ?>
567 567
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
568 568
 		    </li>
569 569
 		    <?php
570
-			    }
571
-		        }
572
-		    ?>
570
+				}
571
+				}
572
+			?>
573 573
 		    <?php
574 574
 			if (isset($globalTracker) && $globalTracker === TRUE) {
575
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
576
-		    ?>
575
+				if (extension_loaded('gd') && function_exists('gd_info')) {
576
+			?>
577 577
 		    <li><?php echo _("Tracker icon color:"); ?>
578 578
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
579 579
 		    </li>
580 580
 		    <?php
581
-			    }
582
-		        }
583
-		    ?>
581
+				}
582
+				}
583
+			?>
584 584
 		    <?php
585 585
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
586
-		    ?>
586
+			?>
587 587
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
588 588
 			<div class="range">
589 589
 			    <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'; ?>">
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 		    </li>
593 593
 		    <?php
594 594
 			}
595
-		    ?>
595
+			?>
596 596
 <?php
597
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
597
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
598 598
 ?>
599 599
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
600 600
 			<div class="range">
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 		    </li>
634 634
 <?php
635 635
 	}
636
-    }
636
+	}
637 637
 ?>
638 638
 		    <li><?php echo _("Distance unit:"); ?>
639 639
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -673,19 +673,19 @@  discard block
 block discarded – undo
673 673
 		    <ul>
674 674
 		    <?php
675 675
 			if (!isset($globalAircraft) || $globalAircraft) {
676
-		    ?>
676
+			?>
677 677
 		    <?php
678 678
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
679
-		    ?>
679
+			?>
680 680
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
681 681
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
682 682
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
683 683
 		    <?php
684 684
 			}
685
-		    ?>
685
+			?>
686 686
 		    <?php
687 687
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
688
-		    ?>
688
+			?>
689 689
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
690 690
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
691 691
 			<?php } ?>
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
696 696
 		    <?php
697 697
 			}
698
-		    ?>
698
+			?>
699 699
 		    <li><?php echo _("Display airlines:"); ?>
700 700
 		    <br/>
701 701
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -715,14 +715,14 @@  discard block
 block discarded – undo
715 715
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
716 716
 					}
717 717
 				}
718
-			    ?>
718
+				?>
719 719
 			</select>
720 720
 		    </li>
721 721
 		    <?php
722 722
 			$Spotter = new Spotter();
723 723
 			$allalliancenames = $Spotter->getAllAllianceNames();
724 724
 			if (!empty($allalliancenames)) {
725
-		    ?>
725
+			?>
726 726
 		    <li><?php echo _("Display alliance:"); ?>
727 727
 		    <br/>
728 728
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -736,18 +736,18 @@  discard block
 block discarded – undo
736 736
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
737 737
 					}
738 738
 				}
739
-			    ?>
739
+				?>
740 740
 			</select>
741 741
 		    </li>
742 742
 		    <?php
743 743
 			}
744
-		    ?>
744
+			?>
745 745
 		    <?php
746 746
 			}
747
-		    ?>
747
+			?>
748 748
 		    <?php
749 749
 			if (isset($globalAPRS) && $globalAPRS) {
750
-		    ?>
750
+			?>
751 751
 		    <li><?php echo _("Display APRS sources name:"); ?>
752 752
 			<select class="selectpicker" multiple onchange="sources(this);">
753 753
 			    <?php
@@ -771,18 +771,18 @@  discard block
 block discarded – undo
771 771
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
772 772
 					}
773 773
 				}
774
-			    ?>
774
+				?>
775 775
 			</select>
776 776
 		    </li>
777 777
 		    <?php
778 778
 			}
779
-		    ?>
779
+			?>
780 780
 		    <?php
781 781
 			if (!isset($globalAircraft) || $globalAircraft) {
782
-		    ?>
782
+			?>
783 783
 		    <?php
784
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
785
-		    ?>
784
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
785
+			?>
786 786
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
787 787
 			<select class="selectpicker" onchange="airlinestype(this);">
788 788
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
 			</select>
793 793
 		    </li>
794 794
 		    <?php
795
-			    }
796
-		    ?>
795
+				}
796
+			?>
797 797
 		    <?php
798 798
 			}
799
-		    ?>
799
+			?>
800 800
 		    <?php
801 801
 			if (isset($globalMarine) && $globalMarine) {
802
-		    ?>
802
+			?>
803 803
 		    <li>
804 804
 			<?php echo _("Display vessels with MMSI:"); ?>
805 805
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 								print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>';
823 823
 							}
824 824
 						}
825
-			    ?>
825
+				?>
826 826
 			</select>
827 827
 		    </li>
828 828
 
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 					}
831 831
 				}
832 832
 			}
833
-		    ?>
833
+			?>
834 834
 		    <li>
835 835
 			<?php echo _("Display with ident:"); ?>
836 836
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	    </form>
844 844
     	</div>
845 845
 <?php
846
-    if (isset($globalSatellite) && $globalSatellite) {
846
+	if (isset($globalSatellite) && $globalSatellite) {
847 847
 ?>
848 848
         <div class="sidebar-pane" id="satellites">
849 849
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -883,14 +883,14 @@  discard block
 block discarded – undo
883 883
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
884 884
 					}
885 885
 				}
886
-			    ?>
886
+				?>
887 887
 			</select>
888 888
 		    </li>
889 889
 		</ul>
890 890
 	    </form>
891 891
 	</div>
892 892
 <?php
893
-    }
893
+	}
894 894
 ?>
895 895
     </div>
896 896
 </div>
Please login to merge, or discard this patch.
Braces   +614 added lines, -153 removed lines patch added patch discarded remove patch
@@ -57,7 +57,10 @@  discard block
 block discarded – undo
57 57
 <?php
58 58
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
60
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
61
+	print '?tsk='.$tsk;
62
+}
63
+?>"></script>
61 64
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
62 65
 <script src="<?php echo $globalURL; ?>/js/map.3d.weather.js"></script>
63 66
 <?php
@@ -137,10 +140,22 @@  discard block
 block discarded – undo
137 140
 			<h1>Weather</h1>
138 141
 			<ul>
139 142
 			
140
-				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') print 'checked'; ?> /><?php echo _("Weather Winds"); ?></label></div></li>
141
-				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') print 'checked'; ?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
142
-				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
143
-				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') print 'checked'; ?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
143
+				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') {
144
+	print 'checked';
145
+}
146
+?> /><?php echo _("Weather Winds"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
151
+				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
155
+				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') {
156
+	print 'checked';
157
+}
158
+?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
144 159
 			
145 160
 <?php
146 161
 		if (isset($globalOpenWeatherMapKey) && $globalOpenWeatherMapKey != '') {
@@ -162,12 +177,18 @@  discard block
 block discarded – undo
162 177
 <?php
163 178
 		if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) {
164 179
 ?>
165
-				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display 3D weather"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) {
181
+	print 'checked';
182
+}
183
+?> ><?php echo _("Display 3D weather"); ?></label></div></li>
166 184
 			<!--	<li><div class="checkbox"><label><input type="checkbox" name="displayrain" value="1" onclick="clickDisplayRain(this)" ><?php echo _("Display rain on 3D map"); ?></label></div></li>-->
167 185
 <?php
168 186
 		}
169 187
 ?>
170
-				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
188
+				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') {
189
+	print 'checked';
190
+}
191
+?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
171 192
 			</ul>
172 193
 <?php
173 194
 	}
@@ -183,13 +204,22 @@  discard block
 block discarded – undo
183 204
 <?php
184 205
 		if (!isset($globalAircraft) || $globalAircraft) {
185 206
 ?>
186
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
187
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
207
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
208
+	print 'checked';
209
+}
210
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
211
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
212
+	print 'checked';
213
+}
214
+?> /><?php echo _("Display airspace"); ?></label></div></li>
188 215
 <?php
189 216
 		}
190 217
 		if (isset($globalMarine) && $globalMarine) {
191 218
 ?>
192
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
219
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
220
+	print 'checked';
221
+}
222
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
193 223
 <?php
194 224
 		}
195 225
 ?>
@@ -204,13 +234,22 @@  discard block
 block discarded – undo
204 234
 <?php
205 235
 		if (!isset($globalAircraft) || $globalAircraft) {
206 236
 ?>
207
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
208
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
237
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
238
+	print 'checked';
239
+}
240
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
241
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
242
+	print 'checked';
243
+}
244
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
209 245
 <?php
210 246
 		}
211 247
 		if (isset($globalMarine) && $globalMarine) {
212 248
 ?>
213
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
249
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
250
+	print 'checked';
251
+}
252
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
214 253
 <?php
215 254
 		}
216 255
 ?>
@@ -225,14 +264,32 @@  discard block
 block discarded – undo
225 264
 		<h1>NOTAM</h1>
226 265
 		<form>
227 266
 			<ul>
228
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
267
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
268
+	print 'checked';
269
+}
270
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
229 271
 				<li><?php echo _("NOTAM scope:"); ?>
230 272
 					<select class="selectpicker" onchange="notamscope(this);">
231
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
232
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
233
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
234
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
235
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
273
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
274
+	print ' selected';
275
+}
276
+?>>All</option>
277
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
278
+	print ' selected';
279
+}
280
+?>>Airport/Enroute warning</option>
281
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
282
+	print ' selected';
283
+}
284
+?>>Airport warning</option>
285
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
286
+	print ' selected';
287
+}
288
+?>>Navigation warning</option>
289
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
290
+	print ' selected';
291
+}
292
+?>>Enroute warning</option>
236 293
 					</select
237 294
 				</li>
238 295
 			</ul>
@@ -260,7 +317,10 @@  discard block
 block discarded – undo
260 317
 		    <div class="form-group">
261 318
 			<label><?php echo _("From:"); ?></label>
262 319
 			<div class='input-group date' id='datetimepicker1'>
263
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
320
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
321
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
322
+}
323
+?>" required />
264 324
 			    <span class="input-group-addon">
265 325
 				<span class="glyphicon glyphicon-calendar"></span>
266 326
 			    </span>
@@ -269,7 +329,10 @@  discard block
 block discarded – undo
269 329
 		    <div class="form-group">
270 330
 			<label><?php echo _("To:"); ?></label>
271 331
 			<div class='input-group date' id='datetimepicker2'>
272
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
332
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
333
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
334
+}
335
+?>" />
273 336
 			    <span class="input-group-addon">
274 337
 				<span class="glyphicon glyphicon-calendar"></span>
275 338
 			    </span>
@@ -301,8 +364,20 @@  discard block
 block discarded – undo
301 364
 		    </script>
302 365
 		<li><?php echo _("Playback speed:"); ?>
303 366
 		    <div class="range">
304
-			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
305
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
367
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
368
+	print $_POST['archivespeed'];
369
+} elseif (isset($_COOKIE['archive_speed'])) {
370
+	print $_COOKIE['archive_speed'];
371
+} else {
372
+	print '1';
373
+}
374
+?>">
375
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
376
+	print $_COOKIE['archive_speed'];
377
+} else {
378
+	print '1';
379
+}
380
+?></output>
306 381
 		    </div>
307 382
 		</li>
308 383
 		<?php
@@ -331,14 +406,20 @@  discard block
 block discarded – undo
331 406
 		    <li><?php echo _("Type of Map:"); ?>
332 407
 			    <?php
333 408
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
334
-					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
335
-					else $MapType = $_COOKIE['MapType'];
409
+					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
410
+						$MapType = $globalMapProvider;
411
+					} else {
412
+						$MapType = $_COOKIE['MapType'];
413
+					}
336 414
 			    ?>
337 415
 			<select  class="selectpicker" onchange="mapType(this);">
338 416
 			    <?php
339 417
 				} else {
340
-					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
341
-					else $MapType = $_COOKIE['MapType3D'];
418
+					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') {
419
+						$MapType = $globalMapProvider;
420
+					} else {
421
+						$MapType = $_COOKIE['MapType3D'];
422
+					}
342 423
 			    ?>
343 424
 			<select  class="selectpicker" onchange="mapType3D(this);">
344 425
 			    <?php
@@ -347,24 +428,48 @@  discard block
 block discarded – undo
347 428
 			    <?php
348 429
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
349 430
 			    ?>
350
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
431
+			    <option value="offline"<?php if ($MapType == 'offline') {
432
+	print ' selected';
433
+}
434
+?>>Natural Earth (local)</option>
351 435
 			    <?php
352 436
 				} else {
353 437
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354 438
 			    ?>
355
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
439
+			    <option value="offline"<?php if ($MapType == 'offline') {
440
+	print ' selected';
441
+}
442
+?>>Natural Earth (local)</option>
356 443
 			    <?php
357 444
 				    }
358 445
 			    ?>
359
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
360
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
361
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
446
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
447
+	print ' selected';
448
+}
449
+?>>ArcGIS Streetmap</option>
450
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
451
+	print ' selected';
452
+}
453
+?>>ArcGIS Satellite</option>
454
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') {
455
+	print ' selected';
456
+}
457
+?>>ArcGIS Ocean</option>
362 458
 			    <?php
363 459
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364 460
 			    ?>
365
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
366
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
367
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
461
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
462
+	print ' selected';
463
+}
464
+?>>Bing-Aerial</option>
465
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
466
+	print ' selected';
467
+}
468
+?>>Bing-Hybrid</option>
469
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
470
+	print ' selected';
471
+}
472
+?>>Bing-Road</option>
368 473
 			    <?php
369 474
 				    }
370 475
 			    ?>
@@ -374,59 +479,143 @@  discard block
 block discarded – undo
374 479
 			    <?php
375 480
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
376 481
 			    ?>
377
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') print ' selected'; ?>>Here-Aerial</option>
378
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') print ' selected'; ?>>Here-Hybrid</option>
379
-			    <option value="Here-Road"<?php if ($MapType == 'Here-Road') print ' selected'; ?>>Here-Road</option>
482
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') {
483
+	print ' selected';
484
+}
485
+?>>Here-Aerial</option>
486
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') {
487
+	print ' selected';
488
+}
489
+?>>Here-Hybrid</option>
490
+			    <option value="Here-Road"<?php if ($MapType == 'Here-Road') {
491
+	print ' selected';
492
+}
493
+?>>Here-Road</option>
380 494
 			    <?php
381 495
 					}
382 496
 			    ?>
383 497
 			    <?php
384 498
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
385 499
 			    ?>
386
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
387
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
388
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
389
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
500
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
501
+	print ' selected';
502
+}
503
+?>>Google Roadmap</option>
504
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
505
+	print ' selected';
506
+}
507
+?>>Google Satellite</option>
508
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
509
+	print ' selected';
510
+}
511
+?>>Google Hybrid</option>
512
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
513
+	print ' selected';
514
+}
515
+?>>Google Terrain</option>
390 516
 			    <?php
391 517
 					}
392 518
 			    ?>
393 519
 			    <?php
394 520
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
395 521
 			    ?>
396
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
397
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
398
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
522
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
523
+	print ' selected';
524
+}
525
+?>>MapQuest-OSM</option>
526
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
527
+	print ' selected';
528
+}
529
+?>>MapQuest-Aerial</option>
530
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
531
+	print ' selected';
532
+}
533
+?>>MapQuest-Hybrid</option>
399 534
 			    <?php
400 535
 					}
401 536
 			    ?>
402
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
537
+			    <option value="offline"<?php if ($MapType == 'offline') {
538
+	print ' selected';
539
+}
540
+?>>Natural Earth</option>
403 541
 			    <?php
404 542
 				    }
405 543
 			    ?>
406
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
544
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
545
+	print ' selected';
546
+}
547
+?>>National Geographic Street</option>
407 548
 			    <?php
408 549
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
409
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
410
-					else $MapBoxId = $_COOKIE['MapTypeId'];
550
+					if (!isset($_COOKIE['MapTypeId'])) {
551
+						$MapBoxId = 'default';
552
+					} else {
553
+						$MapBoxId = $_COOKIE['MapTypeId'];
554
+					}
411 555
 			    ?>
412
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
413
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
414
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
415
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
416
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
417
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
418
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
419
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
420
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
421
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
422
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
423
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
424
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
556
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
557
+	print ' selected';
558
+}
559
+?>>Mapbox GL</option>
560
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
561
+	print ' selected';
562
+}
563
+?>>Mapbox default</option>
564
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
565
+	print ' selected';
566
+}
567
+?>>Mapbox streets</option>
568
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
569
+	print ' selected';
570
+}
571
+?>>Mapbox light</option>
572
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
573
+	print ' selected';
574
+}
575
+?>>Mapbox dark</option>
576
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
577
+	print ' selected';
578
+}
579
+?>>Mapbox satellite</option>
580
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
581
+	print ' selected';
582
+}
583
+?>>Mapbox streets-satellite</option>
584
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
585
+	print ' selected';
586
+}
587
+?>>Mapbox streets-basic</option>
588
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
589
+	print ' selected';
590
+}
591
+?>>Mapbox comic</option>
592
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
593
+	print ' selected';
594
+}
595
+?>>Mapbox outdoors</option>
596
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
597
+	print ' selected';
598
+}
599
+?>>Mapbox pencil</option>
600
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
601
+	print ' selected';
602
+}
603
+?>>Mapbox pirates</option>
604
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
605
+	print ' selected';
606
+}
607
+?>>Mapbox emerald</option>
425 608
 			    <?php
426 609
 				    }
427 610
 			    ?>
428
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
429
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
611
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
612
+	print ' selected';
613
+}
614
+?>>OpenStreetMap</option>
615
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
616
+	print ' selected';
617
+}
618
+?>>Yandex</option>
430 619
 			    <?php
431 620
 				}
432 621
 			    ?>
@@ -437,10 +626,22 @@  discard block
 block discarded – undo
437 626
 ?>
438 627
 		    <li><?php echo _("Type of Terrain:"); ?>
439 628
 			<select  class="selectpicker" onchange="terrainType(this);">
440
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
441
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
442
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
443
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
629
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
630
+	print ' selected';
631
+}
632
+?>>stk terrain</option>
633
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
634
+	print ' selected';
635
+}
636
+?>>ellipsoid</option>
637
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
638
+	print ' selected';
639
+}
640
+?>>vr terrain</option>
641
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
642
+	print ' selected';
643
+}
644
+?>>ArticDEM</option>
444 645
 			</select>
445 646
 		    </li>
446 647
 <?php
@@ -450,64 +651,124 @@  discard block
 block discarded – undo
450 651
 <?php
451 652
     if (isset($globalMap3D) && $globalMap3D) {
452 653
 ?>
453
-		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
654
+		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') {
655
+	print 'checked';
656
+}
657
+?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
454 658
 <?php
455 659
     }
456 660
 ?>
457 661
 <?php
458 662
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
459 663
 ?>
460
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
664
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
665
+	print 'checked';
666
+}
667
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
461 668
 
462 669
 <?php
463 670
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
464 671
 ?>
465
-		    <!--<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>-->
466
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
467
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
468
-		    <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>
469
-		    <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>
672
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
673
+	print 'checked';
674
+}
675
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
676
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
677
+	print 'checked';
678
+}
679
+?> ><?php echo _("Display flight path"); ?></label></div></li>
680
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) {
681
+	print 'checked';
682
+}
683
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
684
+		    <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)) {
685
+	print 'checked';
686
+}
687
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
688
+		    <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)) {
689
+	print 'checked';
690
+}
691
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
470 692
 <?php
471 693
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
472 694
 ?>
473
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
695
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
696
+	print 'checked';
697
+}
698
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
474 699
 <?php
475 700
 	}
476 701
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
477 702
 ?>
478
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
703
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
704
+	print 'checked';
705
+}
706
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
479 707
 <?php
480 708
 	}
481 709
     }
482 710
     if (!isset($globalAircraft) || $globalAircraft === TRUE) {
483 711
 ?>
484
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
712
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
713
+	print 'checked';
714
+}
715
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
485 716
 <?php
486 717
     }
487 718
 ?>
488
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
489
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
490
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
719
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
720
+	print 'checked';
721
+}
722
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
723
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
724
+	print 'checked';
725
+}
726
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
727
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
728
+	print 'checked';
729
+}
730
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
491 731
 <?php
492 732
 	if (isset($globalFires) && $globalFires) {
493 733
 ?>
494
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
734
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
735
+	print 'checked';
736
+}
737
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
495 738
 <?php
496 739
 	}
497 740
 	if (isset($globalMap3D) && $globalMap3D) {
498 741
 ?>
499
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
742
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) {
743
+	print 'checked';
744
+}
745
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
500 746
 <?php
501 747
 	}
502 748
 ?>
503
-		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
749
+		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) {
750
+	print 'checked';
751
+}
752
+?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
504 753
 <?php
505 754
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
506 755
 ?>
507
-		    <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>
508
-		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
509
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
510
-		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
756
+		    <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')) {
757
+	print 'checked';
758
+}
759
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
760
+		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) {
761
+	print 'checked';
762
+}
763
+?> ><?php echo _("Use shadows"); ?></label></div></li>
764
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
765
+	print 'checked';
766
+}
767
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
768
+		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) {
769
+	print 'checked';
770
+}
771
+?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
511 772
 <?php
512 773
     }
513 774
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -520,17 +781,25 @@  discard block
 block discarded – undo
520 781
 			if (function_exists('array_column')) {
521 782
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522 783
 		    ?>
523
-		    <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>
784
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
785
+	print 'checked';
786
+}
787
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
524 788
 		    <?php
525 789
 			    }
526 790
 			} elseif (isset($globalSources)) {
527 791
 			    $dispolar = false;
528 792
 			    foreach ($globalSources as $testsource) {
529
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
793
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
794
+			        	$dispolar = true;
795
+			        }
530 796
 			    }
531 797
 			    if ($dispolar) {
532 798
 		    ?>
533
-		    <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>
799
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
800
+	print 'checked';
801
+}
802
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
534 803
 		    <?php
535 804
 			    }
536 805
 		        }
@@ -541,7 +810,14 @@  discard block
 block discarded – undo
541 810
 		    <?php
542 811
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
543 812
 		    ?>
544
-		    <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMap2DAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li>
813
+		    <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) {
814
+	print $_COOKIE['map_2d_limit'];
815
+} elseif (isset($globalMap2DAircraftsLimit)) {
816
+	print $globalMap2DAircraftsLimit;
817
+} else {
818
+	print 15000;
819
+}
820
+?>" onchange="map2dlimit(this.value);" /></li>
545 821
 		    <?php
546 822
 			}
547 823
 		    ?>
@@ -549,11 +825,21 @@  discard block
 block discarded – undo
549 825
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
550 826
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
551 827
 		    ?>
552
-		    <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>
828
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
829
+	print 'checked';
830
+}
831
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
553 832
 		    <?php 
554 833
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
555 834
 		    ?>
556
-			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
835
+			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
836
+	print $_COOKIE['IconColor'];
837
+} elseif (isset($globalAircraftIconColor)) {
838
+	print $globalAircraftIconColor;
839
+} else {
840
+	print '1a3151';
841
+}
842
+?>"></li>
557 843
 		    <?php
558 844
 				}
559 845
 			    }
@@ -564,7 +850,14 @@  discard block
 block discarded – undo
564 850
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
565 851
 		    ?>
566 852
 		    <li><?php echo _("Marine icon color:"); ?>
567
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
853
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
854
+	print $_COOKIE['MarineIconColor'];
855
+} elseif (isset($globalMarineIconColor)) {
856
+	print $globalMarineIconColor;
857
+} else {
858
+	print '1a3151';
859
+}
860
+?>">
568 861
 		    </li>
569 862
 		    <?php
570 863
 			    }
@@ -575,7 +868,14 @@  discard block
 block discarded – undo
575 868
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
576 869
 		    ?>
577 870
 		    <li><?php echo _("Tracker icon color:"); ?>
578
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
871
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
872
+	print $_COOKIE['TrackerIconColor'];
873
+} elseif (isset($globalTrackerIconColor)) {
874
+	print $globalTrackerIconColor;
875
+} else {
876
+	print '1a3151';
877
+}
878
+?>">
579 879
 		    </li>
580 880
 		    <?php
581 881
 			    }
@@ -586,8 +886,22 @@  discard block
 block discarded – undo
586 886
 		    ?>
587 887
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
588 888
 			<div class="range">
589
-			    <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'; ?>">
590
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
889
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
890
+	print $_COOKIE['AirportZoom'];
891
+} elseif (isset($globalAirportZoom)) {
892
+	print $globalAirportZoom;
893
+} else {
894
+	print '7';
895
+}
896
+?>">
897
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
898
+	print $_COOKIE['AirportZoom'];
899
+} elseif (isset($globalAirportZoom)) {
900
+	print $globalAirportZoom;
901
+} else {
902
+	print '7';
903
+}
904
+?></output>
591 905
 			</div>
592 906
 		    </li>
593 907
 		    <?php
@@ -598,18 +912,48 @@  discard block
 block discarded – undo
598 912
 ?>
599 913
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
600 914
 			<div class="range">
601
-			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>">
602
-			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output>
915
+			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) {
916
+	print $_COOKIE['resolutionScale'];
917
+} else {
918
+	print '1';
919
+}
920
+?>">
921
+			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) {
922
+	print $_COOKIE['resolutionScale'];
923
+} else {
924
+	print '1';
925
+}
926
+?></output>
603 927
 			</div>
604 928
 		    </li>
605 929
 <?php
606 930
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
607 931
 ?>
608
-		    <!-- <li><?php echo _("Max number of flights to display in 3D:"); ?> <input type="number" name="3dlimit" value="<?php if (isset($_COOKIE['map_3d_limit'])) print $_COOKIE['map_3d_limit']; elseif (isset($globalMap3DAircraftsLimit)) print $globalMap3DAircraftsLimit; else print 300; ?>" onchange="map3dlimit(this.value);" /></li> -->
609
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li>
610
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
932
+		    <!-- <li><?php echo _("Max number of flights to display in 3D:"); ?> <input type="number" name="3dlimit" value="<?php if (isset($_COOKIE['map_3d_limit'])) {
933
+	print $_COOKIE['map_3d_limit'];
934
+} elseif (isset($globalMap3DAircraftsLimit)) {
935
+	print $globalMap3DAircraftsLimit;
936
+} else {
937
+	print 300;
938
+}
939
+?>" onchange="map3dlimit(this.value);" /></li> -->
940
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
941
+	print 'checked';
942
+}
943
+?> > <?php echo _("Use airlines liveries"); ?></li>
944
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
945
+	print 'checked';
946
+}
947
+?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
611 948
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
612
-			<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 'ff0000'; ?>">
949
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
950
+	print $_COOKIE['IconColor'];
951
+} elseif (isset($globalAircraftIconColor)) {
952
+	print $globalAircraftIconColor;
953
+} else {
954
+	print 'ff0000';
955
+}
956
+?>">
613 957
 		    </li>
614 958
 <?php
615 959
 	}
@@ -617,9 +961,19 @@  discard block
 block discarded – undo
617 961
 <?php
618 962
 	if (isset($globalMarine) && $globalMarine === TRUE) {
619 963
 ?>
620
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
964
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
965
+	print 'checked';
966
+}
967
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
621 968
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
622
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
969
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
970
+	print $_COOKIE['MarineIconColor'];
971
+} elseif (isset($globalMarineIconColor)) {
972
+	print $globalMarineIconColor;
973
+} else {
974
+	print 'ff0000';
975
+}
976
+?>">
623 977
 		    </li>
624 978
 <?php
625 979
 	}
@@ -627,9 +981,19 @@  discard block
 block discarded – undo
627 981
 <?php
628 982
 	if (isset($globalTracker) && $globalTracker === TRUE) {
629 983
 ?>
630
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
984
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
985
+	print 'checked';
986
+}
987
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
631 988
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
632
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
989
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
990
+	print $_COOKIE['TrackerIconColor'];
991
+} elseif (isset($globalTrackerIconColor)) {
992
+	print $globalTrackerIconColor;
993
+} else {
994
+	print 'ff0000';
995
+}
996
+?>">
633 997
 		    </li>
634 998
 <?php
635 999
 	}
@@ -637,29 +1001,62 @@  discard block
 block discarded – undo
637 1001
 ?>
638 1002
 		    <li><?php echo _("Distance unit:"); ?>
639 1003
 			<select class="selectpicker" onchange="unitdistance(this);">
640
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
641
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
642
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
1004
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
1005
+	echo ' selected';
1006
+}
1007
+?>>km</option>
1008
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1009
+	echo ' selected';
1010
+}
1011
+?>>nm</option>
1012
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
1013
+	echo ' selected';
1014
+}
1015
+?>>mi</option>
643 1016
 		        </select>
644 1017
 		    </li>
645 1018
 		    <li><?php echo _("Altitude unit:"); ?>
646 1019
 			<select class="selectpicker" onchange="unitaltitude(this);">
647
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
648
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
1020
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
1021
+	echo ' selected';
1022
+}
1023
+?>>m</option>
1024
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
1025
+	echo ' selected';
1026
+}
1027
+?>>feet</option>
649 1028
 		        </select>
650 1029
 		    </li>
651 1030
 		    <li><?php echo _("Speed unit:"); ?>
652 1031
 			<select class="selectpicker" onchange="unitspeed(this);">
653
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
654
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
655
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
1032
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
1033
+	echo ' selected';
1034
+}
1035
+?>>km/h</option>
1036
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
1037
+	echo ' selected';
1038
+}
1039
+?>>mph</option>
1040
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
1041
+	echo ' selected';
1042
+}
1043
+?>>knots</option>
656 1044
 		        </select>
657 1045
 		    </li>
658 1046
 		    <li><?php echo _("Coordinate unit:"); ?>
659 1047
 			<select class="selectpicker" onchange="unitcoordinate(this);">
660
-			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) echo ' selected'; ?>>DD</option>
661
-			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) echo ' selected'; ?>>DMS</option>
662
-			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) echo ' selected'; ?>>DM</option>
1048
+			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) {
1049
+	echo ' selected';
1050
+}
1051
+?>>DD</option>
1052
+			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) {
1053
+	echo ' selected';
1054
+}
1055
+?>>DMS</option>
1056
+			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) {
1057
+	echo ' selected';
1058
+}
1059
+?>>DM</option>
663 1060
 		        </select>
664 1061
 		    </li>
665 1062
 
@@ -677,9 +1074,18 @@  discard block
 block discarded – undo
677 1074
 		    <?php
678 1075
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
679 1076
 		    ?>
680
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
681
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
682
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
1077
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) {
1078
+	print 'checked';
1079
+}
1080
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
1081
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) {
1082
+	print 'checked';
1083
+}
1084
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
1085
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) {
1086
+	print 'checked';
1087
+}
1088
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
683 1089
 		    <?php
684 1090
 			}
685 1091
 		    ?>
@@ -687,12 +1093,21 @@  discard block
 block discarded – undo
687 1093
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
688 1094
 		    ?>
689 1095
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
690
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
1096
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) {
1097
+	print 'checked';
1098
+}
1099
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
691 1100
 			<?php } ?>
692 1101
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
693
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
1102
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) {
1103
+	print 'checked';
1104
+}
1105
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
694 1106
 			<?php } ?>
695
-			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
1107
+			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
1108
+	print 'checked';
1109
+}
1110
+?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
696 1111
 		    <?php
697 1112
 			}
698 1113
 		    ?>
@@ -708,7 +1123,9 @@  discard block
 block discarded – undo
708 1123
 				}
709 1124
 				foreach($allairlinenames as $airline) {
710 1125
 					$airline_name = $airline['airline_name'];
711
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
1126
+					if (strlen($airline_name) > 30) {
1127
+						$airline_name = substr($airline_name,0,30).'...';
1128
+					}
712 1129
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
713 1130
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
714 1131
 					} else {
@@ -726,7 +1143,10 @@  discard block
 block discarded – undo
726 1143
 		    <li><?php echo _("Display alliance:"); ?>
727 1144
 		    <br/>
728 1145
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
729
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
1146
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
1147
+	echo ' selected';
1148
+}
1149
+?>><?php echo _("All"); ?></option>
730 1150
 			    <?php
731 1151
 				foreach($allalliancenames as $alliance) {
732 1152
 					$alliance_name = $alliance['alliance'];
@@ -785,10 +1205,22 @@  discard block
 block discarded – undo
785 1205
 		    ?>
786 1206
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
787 1207
 			<select class="selectpicker" onchange="airlinestype(this);">
788
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
789
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
790
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
791
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1208
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1209
+	echo ' selected';
1210
+}
1211
+?>><?php echo _("All"); ?></option>
1212
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1213
+	echo ' selected';
1214
+}
1215
+?>><?php echo _("Passenger"); ?></option>
1216
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1217
+	echo ' selected';
1218
+}
1219
+?>><?php echo _("Cargo"); ?></option>
1220
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1221
+	echo ' selected';
1222
+}
1223
+?>><?php echo _("Military"); ?></option>
792 1224
 			</select>
793 1225
 		    </li>
794 1226
 		    <?php
@@ -802,7 +1234,10 @@  discard block
 block discarded – undo
802 1234
 		    ?>
803 1235
 		    <li>
804 1236
 			<?php echo _("Display vessels with MMSI:"); ?>
805
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1237
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1238
+	print $_COOKIE['filter_mmsi'];
1239
+}
1240
+?>" />
806 1241
 		    </li>
807 1242
 			<?php
808 1243
 				if (isset($globalVM) && $globalVM) {
@@ -833,7 +1268,10 @@  discard block
 block discarded – undo
833 1268
 		    ?>
834 1269
 		    <li>
835 1270
 			<?php echo _("Display with ident:"); ?>
836
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1271
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1272
+	print $_COOKIE['filter_ident'];
1273
+}
1274
+?>" />
837 1275
 		    </li>
838 1276
 		</ul>
839 1277
 	    </form>
@@ -849,7 +1287,10 @@  discard block
 block discarded – undo
849 1287
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
850 1288
 	    <form>
851 1289
 		<ul>
852
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1290
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1291
+	print 'checked';
1292
+}
1293
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
853 1294
 		    <li><?php echo _("Type:"); ?>
854 1295
 			<select class="selectpicker" multiple onchange="sattypes(this);">
855 1296
 			    <?php
@@ -857,25 +1298,45 @@  discard block
 block discarded – undo
857 1298
 				$types = $Satellite->get_tle_types();
858 1299
 				foreach ($types as $type) {
859 1300
 					$type_name = $type['tle_type'];
860
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
861
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
862
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
863
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
864
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
865
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
866
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
867
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
868
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
869
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
870
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
871
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
872
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
873
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
874
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
875
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
876
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
877
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
878
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1301
+					if ($type_name == 'musson') {
1302
+						$type_name = 'Russian LEO Navigation';
1303
+					} else if ($type_name == 'nnss') {
1304
+						$type_name = 'Navi Navigation Satellite System';
1305
+					} else if ($type_name == 'sbas') {
1306
+						$type_name = 'Satellite-Based Augmentation System';
1307
+					} else if ($type_name == 'glo-ops') {
1308
+						$type_name = 'Glonass Operational';
1309
+					} else if ($type_name == 'gps-ops') {
1310
+						$type_name = 'GPS Operational';
1311
+					} else if ($type_name == 'argos') {
1312
+						$type_name = 'ARGOS Data Collection System';
1313
+					} else if ($type_name == 'tdrss') {
1314
+						$type_name = 'Tracking and Data Relay Satellite System';
1315
+					} else if ($type_name == 'sarsat') {
1316
+						$type_name = 'Search & Rescue';
1317
+					} else if ($type_name == 'dmc') {
1318
+						$type_name = 'Disaster Monitoring';
1319
+					} else if ($type_name == 'resource') {
1320
+						$type_name = 'Earth Resources';
1321
+					} else if ($type_name == 'stations') {
1322
+						$type_name = 'Space Stations';
1323
+					} else if ($type_name == 'geo') {
1324
+						$type_name = 'Geostationary';
1325
+					} else if ($type_name == 'amateur') {
1326
+						$type_name = 'Amateur Radio';
1327
+					} else if ($type_name == 'x-comm') {
1328
+						$type_name = 'Experimental';
1329
+					} else if ($type_name == 'other-comm') {
1330
+						$type_name = 'Other Comm';
1331
+					} else if ($type_name == 'science') {
1332
+						$type_name = 'Space & Earth Science';
1333
+					} else if ($type_name == 'military') {
1334
+						$type_name = 'Miscellaneous Military';
1335
+					} else if ($type_name == 'radar') {
1336
+						$type_name = 'Radar Calibration';
1337
+					} else if ($type_name == 'tle-new') {
1338
+						$type_name = 'Last 30 days launches';
1339
+					}
879 1340
 					
880 1341
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
881 1342
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
marine-data.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@  discard block
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
@@ -73,7 +75,9 @@  discard block
 block discarded – undo
73 75
 print '<div class="top">';
74 76
 if (isset($image)) {
75 77
 	print '<div class="left"><img src="'.$image.'" alt="'.$spotter_item['mmsi'].' '.$spotter_item['ident'].'" title="'.$spotter_item['mmsi'].' '.$spotter_item['ident'].' Image &copy; '.$spotter_item['image_copyright'].'"/>';
76
-	if ($spotter_item['image_copyright'] != '') print '<br />Image &copy; '.$spotter_item['image_copyright'];
78
+	if ($spotter_item['image_copyright'] != '') {
79
+		print '<br />Image &copy; '.$spotter_item['image_copyright'];
80
+	}
77 81
 	print '</div>';
78 82
 }
79 83
 //print '<div class="right"><div class="callsign-details"><div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['famtrackid'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident,$currenttime);
18
+		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident, $currenttime);
19 19
 		
20 20
 		if (empty($spotter_array)) {
21 21
 			$from_archive = true;
22
-			$spotter_array = $MarineArchive->getDateArchiveMarineDataByIdent($ident,$currenttime);
22
+			$spotter_array = $MarineArchive->getDateArchiveMarineDataByIdent($ident, $currenttime);
23 23
 		}
24 24
 		
25 25
 	} else {
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 }
35 35
 if (isset($_GET['fammarine_id'])) {
36
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
36
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
37 37
 	if (isset($_GET['currenttime'])) {
38
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
38
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
39 39
 		$currenttime = round($currenttime/1000);
40
-		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id,$currenttime);
40
+		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id, $currenttime);
41 41
 		
42 42
 		if (empty($spotter_array)) {
43 43
 			$from_archive = true;
44 44
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
45
-			$spotter_array = $MarineArchive->getDateArchiveMarineDataById($fammarine_id,$currenttime);
45
+			$spotter_array = $MarineArchive->getDateArchiveMarineDataById($fammarine_id, $currenttime);
46 46
 		}
47 47
 		
48 48
 	} else {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
65 65
 {
66 66
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
67
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
67
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
68 68
 	} else $image = $spotter_item['image_thumbnail'];
69 69
 
70 70
 }
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
 */
95 95
 print '<div><span>'._("Speed").'</span>';
96 96
 if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
97
-	print round($spotter_item['ground_speed']*0.621371,2).' mph';
97
+	print round($spotter_item['ground_speed']*0.621371, 2).' mph';
98 98
 } elseif ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
99
-	print round($spotter_item['ground_speed']*0.539957,2).' knots';
99
+	print round($spotter_item['ground_speed']*0.539957, 2).' knots';
100 100
 } else {
101 101
 	print $spotter_item['ground_speed'].' km/h';
102 102
 }
103 103
 print '</div>';
104 104
 print '<div><span>'._("Coordinates").'</span>';
105 105
 if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) {
106
-	$latitude = $Common->convertDMS($spotter_item['latitude'],'latitude');
106
+	$latitude = $Common->convertDMS($spotter_item['latitude'], 'latitude');
107 107
 	print '<span class="latitude">'.$latitude['deg'].'° '.$latitude['min']."′ ".$latitude['sec'].'" '.$latitude['NSEW'].'</span>, ';
108
-	$longitude = $Common->convertDMS($spotter_item['longitude'],'longitude');
108
+	$longitude = $Common->convertDMS($spotter_item['longitude'], 'longitude');
109 109
 	print '<span class="longitude">'.$longitude['deg'].'° '.$longitude['min']."′ ".$longitude['sec'].'" '.$longitude['NSEW'].'</span>';
110 110
 } elseif ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) {
111
-	$latitude = $Common->convertDM($spotter_item['latitude'],'latitude');
112
-	print '<span class="latitude">'.$latitude['deg'].'° '.round($latitude['min'],3)."′ ".$latitude['NSEW'].'</span>, ';
113
-	$longitude = $Common->convertDM($spotter_item['longitude'],'longitude');
114
-	print '<span class="longitude">'.$longitude['deg'].'° '.round($longitude['min'],3)."′ ".$longitude['NSEW'].'</span>';
111
+	$latitude = $Common->convertDM($spotter_item['latitude'], 'latitude');
112
+	print '<span class="latitude">'.$latitude['deg'].'° '.round($latitude['min'], 3)."′ ".$latitude['NSEW'].'</span>, ';
113
+	$longitude = $Common->convertDM($spotter_item['longitude'], 'longitude');
114
+	print '<span class="longitude">'.$longitude['deg'].'° '.round($longitude['min'], 3)."′ ".$longitude['NSEW'].'</span>';
115 115
 } else {
116 116
 	print '<span class="latitude">'.$spotter_item['latitude'].'</span>, ';
117 117
 	print '<span class="longitude">'.$spotter_item['longitude'].'</span>';
Please login to merge, or discard this patch.
race-detailed.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 require_once('require/class.Language.php');
6 6
 require_once('require/class.MarineArchive.php');
7 7
 
8
-if (!isset($_GET['race'])){
8
+if (!isset($_GET['race'])) {
9 9
 	header('Location: '.$globalURL.'/');
10 10
 } else {
11 11
 	$type = 'marine';
12 12
 	$Marine = new Marine();
13 13
 	$MarineArchive = new MarineArchive();
14 14
 	//calculuation for the pagination
15
-	if(!isset($_GET['limit']))
15
+	if (!isset($_GET['limit']))
16 16
 	{
17 17
 		$limit_start = 0;
18 18
 		$limit_end = 25;
@@ -32,25 +32,25 @@  discard block
 block discarded – undo
32 32
 	$limit_previous_2 = $limit_end - $absolute_difference;
33 33
 	
34 34
 	
35
-	$race = filter_input(INPUT_GET,'race',FILTER_SANITIZE_STRING);
35
+	$race = filter_input(INPUT_GET, 'race', FILTER_SANITIZE_STRING);
36 36
 	$page_url = $globalURL.'/marine/race/'.$race;
37
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
38
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
39
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
37
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
38
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
39
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
40 40
 	$race_data = $Marine->getRace($race);
41 41
 	$filter = array();
42
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
43
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
42
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
43
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
44 44
 	if ($sort != '') 
45 45
 	{
46
-		$spotter_array = $Marine->getMarineDataByRace($race,$limit_start.",".$absolute_difference, $sort,$filter);
46
+		$spotter_array = $Marine->getMarineDataByRace($race, $limit_start.",".$absolute_difference, $sort, $filter);
47 47
 		/*
48 48
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
49 49
 			$spotter_array = $MarineArchive->getMarineDataByRace($race,$limit_start.",".$absolute_difference, $sort,$filter);
50 50
 		}
51 51
 		*/
52 52
 	} else {
53
-		$spotter_array = $Marine->getMarineDataByRace($race,$limit_start.",".$absolute_difference,'',$filter);
53
+		$spotter_array = $Marine->getMarineDataByRace($race, $limit_start.",".$absolute_difference, '', $filter);
54 54
 		/*
55 55
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
56 56
 			$spotter_array = $MarineArchive->getMarineDataByRace($race,$limit_start.",".$absolute_difference,'',$filter);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 	if (!empty($spotter_array))
62 62
 	{
63
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['race_name']);
63
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['race_name']);
64 64
 		$ident = $spotter_array[0]['ident'];
65 65
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
66 66
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		} else $flights = 0;
125 125
 		if ($flights == 0)
126 126
 		*/
127
-		$flights = $Marine->countCaptainsByRace($race,$filter);
127
+		$flights = $Marine->countCaptainsByRace($race, $filter);
128 128
 		print '<div><span class="label">'._("Captains").'</span>'.$flights.'</div>';
129
-		$aircraft_type = count($Marine->countAllBoatTypesByRace($race,$filter));
129
+		$aircraft_type = count($Marine->countAllBoatTypesByRace($race, $filter));
130 130
 		print '<div><span class="label">'._("Boat type").'</span>'.$aircraft_type.'</div>';
131 131
 		//$aircraft_registration = count($Marine->countAllAircraftRegistrationByrace($race,$filter));
132 132
 		//print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>';
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	
153 153
 		//include('race-sub-menu.php');
154 154
 		print '<div class="table column">';
155
-		print '<p>'.sprintf(_("The table below shows the detailed information of all races with the race <strong>%s</strong>."),$spotter_array[0]['race_name']).'</p>';
155
+		print '<p>'.sprintf(_("The table below shows the detailed information of all races with the race <strong>%s</strong>."), $spotter_array[0]['race_name']).'</p>';
156 156
 
157 157
 		include('table-output.php'); 
158 158
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,8 +39,12 @@  discard block
 block discarded – undo
39 39
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
40 40
 	$race_data = $Marine->getRace($race);
41 41
 	$filter = array();
42
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
43
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
42
+	if ($year != '') {
43
+		$filter = array_merge($filter,array('year' => $year));
44
+	}
45
+	if ($month != '') {
46
+		$filter = array_merge($filter,array('month' => $month));
47
+	}
44 48
 	if ($sort != '') 
45 49
 	{
46 50
 		$spotter_array = $Marine->getMarineDataByRace($race,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -62,8 +66,12 @@  discard block
 block discarded – undo
62 66
 	{
63 67
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['race_name']);
64 68
 		$ident = $spotter_array[0]['ident'];
65
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
66
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
69
+		if (isset($spotter_array[0]['latitude'])) {
70
+			$latitude = $spotter_array[0]['latitude'];
71
+		}
72
+		if (isset($spotter_array[0]['longitude'])) {
73
+			$longitude = $spotter_array[0]['longitude'];
74
+		}
67 75
 		require_once('header.php');
68 76
 		/*
69 77
 		if (isset($globalArchive) && $globalArchive) {
@@ -116,7 +124,9 @@  discard block
 block discarded – undo
116 124
 		*/
117 125
 		print '<div class="info column">';
118 126
 		print '<h1>'.$spotter_array[0]['race_name'].'</h1>';
119
-		if (isset($spotter_array[0]['race_id']) && $spotter_array[0]['race_id'] != '') print '<div><span class="label">'._("race ID").'</span>'.$spotter_array[0]['race_id'].'</div>';
127
+		if (isset($spotter_array[0]['race_id']) && $spotter_array[0]['race_id'] != '') {
128
+			print '<div><span class="label">'._("race ID").'</span>'.$spotter_array[0]['race_id'].'</div>';
129
+		}
120 130
 		/*
121 131
 		if ($year == '' && $month == '') {
122 132
 			$Stats = new Stats();
@@ -142,7 +152,9 @@  discard block
 block discarded – undo
142 152
 		if (isset($race_data['race_startdate']) && $race_data['race_startdate'] != '') {
143 153
 			if (isset($globalTimezone)) {
144 154
 				date_default_timezone_set($globalTimezone);
145
-			} else date_default_timezone_set('UTC');
155
+			} else {
156
+				date_default_timezone_set('UTC');
157
+			}
146 158
 			print '<div><span class="startdate">'._("Start date").'</span>'.date("r", strtotime($race_data['race_startdate'])).'</div>';
147 159
 		}
148 160
 		print '</div>';
Please login to merge, or discard this patch.
statistics.php 3 patches
Braces   +172 added lines, -82 removed lines patch added patch discarded remove patch
@@ -22,11 +22,15 @@  discard block
 block discarded – undo
22 22
 	require_once('require/class.Spotter.php');
23 23
 }
24 24
 
25
-if (!isset($filter_name)) $filter_name = '';
25
+if (!isset($filter_name)) {
26
+	$filter_name = '';
27
+}
26 28
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
27 29
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
29
-}
30
+	if (isset($globalFilter['airline'])) {
31
+		$airline_icao = $globalFilter['airline'][0];
32
+	}
33
+	}
30 34
 if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') {
31 35
 	$Spotter = new Spotter();
32 36
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
@@ -61,7 +65,12 @@  discard block
 block discarded – undo
61 65
 <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script>
62 66
 <div class="column">
63 67
     <div class="info">
64
-            <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1>
68
+            <h1><?php if (isset($airline_name)) {
69
+	echo _("Statistics for ").$airline_name;
70
+} else {
71
+	echo _("Statistics");
72
+}
73
+?></h1>
65 74
 <?php 
66 75
 if ($type == 'aircraft') {
67 76
 	$last_update = $Stats->getLastStatsUpdate();
@@ -73,7 +82,9 @@  discard block
 block discarded – undo
73 82
 if (isset($last_update[0]['value'])) {
74 83
 	date_default_timezone_set('UTC');
75 84
 	$lastupdate = strtotime($last_update[0]['value']);
76
-	if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
85
+	if (isset($globalTimezone) && $globalTimezone != '') {
86
+		date_default_timezone_set($globalTimezone);
87
+	}
77 88
 	print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
78 89
 }
79 90
 
@@ -166,8 +177,11 @@  discard block
 block discarded – undo
166 177
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
167 178
 		$aircraft_data = '';
168 179
 		foreach($aircraft_array as $aircraft_item) {
169
-			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
170
-			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
180
+			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') {
181
+				$aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
182
+			} else {
183
+				$aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
184
+			}
171 185
 		}
172 186
 		$aircraft_data = substr($aircraft_data, 0, -1);
173 187
 		print 'var series = ['.$aircraft_data.'];';
@@ -184,11 +198,17 @@  discard block
 block discarded – undo
184 198
 <?php
185 199
 	if ($year != '' && $month != '') {
186 200
 ?>
187
-            	    <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>
201
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
202
+	echo '/'.$airline_icao;
203
+}
204
+?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
188 205
 <?php
189 206
 	} else {
190 207
 ?>
191
-            	    <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>
208
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
209
+	echo '/'.$airline_icao;
210
+}
211
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
192 212
 <?php
193 213
 	}
194 214
 ?>
@@ -217,11 +237,15 @@  discard block
 block discarded – undo
217 237
 			print '</script>';
218 238
 			if ($year != '' && $month != '') {
219 239
 				print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
220
-				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
240
+				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
241
+					echo '/'.$airline_icao;
242
+				}
221 243
 				print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
222 244
 			} else {
223 245
 				print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
224
-				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
246
+				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
247
+					echo '/'.$airline_icao;
248
+				}
225 249
 				print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
226 250
 			}
227 251
 			print '</div>';
@@ -241,8 +265,9 @@  discard block
 block discarded – undo
241 265
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
242 266
 <?php
243 267
 	$marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month);
244
-	if (count($marine_array) == 0) print _("No data available");
245
-	else {
268
+	if (count($marine_array) == 0) {
269
+		print _("No data available");
270
+	} else {
246 271
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
247 272
 		$marine_data = '';
248 273
 		foreach($marine_array as $marine_item) {
@@ -283,8 +308,9 @@  discard block
 block discarded – undo
283 308
                 <h2><?php echo _("Top 10 Races Number of Participants"); ?></h2>
284 309
 <?php
285 310
 	$marine_array = $Marine->countAllCaptainsByRaces(true,$filter_name,$year,$month);
286
-	if (count($marine_array) == 0) print _("No data available");
287
-	else {
311
+	if (count($marine_array) == 0) {
312
+		print _("No data available");
313
+	} else {
288 314
 		print '<div id="chart991" class="chart" width="100%"></div><script>';
289 315
 		$marine_data = '';
290 316
 		foreach($marine_array as $marine_item) {
@@ -331,8 +357,9 @@  discard block
 block discarded – undo
331 357
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
332 358
 <?php
333 359
 	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
334
-	if (count($tracker_array) == 0) print _("No data available");
335
-	else {
360
+	if (count($tracker_array) == 0) {
361
+		print _("No data available");
362
+	} else {
336 363
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
337 364
 		$tracker_data = '';
338 365
 		foreach($tracker_array as $tracker_item) {
@@ -376,8 +403,9 @@  discard block
 block discarded – undo
376 403
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
377 404
 <?php
378 405
 		$owner_array = $Satellite->countAllOwners(true);
379
-		if (count($owner_array) == 0) print _("No data available");
380
-		else {
406
+		if (count($owner_array) == 0) {
407
+			print _("No data available");
408
+		} else {
381 409
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
382 410
 			$owner_data = '';
383 411
 			foreach($owner_array as $owner_item) {
@@ -396,7 +424,10 @@  discard block
 block discarded – undo
396 424
 ?>
397 425
                <!--
398 426
                 <div class="more">
399
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?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>
427
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
428
+	echo '/'.$airline_icao;
429
+}
430
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
400 431
                 </div>
401 432
                 -->
402 433
             </div>
@@ -405,8 +436,9 @@  discard block
 block discarded – undo
405 436
                 <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2>
406 437
 <?php
407 438
 		$countries_array = $Satellite->countAllCountriesOwners(true);
408
-		if (count($countries_array) == 0) print _("No data available");
409
-		else {
439
+		if (count($countries_array) == 0) {
440
+			print _("No data available");
441
+		} else {
410 442
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
411 443
 			$owner_data = '';
412 444
 			foreach($countries_array as $owner_item) {
@@ -425,7 +457,10 @@  discard block
 block discarded – undo
425 457
 ?>
426 458
 	    <!--
427 459
                 <div class="more">
428
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?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>
460
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
461
+	echo '/'.$airline_icao;
462
+}
463
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
429 464
                 </div>
430 465
                 -->
431 466
             </div>
@@ -437,8 +472,9 @@  discard block
 block discarded – undo
437 472
                 <h2><?php echo _("Top 10 Most Common Launch Sites"); ?></h2>
438 473
 <?php
439 474
 		$launch_site_array = $Satellite->countAllLaunchSite(true);
440
-		if (count($launch_site_array) == 0) print _("No data available");
441
-		else {
475
+		if (count($launch_site_array) == 0) {
476
+			print _("No data available");
477
+		} else {
442 478
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
443 479
 			$launch_site_data = '';
444 480
 			foreach($launch_site_array as $launch_site_item) {
@@ -457,7 +493,10 @@  discard block
 block discarded – undo
457 493
 ?>
458 494
                <!--
459 495
                 <div class="more">
460
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?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>
496
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
497
+	echo '/'.$airline_icao;
498
+}
499
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
461 500
                 </div>
462 501
                 -->
463 502
             </div>
@@ -480,8 +519,9 @@  discard block
 block discarded – undo
480 519
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
481 520
 <?php
482 521
 		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
483
-		if (count($pilot_array) == 0) print _("No data available");
484
-		else {
522
+		if (count($pilot_array) == 0) {
523
+			print _("No data available");
524
+		} else {
485 525
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
486 526
 			$pilot_data = '';
487 527
 			foreach($pilot_array as $pilot_item) {
@@ -499,7 +539,9 @@  discard block
 block discarded – undo
499 539
 		}
500 540
 		print '<div class="more">';
501 541
 		print '<a href="'.$globalURL.'/statistics/pilot'; 
502
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
542
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
543
+			echo '/'.$airline_icao;
544
+		}
503 545
 		print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
504 546
 		print '</div>';
505 547
 ?>
@@ -515,8 +557,9 @@  discard block
 block discarded – undo
515 557
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
516 558
 <?php
517 559
 		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
518
-		if (count($owner_array) == 0) print _("No data available");
519
-		else {
560
+		if (count($owner_array) == 0) {
561
+			print _("No data available");
562
+		} else {
520 563
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
521 564
 			$owner_data = '';
522 565
 			foreach($owner_array as $owner_item) {
@@ -534,7 +577,10 @@  discard block
 block discarded – undo
534 577
 		}
535 578
 ?>
536 579
                 <div class="more">
537
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?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>
580
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
581
+	echo '/'.$airline_icao;
582
+}
583
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
538 584
                 </div>
539 585
             </div>
540 586
         
@@ -547,8 +593,9 @@  discard block
 block discarded – undo
547 593
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
548 594
 <?php
549 595
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
550
-		if (count($flightover_array) == 0) print _("No data available");
551
-		else {
596
+		if (count($flightover_array) == 0) {
597
+			print _("No data available");
598
+		} else {
552 599
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
553 600
 			print 'var series = [';
554 601
 			$flightover_data = '';
@@ -590,7 +637,10 @@  discard block
 block discarded – undo
590 637
 		}
591 638
 ?>
592 639
                 <div class="more">
593
-                    <a href="<?php print $globalURL; ?>/statistics/country<?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>
640
+                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
641
+	echo '/'.$airline_icao;
642
+}
643
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
594 644
                 </div>
595 645
             </div>
596 646
 <?php
@@ -608,8 +658,9 @@  discard block
 block discarded – undo
608 658
 	<div class="col-md-6">
609 659
             <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2>
610 660
 <?php
611
-	if (count($flightover_array) == 0) print _("No data available");
612
-	else {
661
+	if (count($flightover_array) == 0) {
662
+		print _("No data available");
663
+	} else {
613 664
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
614 665
 		print 'var series = [';
615 666
 		$flightover_data = '';
@@ -666,8 +717,9 @@  discard block
 block discarded – undo
666 717
 	<div class="col-md-6">
667 718
             <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2>
668 719
 <?php
669
-	if (count($flightover_array) == 0) print _("No data available");
670
-	else {
720
+	if (count($flightover_array) == 0) {
721
+		print _("No data available");
722
+	} else {
671 723
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
672 724
 		print 'var series = [';
673 725
 		$flightover_data = '';
@@ -773,7 +825,9 @@  discard block
 block discarded – undo
773 825
 		});";
774 826
 		print '</script>';
775 827
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
776
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
828
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
829
+			echo '/'.$airline_icao;
830
+		}
777 831
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
778 832
 	}
779 833
 ?>
@@ -837,7 +891,9 @@  discard block
 block discarded – undo
837 891
 		});";
838 892
 		print '</script>';
839 893
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
840
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
894
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
895
+			echo '/'.$airline_icao;
896
+		}
841 897
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
842 898
 	}
843 899
 ?>
@@ -856,8 +912,9 @@  discard block
 block discarded – undo
856 912
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
857 913
 <?php
858 914
 		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
859
-		if (count($year_array) == 0) print _("No data available");
860
-		else {
915
+		if (count($year_array) == 0) {
916
+			print _("No data available");
917
+		} else {
861 918
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
862 919
 			$year_data = '';
863 920
 			$year_cnt = '';
@@ -876,7 +933,10 @@  discard block
 block discarded – undo
876 933
 		}
877 934
 ?>
878 935
                 <div class="more">
879
-                    <a href="<?php print $globalURL; ?>/statistics/year<?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>
936
+                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
937
+	echo '/'.$airline_icao;
938
+}
939
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
880 940
                 </div>
881 941
             </div>
882 942
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -884,8 +944,9 @@  discard block
 block discarded – undo
884 944
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
885 945
 <?php
886 946
 		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
887
-		if (count($month_array) == 0) print _("No data available");
888
-		else {
947
+		if (count($month_array) == 0) {
948
+			print _("No data available");
949
+		} else {
889 950
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
890 951
 			$month_data = '';
891 952
 			$month_cnt = '';
@@ -904,7 +965,10 @@  discard block
 block discarded – undo
904 965
 		}
905 966
 ?>
906 967
                 <div class="more">
907
-                    <a href="<?php print $globalURL; ?>/statistics/month<?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>
968
+                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
969
+	echo '/'.$airline_icao;
970
+}
971
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
908 972
                 </div>
909 973
             </div>
910 974
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -913,8 +977,9 @@  discard block
 block discarded – undo
913 977
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
914 978
 <?php
915 979
 		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
916
-		if (empty($date_array)) print _("No data available");
917
-		else {
980
+		if (empty($date_array)) {
981
+			print _("No data available");
982
+		} else {
918 983
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
919 984
 			$date_data = '';
920 985
 			$date_cnt = '';
@@ -933,7 +998,10 @@  discard block
 block discarded – undo
933 998
 		}
934 999
 ?>
935 1000
                 <div class="more">
936
-                    <a href="<?php print $globalURL; ?>/statistics/date<?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>
1001
+                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
1002
+	echo '/'.$airline_icao;
1003
+}
1004
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
937 1005
                 </div>
938 1006
             </div>
939 1007
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -941,8 +1009,9 @@  discard block
 block discarded – undo
941 1009
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
942 1010
 <?php
943 1011
 		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
944
-		if (empty($hour_array)) print _("No data available");
945
-		else {
1012
+		if (empty($hour_array)) {
1013
+			print _("No data available");
1014
+		} else {
946 1015
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
947 1016
 			$hour_data = '';
948 1017
 			$hour_cnt = '';
@@ -961,7 +1030,10 @@  discard block
 block discarded – undo
961 1030
 		}
962 1031
 ?>
963 1032
                 <div class="more">
964
-                    <a href="<?php print $globalURL; ?>/statistics/time<?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>
1033
+                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
1034
+	echo '/'.$airline_icao;
1035
+}
1036
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
965 1037
                 </div>
966 1038
             </div>
967 1039
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -981,8 +1053,9 @@  discard block
 block discarded – undo
981 1053
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
982 1054
 <?php
983 1055
 		$year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name);
984
-		if (count($year_array) == 0) print _("No data available");
985
-		else {
1056
+		if (count($year_array) == 0) {
1057
+			print _("No data available");
1058
+		} else {
986 1059
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
987 1060
 			$year_data = '';
988 1061
 			$year_cnt = '';
@@ -1010,8 +1083,9 @@  discard block
 block discarded – undo
1010 1083
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1011 1084
 <?php
1012 1085
 		$month_array = $Stats->countAllMarineDatesLastMonth($filter_name);
1013
-		if (count($month_array) == 0) print _("No data available");
1014
-		else {
1086
+		if (count($month_array) == 0) {
1087
+			print _("No data available");
1088
+		} else {
1015 1089
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1016 1090
 			$month_data = '';
1017 1091
 			$month_cnt = '';
@@ -1039,8 +1113,9 @@  discard block
 block discarded – undo
1039 1113
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
1040 1114
 <?php
1041 1115
 		$date_array = $Stats->countAllMarineDatesLast7Days($filter_name);
1042
-		if (empty($date_array)) print _("No data available");
1043
-		else {
1116
+		if (empty($date_array)) {
1117
+			print _("No data available");
1118
+		} else {
1044 1119
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1045 1120
 			$date_data = '';
1046 1121
 			$date_cnt = '';
@@ -1067,8 +1142,9 @@  discard block
 block discarded – undo
1067 1142
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1068 1143
 <?php
1069 1144
 		$hour_array = $Stats->countAllMarineHours('hour',true,$filter_name);
1070
-		if (empty($hour_array)) print _("No data available");
1071
-		else {
1145
+		if (empty($hour_array)) {
1146
+			print _("No data available");
1147
+		} else {
1072 1148
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1073 1149
 			$hour_data = '';
1074 1150
 			$hour_cnt = '';
@@ -1107,8 +1183,9 @@  discard block
 block discarded – undo
1107 1183
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
1108 1184
 <?php
1109 1185
 		$year_array = $Stats->countAllTrackerMonthsLastYear(true);
1110
-		if (count($year_array) == 0) print _("No data available");
1111
-		else {
1186
+		if (count($year_array) == 0) {
1187
+			print _("No data available");
1188
+		} else {
1112 1189
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
1113 1190
 			$year_data = '';
1114 1191
 			$year_cnt = '';
@@ -1136,8 +1213,9 @@  discard block
 block discarded – undo
1136 1213
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1137 1214
 <?php
1138 1215
 		$month_array = $Stats->countAllTrackerDatesLastMonth();
1139
-		if (count($month_array) == 0) print _("No data available");
1140
-		else {
1216
+		if (count($month_array) == 0) {
1217
+			print _("No data available");
1218
+		} else {
1141 1219
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1142 1220
 			$month_data = '';
1143 1221
 			$month_cnt = '';
@@ -1165,8 +1243,9 @@  discard block
 block discarded – undo
1165 1243
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
1166 1244
 <?php
1167 1245
 		$date_array = $Stats->countAllTrackerDatesLast7Days();
1168
-		if (empty($date_array)) print _("No data available");
1169
-		else {
1246
+		if (empty($date_array)) {
1247
+			print _("No data available");
1248
+		} else {
1170 1249
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1171 1250
 			$date_data = '';
1172 1251
 			$date_cnt = '';
@@ -1193,8 +1272,9 @@  discard block
 block discarded – undo
1193 1272
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1194 1273
 <?php
1195 1274
 		$hour_array = $Stats->countAllTrackerHours('hour',true);
1196
-		if (empty($hour_array)) print _("No data available");
1197
-		else {
1275
+		if (empty($hour_array)) {
1276
+			print _("No data available");
1277
+		} else {
1198 1278
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1199 1279
 			$hour_data = '';
1200 1280
 			$hour_cnt = '';
@@ -1233,8 +1313,9 @@  discard block
 block discarded – undo
1233 1313
                 <h2><?php echo _("Busiest Launch Months of the last 12 Months"); ?></h2>
1234 1314
 <?php
1235 1315
 		$year_array = $Satellite->countAllMonthsLastYear();
1236
-		if (count($year_array) == 0) print _("No data available");
1237
-		else {
1316
+		if (count($year_array) == 0) {
1317
+			print _("No data available");
1318
+		} else {
1238 1319
 			print '<div id="chart21" class="chart" width="100%"></div><script>';
1239 1320
 			$year_data = '';
1240 1321
 			$year_cnt = '';
@@ -1264,8 +1345,9 @@  discard block
 block discarded – undo
1264 1345
                 <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2>
1265 1346
 <?php
1266 1347
 		$year_array = $Satellite->countAllYears();
1267
-		if (count($year_array) == 0) print _("No data available");
1268
-		else {
1348
+		if (count($year_array) == 0) {
1349
+			print _("No data available");
1350
+		} else {
1269 1351
 			print '<div id="chart22" class="chart" width="100%"></div><script>';
1270 1352
 			$year_data = '';
1271 1353
 			$year_cnt = '';
@@ -1307,8 +1389,9 @@  discard block
 block discarded – undo
1307 1389
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
1308 1390
 <?php
1309 1391
 		$year_array = $Stats->countFatalitiesByYear();
1310
-		if (count($year_array) == 0) print _("No data available");
1311
-		else {
1392
+		if (count($year_array) == 0) {
1393
+			print _("No data available");
1394
+		} else {
1312 1395
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1313 1396
 			$year_data = '';
1314 1397
 			$year_cnt = '';
@@ -1337,8 +1420,9 @@  discard block
 block discarded – undo
1337 1420
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
1338 1421
 <?php
1339 1422
 		$year_array = $Stats->countFatalitiesLast12Months();
1340
-		if (count($year_array) == 0) print _("No data available");
1341
-		else {
1423
+		if (count($year_array) == 0) {
1424
+			print _("No data available");
1425
+		} else {
1342 1426
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1343 1427
 			$year_data = '';
1344 1428
 			$year_cnt = '';
@@ -1409,8 +1493,11 @@  discard block
 block discarded – undo
1409 1493
 					$distance = $distance;
1410 1494
 					$unit = 'km';
1411 1495
 				}
1412
-				if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1413
-				else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1496
+				if (!isset($polar_data)) {
1497
+					$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1498
+				} else {
1499
+					$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1500
+				}
1414 1501
 			}
1415 1502
 ?>
1416 1503
             <div class="col-md-6">
@@ -1474,9 +1561,12 @@  discard block
 block discarded – undo
1474 1561
 		foreach ($msg as $eachmsg) {
1475 1562
 			//$eachmsg = $msg[0];
1476 1563
 			$data = $eachmsg['source_data'];
1477
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1478
-			else $max = 500;
1479
-?>
1564
+			if ($data > 500) {
1565
+				$max = (round(($data+100)/100))*100;
1566
+			} else {
1567
+				$max = 500;
1568
+			}
1569
+			?>
1480 1570
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1481 1571
         	<script>
1482 1572
 		      var g = new JustGage({
Please login to merge, or discard this patch.
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 }
24 24
 
25 25
 if (!isset($filter_name)) $filter_name = '';
26
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
26
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
27 27
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28 28
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
29 29
 }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
33 33
 	if (isset($airline_info[0]['name'])) {
34 34
 		$airline_name = $airline_info[0]['name'];
35
-	} elseif (strpos($airline_icao,'alliance_') !== FALSE) {
35
+	} elseif (strpos($airline_icao, 'alliance_') !== FALSE) {
36 36
 		$alliance_name = $airline_icao;
37 37
 	}
38 38
 }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	$title = _("Statistics");
43 43
 }
44 44
 
45
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
45
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
46
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
47 47
 
48 48
 require_once('header.php');
49 49
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	date_default_timezone_set('UTC');
75 75
 	$lastupdate = strtotime($last_update[0]['value']);
76 76
 	if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
77
-	print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
77
+	print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
78 78
 }
79 79
 
80 80
 ?>
@@ -86,31 +86,31 @@  discard block
 block discarded – undo
86 86
 <?php
87 87
 if ($type == 'aircraft') {
88 88
 ?>
89
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
90
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
91
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
92
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
89
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
90
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
91
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
92
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
93 93
 <?php
94 94
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
95 95
 ?>
96
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
97
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
96
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
97
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
98 98
 <?php
99 99
 	}
100 100
 	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
101 101
 ?>
102
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
103
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
102
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
103
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
104 104
 <?php
105 105
 	}
106 106
 ?>
107
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircraft types"); ?></span>
108
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
107
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircraft types"); ?></span>
108
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
109 109
 <?php
110 110
 	if ($airline_icao == '') {
111 111
 ?>
112
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
113
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
112
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
113
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
114 114
 <?php
115 115
 	}
116 116
 ?>
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) {
119 119
 		if ($airline_icao == '' || $airline_icao == 'all') {
120 120
 ?>
121
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
122
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
121
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
122
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
123 123
 <?php
124 124
 		}
125 125
 	}
@@ -127,35 +127,35 @@  discard block
 block discarded – undo
127 127
 <?php
128 128
 } elseif ($type == 'marine') {
129 129
 ?>
130
-	<span><span class="badge"><?php print number_format($Stats->countOverallMarine($filter_name,$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
131
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
130
+	<span><span class="badge"><?php print number_format($Stats->countOverallMarine($filter_name, $year, $month)); ?></span> <?php echo _("Vessels"); ?></span>
131
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
132 132
 <?php
133 133
 	if (isset($globalVM) && $globalVM) {
134 134
 ?>
135
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes($filter_name,$year,$month)); ?></span> <?php echo _("Types"); ?></span>
136
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
137
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarineRaces($filter_name,$year,$month)); ?></span> <?php echo _("Races"); ?></span>
138
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
139
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarineCaptains($filter_name,$year,$month)); ?></span> <?php echo _("Captains"); ?></span>
140
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
135
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes($filter_name, $year, $month)); ?></span> <?php echo _("Types"); ?></span>
136
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
137
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarineRaces($filter_name, $year, $month)); ?></span> <?php echo _("Races"); ?></span>
138
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
139
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarineCaptains($filter_name, $year, $month)); ?></span> <?php echo _("Captains"); ?></span>
140
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
141 141
 <?php
142 142
 	} else {
143 143
 ?>
144
-	<span><span class="badge"><?php print number_format($Stats->countOverallMarineTypes($filter_name,$year,$month)); ?></span> <?php echo _("Types"); ?></span>
145
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
144
+	<span><span class="badge"><?php print number_format($Stats->countOverallMarineTypes($filter_name, $year, $month)); ?></span> <?php echo _("Types"); ?></span>
145
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
146 146
 <?php
147 147
 	}
148 148
 } elseif ($type == 'tracker') {
149 149
 ?>
150
-	<span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
151
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
152
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
153
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
150
+	<span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name, $year, $month)); ?></span> <?php echo _("Trackers"); ?></span>
151
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
152
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
153
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
154 154
 <?php
155 155
 }
156 156
 ?>
157 157
     </p>
158
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
158
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
159 159
     <div class="specific-stats">
160 160
 <?php
161 161
 if ($type == 'aircraft') {
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
             <div class="col-md-6">
165 165
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
166 166
 <?php
167
-	$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
167
+	$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
168 168
 	if (count($aircraft_array) == 0) {
169 169
 		print _("No data available");
170 170
 	} else {
171 171
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
172 172
 		$aircraft_data = '';
173
-		foreach($aircraft_array as $aircraft_item) {
173
+		foreach ($aircraft_array as $aircraft_item) {
174 174
 			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
175 175
 			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
176 176
 		}
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
 ?>
200 200
                 </div>
201 201
             </div>
202
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
202
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
203 203
 <?php
204 204
 	if ($airline_icao == '' || $airline_icao == 'all') {
205
-		$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
205
+		$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
206 206
 		if (count($airline_array) > 0) {
207 207
 			print '<div class="col-md-6">';
208 208
 			print '<h2>'._("Top 10 Most Common Airline").'</h2>';
209 209
 			print '<div id="chart2" class="chart" width="100%"></div><script>';
210 210
 			$airline_data = '';
211
-			foreach($airline_array as $airline_item) {
211
+			foreach ($airline_array as $airline_item) {
212 212
 				$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
213 213
 			}
214 214
 			$airline_data = substr($airline_data, 0, -1);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		}
234 234
 ?>
235 235
         </div>
236
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
236
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
237 237
 <?php
238 238
 	}
239 239
 }
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
             <div class="col-md-6">
246 246
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
247 247
 <?php
248
-	$marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month);
248
+	$marine_array = $Stats->countAllMarineTypes(true, $filter_name, $year, $month);
249 249
 	if (count($marine_array) == 0) print _("No data available");
250 250
 	else {
251 251
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
252 252
 		$marine_data = '';
253
-		foreach($marine_array as $marine_item) {
253
+		foreach ($marine_array as $marine_item) {
254 254
 			$marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
255 255
 		}
256 256
 		$marine_data = substr($marine_data, 0, -1);
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             	    ?>
280 280
                 </div>
281 281
             </div>
282
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
282
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
283 283
 <!--	</div>-->
284 284
 <?php
285 285
 	if (isset($globalVM) && $globalVM) {
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
             <div class="col-md-6">
288 288
                 <h2><?php echo _("Top 10 Races Number of Participants"); ?></h2>
289 289
 <?php
290
-	$marine_array = $Marine->countAllCaptainsByRaces(true,$filter_name,$year,$month);
290
+	$marine_array = $Marine->countAllCaptainsByRaces(true, $filter_name, $year, $month);
291 291
 	if (count($marine_array) == 0) print _("No data available");
292 292
 	else {
293 293
 		print '<div id="chart991" class="chart" width="100%"></div><script>';
294 294
 		$marine_data = '';
295
-		foreach($marine_array as $marine_item) {
295
+		foreach ($marine_array as $marine_item) {
296 296
 			$marine_data .= '["'.$marine_item['marine_race_name'].'",'.$marine_item['marine_captain_count'].'],';
297 297
 		}
298 298
 		$marine_data = substr($marine_data, 0, -1);
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             	    ?>
323 323
                 </div>
324 324
             </div>
325
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
325
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
326 326
 	</div>
327 327
         <div class="row column">
328 328
 
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
             <div class="col-md-6">
336 336
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
337 337
 <?php
338
-	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
338
+	$tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month);
339 339
 	if (count($tracker_array) == 0) print _("No data available");
340 340
 	else {
341 341
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
342 342
 		$tracker_data = '';
343
-		foreach($tracker_array as $tracker_item) {
343
+		foreach ($tracker_array as $tracker_item) {
344 344
 			$tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
345 345
 		}
346 346
 		$tracker_data = substr($tracker_data, 0, -1);
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
             	    ?>
371 371
                 </div>
372 372
             </div>
373
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
373
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
374 374
 <!--	</div>-->
375 375
 <?php
376 376
 }
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 		else {
386 386
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
387 387
 			$owner_data = '';
388
-			foreach($owner_array as $owner_item) {
388
+			foreach ($owner_array as $owner_item) {
389 389
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
390 390
 			}
391 391
 			$owner_data = substr($owner_data, 0, -1);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                 </div>
406 406
                 -->
407 407
             </div>
408
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
408
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
409 409
             <div class="col-md-6">
410 410
                 <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2>
411 411
 <?php
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 		else {
415 415
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
416 416
 			$owner_data = '';
417
-			foreach($countries_array as $owner_item) {
417
+			foreach ($countries_array as $owner_item) {
418 418
 				$owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],';
419 419
 			}
420 420
 			$owner_data = substr($owner_data, 0, -1);
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                 -->
436 436
             </div>
437 437
             
438
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
438
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
439 439
 ²	</div>
440 440
         <div class="row column">
441 441
             <div class="col-md-6">
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 		else {
447 447
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
448 448
 			$launch_site_data = '';
449
-			foreach($launch_site_array as $launch_site_item) {
449
+			foreach ($launch_site_array as $launch_site_item) {
450 450
 				$launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],';
451 451
 			}
452 452
 			$launch_site_data = substr($launch_site_data, 0, -1);
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 ?>
474 474
         <div class="row column">
475 475
 <?php
476
-	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
476
+	$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
477 477
 	//if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
478 478
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
479 479
 		if (empty($flightover_array)) {
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
 ?>
485 485
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
486 486
 <?php
487
-		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
487
+		$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
488 488
 		if (count($pilot_array) == 0) print _("No data available");
489 489
 		else {
490 490
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
491 491
 			$pilot_data = '';
492
-			foreach($pilot_array as $pilot_item) {
492
+			foreach ($pilot_array as $pilot_item) {
493 493
 				$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
494 494
 			}
495 495
 			$pilot_data = substr($pilot_data, 0, -1);
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 ?>
511 511
             </div>
512 512
 
513
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
513
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
514 514
 <?php
515 515
 	}
516 516
 	// else {
@@ -519,12 +519,12 @@  discard block
 block discarded – undo
519 519
             <div class="col-md-6">
520 520
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
521 521
 <?php
522
-		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
522
+		$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
523 523
 		if (count($owner_array) == 0) print _("No data available");
524 524
 		else {
525 525
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
526 526
 			$owner_data = '';
527
-			foreach($owner_array as $owner_item) {
527
+			foreach ($owner_array as $owner_item) {
528 528
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
529 529
 			}
530 530
 			$owner_data = substr($owner_data, 0, -1);
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                 </div>
544 544
             </div>
545 545
         
546
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
546
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
547 547
 <?php
548 548
 	}
549 549
 	if (!empty($flightover_array)) {
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
558 558
 			print 'var series = [';
559 559
 			$flightover_data = '';
560
-			foreach($flightover_array as $flightover_item) {
560
+			foreach ($flightover_array as $flightover_item) {
561 561
 				$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
562 562
 			}
563 563
 			$flightover_data = substr($flightover_data, 0, -1);
@@ -602,12 +602,12 @@  discard block
 block discarded – undo
602 602
 	}
603 603
 ?>
604 604
         </div>
605
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
605
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
606 606
         </div>
607 607
 <?php
608 608
 }
609 609
 if ($type == 'marine') {
610
-	$flightover_array = $Stats->countAllMarineOverCountries(true,$filter_name,$year,$month);
610
+	$flightover_array = $Stats->countAllMarineOverCountries(true, $filter_name, $year, $month);
611 611
 ?>
612 612
 <!--    <div class="row column">-->
613 613
 	<div class="col-md-6">
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
619 619
 		print 'var series = [';
620 620
 		$flightover_data = '';
621
-		foreach($flightover_array as $flightover_item) {
621
+		foreach ($flightover_array as $flightover_item) {
622 622
 			$flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
623 623
 		}
624 624
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                 <div class="more">
659 659
                     <a href="<?php print $globalURL; ?>/marine/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
660 660
                 </div>
661
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
661
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
662 662
             </div>
663 663
         </div>
664 664
 
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
677 677
 		print 'var series = [';
678 678
 		$flightover_data = '';
679
-		foreach($flightover_array as $flightover_item) {
679
+		foreach ($flightover_array as $flightover_item) {
680 680
 			$flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
681 681
 		}
682 682
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -726,14 +726,14 @@  discard block
 block discarded – undo
726 726
         <div class="row column">
727 727
             <div class="col-md-6">
728 728
 <?php
729
-	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
729
+	$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
730 730
 	if (count($airport_airport_array) > 0) {
731 731
 		print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
732 732
 		print '<div id="chart3" class="chart" width="100%"></div><script>';
733 733
 		print "\n";
734 734
 		print 'var series = [';
735 735
 		$airport_data = '';
736
-		foreach($airport_airport_array as $airport_item) {
736
+		foreach ($airport_airport_array as $airport_item) {
737 737
 			$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
738 738
 		}
739 739
 		$airport_data = substr($airport_data, 0, -1);
@@ -783,18 +783,18 @@  discard block
 block discarded – undo
783 783
 	}
784 784
 ?>
785 785
             </div>
786
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
786
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
787 787
 
788 788
             <div class="col-md-6">
789 789
 <?php
790
-	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
790
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
791 791
 	if (count($airport_airport_array2) > 0) {
792 792
 		print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
793 793
 		print '<div id="chart4" class="chart" width="100%"></div><script>';
794 794
 		print "\n";
795 795
 		print 'var series = [';
796 796
 		$airport_data = '';
797
-		foreach($airport_airport_array2 as $airport_item)
797
+		foreach ($airport_airport_array2 as $airport_item)
798 798
 		{
799 799
 			if (isset($airport_item['airport_arrival_longitude']) && isset($airport_item['airport_arrival_latitude'])) {
800 800
 				$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 ?>
849 849
             </div>
850 850
         </div>
851
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
851
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
852 852
 <?php 
853 853
 }
854 854
 if ($type == 'aircraft') {
@@ -860,18 +860,18 @@  discard block
 block discarded – undo
860 860
             <div class="col-md-6">
861 861
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
862 862
 <?php
863
-		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
863
+		$year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
864 864
 		if (count($year_array) == 0) print _("No data available");
865 865
 		else {
866 866
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
867 867
 			$year_data = '';
868 868
 			$year_cnt = '';
869
-			foreach($year_array as $year_item) {
869
+			foreach ($year_array as $year_item) {
870 870
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
871 871
 				$year_cnt .= $year_item['date_count'].',';
872 872
 			}
873 873
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
874
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
874
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
875 875
 			print 'c3.generate({
876 876
 			    bindto: "#chart8",
877 877
 			    data: { x: "x",
@@ -884,22 +884,22 @@  discard block
 block discarded – undo
884 884
                     <a href="<?php print $globalURL; ?>/statistics/year<?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>
885 885
                 </div>
886 886
             </div>
887
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
887
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
888 888
             <div class="col-md-6">
889 889
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
890 890
 <?php
891
-		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
891
+		$month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
892 892
 		if (count($month_array) == 0) print _("No data available");
893 893
 		else {
894 894
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
895 895
 			$month_data = '';
896 896
 			$month_cnt = '';
897
-			foreach($month_array as $month_item) {
897
+			foreach ($month_array as $month_item) {
898 898
 				$month_data .= '"'.$month_item['date_name'].'",';
899 899
 				$month_cnt .= $month_item['date_count'].',';
900 900
 			}
901 901
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
902
-			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
902
+			$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
903 903
 			print 'c3.generate({
904 904
 			    bindto: "#chart9",
905 905
 			    data: { x: "x",
@@ -912,23 +912,23 @@  discard block
 block discarded – undo
912 912
                     <a href="<?php print $globalURL; ?>/statistics/month<?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>
913 913
                 </div>
914 914
             </div>
915
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
915
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
916 916
 
917 917
             <div class="col-md-6">
918 918
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
919 919
 <?php
920
-		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
920
+		$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
921 921
 		if (empty($date_array)) print _("No data available");
922 922
 		else {
923 923
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
924 924
 			$date_data = '';
925 925
 			$date_cnt = '';
926
-			foreach($date_array as $date_item) {
926
+			foreach ($date_array as $date_item) {
927 927
 				$date_data .= '"'.$date_item['date_name'].'",';
928 928
 				$date_cnt .= $date_item['date_count'].',';
929 929
 			}
930 930
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
931
-			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
931
+			$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
932 932
 			print 'c3.generate({
933 933
 			    bindto: "#chart5",
934 934
 			    data: { x: "x",
@@ -941,22 +941,22 @@  discard block
 block discarded – undo
941 941
                     <a href="<?php print $globalURL; ?>/statistics/date<?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>
942 942
                 </div>
943 943
             </div>
944
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
944
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
945 945
             <div class="col-md-6">
946 946
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
947 947
 <?php
948
-		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
948
+		$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
949 949
 		if (empty($hour_array)) print _("No data available");
950 950
 		else {
951 951
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
952 952
 			$hour_data = '';
953 953
 			$hour_cnt = '';
954
-			foreach($hour_array as $hour_item) {
954
+			foreach ($hour_array as $hour_item) {
955 955
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
956 956
 				$hour_cnt .= $hour_item['hour_count'].',';
957 957
 			}
958 958
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
959
-			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
959
+			$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
960 960
 			print 'c3.generate({
961 961
 			    bindto: "#chart6",
962 962
 			    data: {
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
                     <a href="<?php print $globalURL; ?>/statistics/time<?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>
970 970
                 </div>
971 971
             </div>
972
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
972
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
973 973
         </div>
974 974
 <?php
975 975
 	}
@@ -985,18 +985,18 @@  discard block
 block discarded – undo
985 985
             <div class="col-md-6">
986 986
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
987 987
 <?php
988
-		$year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name);
988
+		$year_array = $Stats->countAllMarineMonthsLastYear(true, $filter_name);
989 989
 		if (count($year_array) == 0) print _("No data available");
990 990
 		else {
991 991
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
992 992
 			$year_data = '';
993 993
 			$year_cnt = '';
994
-			foreach($year_array as $year_item) {
994
+			foreach ($year_array as $year_item) {
995 995
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
996 996
 				$year_cnt .= $year_item['date_count'].',';
997 997
 			}
998 998
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
999
-			$year_cnt = "['vessels',".substr($year_cnt,0,-1)."]";
999
+			$year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]";
1000 1000
 			print 'c3.generate({
1001 1001
 			    bindto: "#chart8",
1002 1002
 			    data: { x: "x",
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
                 </div>
1011 1011
             </div>
1012 1012
             
1013
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1013
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1014 1014
             <div class="col-md-6">
1015 1015
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1016 1016
 <?php
@@ -1020,12 +1020,12 @@  discard block
 block discarded – undo
1020 1020
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1021 1021
 			$month_data = '';
1022 1022
 			$month_cnt = '';
1023
-			foreach($month_array as $month_item) {
1023
+			foreach ($month_array as $month_item) {
1024 1024
 				$month_data .= '"'.$month_item['date_name'].'",';
1025 1025
 				$month_cnt .= $month_item['date_count'].',';
1026 1026
 			}
1027 1027
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
1028
-			$month_cnt = "['vessels',".substr($month_cnt,0,-1)."]";
1028
+			$month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]";
1029 1029
 			print 'c3.generate({
1030 1030
 			    bindto: "#chart9",
1031 1031
 			    data: { x: "x",
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
                     <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1039 1039
                 </div>
1040 1040
             </div>
1041
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1041
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1042 1042
 
1043 1043
             <div class="col-md-6">
1044 1044
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -1049,12 +1049,12 @@  discard block
 block discarded – undo
1049 1049
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1050 1050
 			$date_data = '';
1051 1051
 			$date_cnt = '';
1052
-			foreach($date_array as $date_item) {
1052
+			foreach ($date_array as $date_item) {
1053 1053
 				$date_data .= '"'.$date_item['date_name'].'",';
1054 1054
 				$date_cnt .= $date_item['date_count'].',';
1055 1055
 			}
1056 1056
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
1057
-			$date_cnt = "['vessels',".substr($date_cnt,0,-1)."]";
1057
+			$date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]";
1058 1058
 			print 'c3.generate({
1059 1059
 			    bindto: "#chart5",
1060 1060
 			    data: { x: "x",
@@ -1067,22 +1067,22 @@  discard block
 block discarded – undo
1067 1067
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1068 1068
                 </div>
1069 1069
             </div>
1070
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1070
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1071 1071
             <div class="col-md-6">
1072 1072
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1073 1073
 <?php
1074
-		$hour_array = $Stats->countAllMarineHours('hour',true,$filter_name);
1074
+		$hour_array = $Stats->countAllMarineHours('hour', true, $filter_name);
1075 1075
 		if (empty($hour_array)) print _("No data available");
1076 1076
 		else {
1077 1077
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1078 1078
 			$hour_data = '';
1079 1079
 			$hour_cnt = '';
1080
-			foreach($hour_array as $hour_item) {
1080
+			foreach ($hour_array as $hour_item) {
1081 1081
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1082 1082
 				$hour_cnt .= $hour_item['hour_count'].',';
1083 1083
 			}
1084 1084
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1085
-			$hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]";
1085
+			$hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]";
1086 1086
 			print 'c3.generate({
1087 1087
 			    bindto: "#chart6",
1088 1088
 			    data: {
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
                     <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1096 1096
                 </div>
1097 1097
             </div>
1098
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1098
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1099 1099
         </div>
1100 1100
 <?php
1101 1101
 	}
@@ -1117,12 +1117,12 @@  discard block
 block discarded – undo
1117 1117
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
1118 1118
 			$year_data = '';
1119 1119
 			$year_cnt = '';
1120
-			foreach($year_array as $year_item) {
1120
+			foreach ($year_array as $year_item) {
1121 1121
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1122 1122
 				$year_cnt .= $year_item['date_count'].',';
1123 1123
 			}
1124 1124
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1125
-			$year_cnt = "['trackers',".substr($year_cnt,0,-1)."]";
1125
+			$year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]";
1126 1126
 			print 'c3.generate({
1127 1127
 			    bindto: "#chart8",
1128 1128
 			    data: { x: "x",
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
                 </div>
1137 1137
             </div>
1138 1138
             
1139
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1139
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1140 1140
             <div class="col-md-6">
1141 1141
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1142 1142
 <?php
@@ -1146,12 +1146,12 @@  discard block
 block discarded – undo
1146 1146
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1147 1147
 			$month_data = '';
1148 1148
 			$month_cnt = '';
1149
-			foreach($month_array as $month_item) {
1149
+			foreach ($month_array as $month_item) {
1150 1150
 				$month_data .= '"'.$month_item['date_name'].'",';
1151 1151
 				$month_cnt .= $month_item['date_count'].',';
1152 1152
 			}
1153 1153
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
1154
-			$month_cnt = "['trackers',".substr($month_cnt,0,-1)."]";
1154
+			$month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]";
1155 1155
 			print 'c3.generate({
1156 1156
 			    bindto: "#chart9",
1157 1157
 			    data: { x: "x",
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                     <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1165 1165
                 </div>
1166 1166
             </div>
1167
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1167
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1168 1168
 
1169 1169
             <div class="col-md-6">
1170 1170
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -1175,12 +1175,12 @@  discard block
 block discarded – undo
1175 1175
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1176 1176
 			$date_data = '';
1177 1177
 			$date_cnt = '';
1178
-			foreach($date_array as $date_item) {
1178
+			foreach ($date_array as $date_item) {
1179 1179
 				$date_data .= '"'.$date_item['date_name'].'",';
1180 1180
 				$date_cnt .= $date_item['date_count'].',';
1181 1181
 			}
1182 1182
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
1183
-			$date_cnt = "['trackers',".substr($date_cnt,0,-1)."]";
1183
+			$date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]";
1184 1184
 			print 'c3.generate({
1185 1185
 			    bindto: "#chart5",
1186 1186
 			    data: { x: "x",
@@ -1193,22 +1193,22 @@  discard block
 block discarded – undo
1193 1193
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1194 1194
                 </div>
1195 1195
             </div>
1196
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1196
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1197 1197
             <div class="col-md-6">
1198 1198
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1199 1199
 <?php
1200
-		$hour_array = $Stats->countAllTrackerHours('hour',true);
1200
+		$hour_array = $Stats->countAllTrackerHours('hour', true);
1201 1201
 		if (empty($hour_array)) print _("No data available");
1202 1202
 		else {
1203 1203
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1204 1204
 			$hour_data = '';
1205 1205
 			$hour_cnt = '';
1206
-			foreach($hour_array as $hour_item) {
1206
+			foreach ($hour_array as $hour_item) {
1207 1207
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1208 1208
 				$hour_cnt .= $hour_item['hour_count'].',';
1209 1209
 			}
1210 1210
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1211
-			$hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]";
1211
+			$hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]";
1212 1212
 			print 'c3.generate({
1213 1213
 			    bindto: "#chart6",
1214 1214
 			    data: {
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
                     <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1222 1222
                 </div>
1223 1223
             </div>
1224
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1224
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1225 1225
         </div>
1226 1226
 <?php
1227 1227
 	}
@@ -1243,12 +1243,12 @@  discard block
 block discarded – undo
1243 1243
 			print '<div id="chart21" class="chart" width="100%"></div><script>';
1244 1244
 			$year_data = '';
1245 1245
 			$year_cnt = '';
1246
-			foreach($year_array as $year_item) {
1246
+			foreach ($year_array as $year_item) {
1247 1247
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1248 1248
 				$year_cnt .= $year_item['date_count'].',';
1249 1249
 			}
1250 1250
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1251
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1251
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1252 1252
 			print 'c3.generate({
1253 1253
 			    bindto: "#chart21",
1254 1254
 			    data: { x: "x",
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
             -->
1265 1265
             </div>
1266 1266
             
1267
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1267
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1268 1268
             <div class="col-md-6">
1269 1269
                 <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2>
1270 1270
 <?php
@@ -1274,12 +1274,12 @@  discard block
 block discarded – undo
1274 1274
 			print '<div id="chart22" class="chart" width="100%"></div><script>';
1275 1275
 			$year_data = '';
1276 1276
 			$year_cnt = '';
1277
-			foreach($year_array as $year_item) {
1277
+			foreach ($year_array as $year_item) {
1278 1278
 				$year_data .= '"'.$year_item['year_name'].'-01-01'.'",';
1279 1279
 				$year_cnt .= $year_item['date_count'].',';
1280 1280
 			}
1281 1281
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1282
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1282
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1283 1283
 			print 'c3.generate({
1284 1284
 			    bindto: "#chart22",
1285 1285
 			    data: { x: "x",
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
             -->
1296 1296
             </div>
1297 1297
             
1298
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1298
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1299 1299
         </div>
1300 1300
 <?php
1301 1301
 	}
@@ -1317,12 +1317,12 @@  discard block
 block discarded – undo
1317 1317
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1318 1318
 			$year_data = '';
1319 1319
 			$year_cnt = '';
1320
-			foreach($year_array as $year_item) {
1320
+			foreach ($year_array as $year_item) {
1321 1321
 				$year_data .= '"'.$year_item['year'].'-01-01",';
1322 1322
 				$year_cnt .= $year_item['count'].',';
1323 1323
 			}
1324 1324
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1325
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1325
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1326 1326
 			print 'c3.generate({
1327 1327
 			    bindto: "#chart32",
1328 1328
 			    data: { x: "x",
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1336 1336
                 </div>
1337 1337
             </div>
1338
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1338
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1339 1339
 
1340 1340
         <div class="row column">
1341 1341
             <div class="col-md-6">
@@ -1347,12 +1347,12 @@  discard block
 block discarded – undo
1347 1347
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1348 1348
 			$year_data = '';
1349 1349
 			$year_cnt = '';
1350
-			foreach($year_array as $year_item) {
1350
+			foreach ($year_array as $year_item) {
1351 1351
 				$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
1352 1352
 				$year_cnt .= $year_item['count'].',';
1353 1353
 			}
1354 1354
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1355
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1355
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1356 1356
 			print 'c3.generate({
1357 1357
 			    bindto: "#chart33",
1358 1358
 			    data: { x: "x",
@@ -1365,7 +1365,7 @@  discard block
 block discarded – undo
1365 1365
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1366 1366
                 </div>
1367 1367
             </div>
1368
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1368
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1369 1369
 <br/>
1370 1370
 <?php
1371 1371
 	}
@@ -1379,19 +1379,19 @@  discard block
 block discarded – undo
1379 1379
 	//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
1380 1380
 	if ($year == '' && $month == '') {
1381 1381
 		if ($type == 'aircraft') {
1382
-			$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
1382
+			$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
1383 1383
 		} elseif ($type == 'marine') {
1384
-			$polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d'));
1384
+			$polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d'));
1385 1385
 		} elseif ($type == 'tracker') {
1386
-			$polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d'));
1386
+			$polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d'));
1387 1387
 		}
1388 1388
 	} else {
1389 1389
 		if ($type == 'aircraft') {
1390
-			$polar = $Stats->getStatsSource('polar',$year,$month);
1390
+			$polar = $Stats->getStatsSource('polar', $year, $month);
1391 1391
 		} elseif ($type == 'marine') {
1392
-			$polar = $Stats->getStatsSource('polar_marine',$year,$month);
1392
+			$polar = $Stats->getStatsSource('polar_marine', $year, $month);
1393 1393
 		} elseif ($type == 'tracker') {
1394
-			$polar = $Stats->getStatsSource('polar_tracker',$year,$month);
1394
+			$polar = $Stats->getStatsSource('polar_tracker', $year, $month);
1395 1395
 		}
1396 1396
 	}
1397 1397
 	if (!empty($polar)) {
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 			unset($polar_data);
1401 1401
 			$Spotter = new Spotter();
1402 1402
 			$data = json_decode($eachpolar['source_data']);
1403
-			foreach($data as $value => $key) {
1403
+			foreach ($data as $value => $key) {
1404 1404
 				$direction = $Spotter->parseDirection(($value*22.5));
1405 1405
 				$distance = $key;
1406 1406
 				$unit = 'km';
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 ?>
1421 1421
             <div class="col-md-6">
1422 1422
                 <h4><?php print $eachpolar['source_name']; ?></h4>
1423
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1423
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1424 1424
         	<script>
1425 1425
         	    (function() {
1426 1426
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 		      color: color,
1445 1445
 		      unit: '<?php echo $unit; ?>'
1446 1446
 		    };
1447
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1447
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1448 1448
 		    })();
1449 1449
 		</script>
1450 1450
             </div>
@@ -1459,19 +1459,19 @@  discard block
 block discarded – undo
1459 1459
 	//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
1460 1460
 	if ($year == '' && $month == '') {
1461 1461
 		if ($type == 'aircraft') {
1462
-			$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
1462
+			$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
1463 1463
 		} elseif ($type == 'marine') {
1464
-			$msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d'));
1464
+			$msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d'));
1465 1465
 		} elseif ($type == 'tracker') {
1466
-			$msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d'));
1466
+			$msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d'));
1467 1467
 		}
1468 1468
 	} else {
1469 1469
 		if ($type == 'aircraft') {
1470
-			$msg = $Stats->getStatsSource('msg',$year,$month);
1470
+			$msg = $Stats->getStatsSource('msg', $year, $month);
1471 1471
 		} elseif ($type == 'marine') {
1472
-			$msg = $Stats->getStatsSource('msg_marine',$year,$month);
1472
+			$msg = $Stats->getStatsSource('msg_marine', $year, $month);
1473 1473
 		} elseif ($type == 'tracker') {
1474
-			$msg = $Stats->getStatsSource('msg_tracker',$year,$month);
1474
+			$msg = $Stats->getStatsSource('msg_tracker', $year, $month);
1475 1475
 		}
1476 1476
 	}
1477 1477
 	if (!empty($msg)) {
@@ -1479,13 +1479,13 @@  discard block
 block discarded – undo
1479 1479
 		foreach ($msg as $eachmsg) {
1480 1480
 			//$eachmsg = $msg[0];
1481 1481
 			$data = $eachmsg['source_data'];
1482
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1482
+			if ($data > 500) $max = (round(($data + 100)/100))*100;
1483 1483
 			else $max = 500;
1484 1484
 ?>
1485
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1485
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1486 1486
         	<script>
1487 1487
 		      var g = new JustGage({
1488
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
1488
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
1489 1489
 			    value: <?php echo $data; ?>,
1490 1490
 			    min: 0,
1491 1491
 			    max: <?php print $max; ?>,
@@ -1507,19 +1507,19 @@  discard block
 block discarded – undo
1507 1507
 	//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
1508 1508
 	if ($year == '' && $month == '') {
1509 1509
 		if ($type == 'aircraft') {
1510
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
1510
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
1511 1511
 		} elseif ($type == 'marine') {
1512
-			$hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d'));
1512
+			$hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d'));
1513 1513
 		} elseif ($type == 'tracker') {
1514
-			$hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d'));
1514
+			$hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d'));
1515 1515
 		}
1516 1516
 	} else {
1517 1517
 		if ($type == 'aircraft') {
1518
-			$hist = $Stats->getStatsSource('hist',$year,$month);
1518
+			$hist = $Stats->getStatsSource('hist', $year, $month);
1519 1519
 		} elseif ($type == 'marine') {
1520
-			$hist = $Stats->getStatsSource('hist_marine',$year,$month);
1520
+			$hist = $Stats->getStatsSource('hist_marine', $year, $month);
1521 1521
 		} elseif ($type == 'tracker') {
1522
-			$hist = $Stats->getStatsSource('hist_tracker',$year,$month);
1522
+			$hist = $Stats->getStatsSource('hist_tracker', $year, $month);
1523 1523
 		}
1524 1524
 	}
1525 1525
 	foreach ($hist as $hists) {
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 		$source = $hists['source_name'];
1530 1530
 		$hist_array = json_decode($hists['source_data']);
1531 1531
 		$unit = 'km';
1532
-		foreach($hist_array as $distance => $nb) {
1532
+		foreach ($hist_array as $distance => $nb) {
1533 1533
 			if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1534 1534
 				$distance = round($distance*0.539957);
1535 1535
 				$unit = 'nm';
@@ -1549,18 +1549,18 @@  discard block
 block discarded – undo
1549 1549
 		$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
1550 1550
 ?>
1551 1551
             <div class="col-md-6">
1552
-                <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2>
1552
+                <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2>
1553 1553
 <?php
1554
-		print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
1554
+		print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
1555 1555
 		print 'c3.generate({
1556
-		    bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
1556
+		    bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
1557 1557
 		    data: { x: "x",
1558 1558
 		    columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1559 1559
 		    axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
1560 1560
 		print '</script>';
1561 1561
 ?>
1562 1562
     	    </div>
1563
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1563
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1564 1564
 <?php
1565 1565
 	}
1566 1566
 ?>
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -267,16 +267,16 @@  discard block
 block discarded – undo
267 267
                 <div class="more">
268 268
             	    <?php
269 269
             	    
270
-            		if ($year != '' && $month != '') {
271
-            	    ?>
270
+					if ($year != '' && $month != '') {
271
+					?>
272 272
             	    <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>
273 273
             	    <?php
274
-            		} else {
275
-            	    ?>
274
+					} else {
275
+					?>
276 276
             	    <a href="<?php print $globalURL; ?>/marine/statistics/type" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
277 277
             	    <?php
278
-            		}
279
-            	    ?>
278
+					}
279
+					?>
280 280
                 </div>
281 281
             </div>
282 282
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -308,16 +308,16 @@  discard block
 block discarded – undo
308 308
 ?>
309 309
                 <div class="more">
310 310
             	    <?php
311
-            		if ($year != '' && $month != '') {
312
-            	    ?>
311
+					if ($year != '' && $month != '') {
312
+					?>
313 313
             	    <a href="<?php print $globalURL; ?>/marine/statistics/race/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
314 314
             	    <?php
315
-            		} else {
316
-            	    ?>
315
+					} else {
316
+					?>
317 317
             	    <a href="<?php print $globalURL; ?>/marine/statistics/race" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
318 318
             	    <?php
319
-            		}
320
-            	    ?>
319
+					}
320
+					?>
321 321
                 </div>
322 322
             </div>
323 323
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 ?>
355 355
                 <div class="more">
356 356
             	    <?php
357
-            	    /*
357
+					/*
358 358
             		if ($year != '' && $month != '') {
359 359
             	    ?>
360 360
             	    <a href="<?php print $globalURL; ?>/tracker/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             	    <?php
366 366
             		}
367 367
             		*/
368
-            	    ?>
368
+					?>
369 369
                 </div>
370 370
             </div>
371 371
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
Please login to merge, or discard this patch.
require/class.MarineLive.php 3 patches
Braces   +158 added lines, -53 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 	public function __construct($dbc = null) {
16 16
 		$Connection = new Connection($dbc);
17 17
 		$this->db = $Connection->db();
18
-		if ($this->db === null) die('Error: No DB connection. (MarineLive)');
18
+		if ($this->db === null) {
19
+			die('Error: No DB connection. (MarineLive)');
20
+		}
19 21
 	}
20 22
 
21 23
 
@@ -37,7 +39,9 @@  discard block
 block discarded – undo
37 39
 		if (isset($filter[0]['source'])) {
38 40
 			$filters = array_merge($filters,$filter);
39 41
 		}
40
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
42
+		if (is_array($globalFilter)) {
43
+			$filter = array_merge($filter,$globalFilter);
44
+		}
41 45
 		$filter_query_join = '';
42 46
 		$filter_query_where = '';
43 47
 		foreach($filters as $flt) {
@@ -93,8 +97,11 @@  discard block
 block discarded – undo
93 97
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
94 98
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
95 99
 		}
96
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
97
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
100
+		if ($filter_query_where == '' && $where) {
101
+			$filter_query_where = ' WHERE';
102
+		} elseif ($filter_query_where != '' && $and) {
103
+			$filter_query_where .= ' AND';
104
+		}
98 105
 		if ($filter_query_where != '') {
99 106
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
100 107
 		}
@@ -135,9 +142,13 @@  discard block
 block discarded – undo
135 142
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
136 143
 			}
137 144
 		}
138
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
145
+		if ($orderby_query == '') {
146
+			$orderby_query= ' ORDER BY date DESC';
147
+		}
139 148
 
140
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
149
+		if (!isset($globalLiveInterval)) {
150
+			$globalLiveInterval = '200';
151
+		}
141 152
 		if ($globalDBdriver == 'mysql') {
142 153
 			//$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate";
143 154
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -162,7 +173,9 @@  discard block
 block discarded – undo
162 173
 
163 174
 		$filter_query = $this->getFilter($filter,true,true);
164 175
 
165
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
176
+		if (!isset($globalLiveInterval)) {
177
+			$globalLiveInterval = '200';
178
+		}
166 179
 		if ($globalDBdriver == 'mysql') {
167 180
 			$query  = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
168 181
 			FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY marine_live.race_rank";
@@ -204,58 +217,96 @@  discard block
 block discarded – undo
204 217
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
205 218
 		$filter_query = $this->getFilter($filter,true,true);
206 219
 
207
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
208
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
220
+		if (!isset($globalLiveInterval)) {
221
+			$globalLiveInterval = '200';
222
+		}
223
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
224
+			$globalMap3DMarinesLimit = '300';
225
+		}
209 226
 		if ($globalDBdriver == 'mysql') {
210 227
 			if (isset($globalArchive) && $globalArchive === TRUE) {
211 228
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
212 229
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
213
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
214
-				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
230
+				if ($usecoord) {
231
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
232
+				}
233
+				if ($id != '') {
234
+					$query .= "OR marine_archive.fammarine_id = :id ";
235
+				}
215 236
 				$query .= "UNION
216 237
 				    SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
217 238
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
218
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
219
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
239
+				if ($usecoord) {
240
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
241
+				}
242
+				if ($id != '') {
243
+					$query .= "OR marine_live.fammarine_id = :id ";
244
+				}
220 245
 				$query .= ") AS marine 
221 246
 				    WHERE latitude <> '0' AND longitude <> '0' 
222 247
 				    ORDER BY fammarine_id, date";
223
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
248
+				if ($limit) {
249
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
250
+				}
224 251
 			} else {
225 252
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
226 253
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
227
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
228
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
254
+				if ($usecoord) {
255
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
256
+				}
257
+				if ($id != '') {
258
+					$query .= "OR marine_live.fammarine_id = :id ";
259
+				}
229 260
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
230 261
 				ORDER BY marine_live.fammarine_id, marine_live.date";
231
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
262
+				if ($limit) {
263
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
264
+				}
232 265
 			}
233 266
 		} else {
234 267
 			if (isset($globalArchive) && $globalArchive === TRUE) {
235 268
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
236 269
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
237
-				if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
238
-				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
270
+				if ($usecoord) {
271
+					$query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
272
+				}
273
+				if ($id != '') {
274
+					$query .= "OR marine_archive.fammarine_id = :id ";
275
+				}
239 276
 				$query .= "UNION
240 277
 				    SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
241 278
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
242
-				if ($usecoord) $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
243
-				if ($id != '') $query .= " OR marine_live.fammarine_id = :id";
279
+				if ($usecoord) {
280
+					$query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
281
+				}
282
+				if ($id != '') {
283
+					$query .= " OR marine_live.fammarine_id = :id";
284
+				}
244 285
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
245 286
 				$query .= "ORDER BY fammarine_id, date";
246
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
287
+				if ($limit) {
288
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
289
+				}
247 290
 			} else {
248 291
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
249 292
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
250
-				if ($usecoord) $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
251
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
293
+				if ($usecoord) {
294
+					$query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
295
+				}
296
+				if ($id != '') {
297
+					$query .= "OR marine_live.fammarine_id = :id ";
298
+				}
252 299
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
253 300
 				ORDER BY marine_live.fammarine_id, marine_live.date";
254
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
301
+				if ($limit) {
302
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
303
+				}
255 304
 			}
256 305
 		}
257 306
 		$query_values = array();
258
-		if ($id != '') $query_values = array(':id' => $id);
307
+		if ($id != '') {
308
+			$query_values = array(':id' => $id);
309
+		}
259 310
 		try {
260 311
 			$sth = $this->db->prepare($query);
261 312
 			$sth->execute($query_values);
@@ -280,8 +331,12 @@  discard block
 block discarded – undo
280 331
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
281 332
 		$filter_query = $this->getFilter($filter,true,true);
282 333
 
283
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
284
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
334
+		if (!isset($globalLiveInterval)) {
335
+			$globalLiveInterval = '200';
336
+		}
337
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
338
+			$globalMap3DMarinesLimit = '300';
339
+		}
285 340
 		if ($globalDBdriver == 'mysql') {
286 341
 			if (isset($globalArchive) && $globalArchive === TRUE) {
287 342
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
@@ -292,13 +347,17 @@  discard block
 block discarded – undo
292 347
 				$query .= ") AS marine 
293 348
 				    WHERE latitude <> '0' AND longitude <> '0' 
294 349
 				    ORDER BY fammarine_id, date";
295
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
350
+				if ($limit) {
351
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
352
+				}
296 353
 			} else {
297 354
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
298 355
 				    FROM marine_live'.$filter_query.' marine_live.fammarine_id = :id ';
299 356
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
300 357
 				ORDER BY marine_live.fammarine_id, marine_live.date";
301
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
358
+				if ($limit) {
359
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
360
+				}
302 361
 			}
303 362
 		} else {
304 363
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -310,13 +369,17 @@  discard block
 block discarded – undo
310 369
 				$query .= ") AS marine 
311 370
 				    WHERE latitude <> '0' AND longitude <> '0' 
312 371
 				    ORDER BY fammarine_id, date";
313
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
372
+				if ($limit) {
373
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
374
+				}
314 375
 			} else {
315 376
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
316 377
 				    FROM marine_live".$filter_query." marine_live.fammarine_id = :id ";
317 378
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
318 379
 				ORDER BY marine_live.fammarine_id, marine_live.date";
319
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
380
+				if ($limit) {
381
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
382
+				}
320 383
 			}
321 384
 		}
322 385
 		$query_values = array(':id' => $id);
@@ -342,7 +405,9 @@  discard block
 block discarded – undo
342 405
 		global $globalDBdriver, $globalLiveInterval;
343 406
 		$filter_query = $this->getFilter($filter,true,true);
344 407
 
345
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
408
+		if (!isset($globalLiveInterval)) {
409
+			$globalLiveInterval = '200';
410
+		}
346 411
 		if ($globalDBdriver == 'mysql') {
347 412
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
348 413
 		} else {
@@ -370,7 +435,9 @@  discard block
 block discarded – undo
370 435
 	{
371 436
 		global $globalDBdriver, $globalLiveInterval;
372 437
 		$Marine = new Marine($this->db);
373
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
438
+		if (!isset($globalLiveInterval)) {
439
+			$globalLiveInterval = '200';
440
+		}
374 441
 		$filter_query = $this->getFilter($filter);
375 442
 
376 443
 		if (is_array($coord)) {
@@ -378,7 +445,9 @@  discard block
 block discarded – undo
378 445
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
379 446
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
380 447
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
381
-		} else return array();
448
+		} else {
449
+			return array();
450
+		}
382 451
 		if ($globalDBdriver == 'mysql') {
383 452
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query;
384 453
 		} else {
@@ -398,7 +467,9 @@  discard block
 block discarded – undo
398 467
 	{
399 468
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
400 469
 		$Marine = new Marine($this->db);
401
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
470
+		if (!isset($globalLiveInterval)) {
471
+			$globalLiveInterval = '200';
472
+		}
402 473
 		$filter_query = $this->getFilter($filter,true,true);
403 474
 
404 475
 		if (is_array($coord)) {
@@ -406,7 +477,9 @@  discard block
 block discarded – undo
406 477
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
407 478
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
408 479
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
409
-		} else return array();
480
+		} else {
481
+			return array();
482
+		}
410 483
 		/*
411 484
 		if ($globalDBdriver == 'mysql') {
412 485
 			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
@@ -629,11 +702,15 @@  discard block
 block discarded – undo
629 702
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
630 703
 		if ($globalDBdriver == 'mysql') {
631 704
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
632
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
705
+			if ($liveinterval) {
706
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
707
+			}
633 708
 			$query .= ' ORDER BY date';
634 709
 		} else {
635 710
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
636
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
711
+			if ($liveinterval) {
712
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
713
+			}
637 714
 			$query .= ' ORDER BY date';
638 715
 		}
639 716
 
@@ -728,7 +805,9 @@  discard block
 block discarded – undo
728 805
 				$i++;
729 806
 				$j++;
730 807
 				if ($j == 30) {
731
-					if ($globalDebug) echo ".";
808
+					if ($globalDebug) {
809
+						echo ".";
810
+					}
732 811
 				    	try {
733 812
 						
734 813
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -1022,7 +1101,9 @@  discard block
 block discarded – undo
1022 1101
 			{
1023 1102
 				return false;
1024 1103
 			}
1025
-		} else return '';
1104
+		} else {
1105
+			return '';
1106
+		}
1026 1107
 
1027 1108
 		if ($longitude != '')
1028 1109
 		{
@@ -1030,7 +1111,9 @@  discard block
 block discarded – undo
1030 1111
 			{
1031 1112
 				return false;
1032 1113
 			}
1033
-		} else return '';
1114
+		} else {
1115
+			return '';
1116
+		}
1034 1117
 
1035 1118
 
1036 1119
 		if ($heading != '')
@@ -1039,7 +1122,9 @@  discard block
 block discarded – undo
1039 1122
 			{
1040 1123
 				return false;
1041 1124
 			}
1042
-		} else $heading = 0;
1125
+		} else {
1126
+			$heading = 0;
1127
+		}
1043 1128
 
1044 1129
 		if ($groundspeed != '')
1045 1130
 		{
@@ -1047,9 +1132,13 @@  discard block
 block discarded – undo
1047 1132
 			{
1048 1133
 				return false;
1049 1134
 			}
1050
-		} else $groundspeed = 0;
1135
+		} else {
1136
+			$groundspeed = 0;
1137
+		}
1051 1138
 		date_default_timezone_set('UTC');
1052
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1139
+		if ($date == '') {
1140
+			$date = date("Y-m-d H:i:s", time());
1141
+		}
1053 1142
 
1054 1143
         
1055 1144
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1077,16 +1166,28 @@  discard block
 block discarded – undo
1077 1166
 		$race_name = filter_var($race_name,FILTER_SANITIZE_STRING);
1078 1167
 		$race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT);
1079 1168
 		$race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1080
-		if ($typeid == '') $typeid = NULL;
1081
-		if ($statusid == '') $statusid = NULL;
1082
-		if ($distance == '') $distance = NULL;
1169
+		if ($typeid == '') {
1170
+			$typeid = NULL;
1171
+		}
1172
+		if ($statusid == '') {
1173
+			$statusid = NULL;
1174
+		}
1175
+		if ($distance == '') {
1176
+			$distance = NULL;
1177
+		}
1083 1178
 
1084 1179
             	//if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1085
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1086
-            	if ($arrival_date == '') $arrival_date = NULL;
1180
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1181
+            		$heading = 0;
1182
+            	}
1183
+            	if ($arrival_date == '') {
1184
+            		$arrival_date = NULL;
1185
+            	}
1087 1186
             	$query = '';
1088 1187
 		if ($globalArchive) {
1089
-			if ($globalDebug) echo '-- Delete previous data -- ';
1188
+			if ($globalDebug) {
1189
+				echo '-- Delete previous data -- ';
1190
+			}
1090 1191
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
1091 1192
 		}
1092 1193
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) 
@@ -1101,10 +1202,14 @@  discard block
 block discarded – undo
1101 1202
 		}
1102 1203
 		
1103 1204
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1104
-			if ($globalDebug) echo '(Add to Marine archive : ';
1205
+			if ($globalDebug) {
1206
+				echo '(Add to Marine archive : ';
1207
+			}
1105 1208
 			$MarineArchive = new MarineArchive($this->db);
1106 1209
 			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time);
1107
-			if ($globalDebug) echo $result.')';
1210
+			if ($globalDebug) {
1211
+				echo $result.')';
1212
+			}
1108 1213
 		}
1109 1214
 		return "success";
1110 1215
 	}
Please login to merge, or discard this patch.
Indentation   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 
23
-    /**
24
-     * Get SQL query part for filter used
25
-     * @param array $filter the filter
26
-     * @param bool $where
27
-     * @param bool $and
28
-     * @return string the SQL part
29
-     */
23
+	/**
24
+	 * Get SQL query part for filter used
25
+	 * @param array $filter the filter
26
+	 * @param bool $where
27
+	 * @param bool $and
28
+	 * @return string the SQL part
29
+	 */
30 30
 	public function getFilter($filter = array(),$where = false,$and = false) {
31 31
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
32 32
 		$filters = array();
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 		return $filter_query;
106 106
 	}
107 107
 
108
-    /**
109
-     * Gets all the spotter information based on the latest data entry
110
-     *
111
-     * @param string $limit
112
-     * @param string $sort
113
-     * @param array $filter
114
-     * @return array the spotter information
115
-     */
108
+	/**
109
+	 * Gets all the spotter information based on the latest data entry
110
+	 *
111
+	 * @param string $limit
112
+	 * @param string $sort
113
+	 * @param array $filter
114
+	 * @return array the spotter information
115
+	 */
116 116
 	public function getLiveMarineData($limit = '', $sort = '', $filter = array())
117 117
 	{
118 118
 		global $globalDBdriver, $globalLiveInterval;
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 		return $spotter_array;
155 155
 	}
156 156
 
157
-    /**
158
-     * Gets Minimal Live Spotter data
159
-     *
160
-     * @param array $filter
161
-     * @return array the spotter information
162
-     */
157
+	/**
158
+	 * Gets Minimal Live Spotter data
159
+	 *
160
+	 * @param array $filter
161
+	 * @return array the spotter information
162
+	 */
163 163
 	public function getMinLiveMarineData($filter = array())
164 164
 	{
165 165
 		global $globalDBdriver, $globalLiveInterval;
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
 		return $spotter_array;
189 189
 	}
190 190
 
191
-    /**
192
-     * Gets Minimal Live Spotter data since xx seconds
193
-     *
194
-     * @param array $coord
195
-     * @param array $filter
196
-     * @param bool $limit
197
-     * @param string $id
198
-     * @return array the spotter information
199
-     */
191
+	/**
192
+	 * Gets Minimal Live Spotter data since xx seconds
193
+	 *
194
+	 * @param array $coord
195
+	 * @param array $filter
196
+	 * @param bool $limit
197
+	 * @param string $id
198
+	 * @return array the spotter information
199
+	 */
200 200
 	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '')
201 201
 	{
202 202
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
@@ -275,14 +275,14 @@  discard block
 block discarded – undo
275 275
 		return $spotter_array;
276 276
 	}
277 277
 
278
-    /**
279
-     * Gets Minimal Live Spotter data since xx seconds
280
-     *
281
-     * @param string $id
282
-     * @param array $filter
283
-     * @param bool $limit
284
-     * @return array the spotter information
285
-     */
278
+	/**
279
+	 * Gets Minimal Live Spotter data since xx seconds
280
+	 *
281
+	 * @param string $id
282
+	 * @param array $filter
283
+	 * @param bool $limit
284
+	 * @return array the spotter information
285
+	 */
286 286
 	public function getMinLastLiveMarineDataByID($id = '',$filter = array(), $limit = false)
287 287
 	{
288 288
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 		return $spotter_array;
342 342
 	}
343 343
 
344
-    /**
345
-     * Gets number of latest data entry
346
-     *
347
-     * @param array $filter
348
-     * @return String number of entry
349
-     */
344
+	/**
345
+	 * Gets number of latest data entry
346
+	 *
347
+	 * @param array $filter
348
+	 * @return String number of entry
349
+	 */
350 350
 	public function getLiveMarineCount($filter = array())
351 351
 	{
352 352
 		global $globalDBdriver, $globalLiveInterval;
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
 		return $result['nb'];
371 371
 	}
372 372
 
373
-    /**
374
-     * Gets all the spotter information based on the latest data entry and coord
375
-     *
376
-     * @param $coord
377
-     * @param array $filter
378
-     * @return array the spotter information
379
-     */
373
+	/**
374
+	 * Gets all the spotter information based on the latest data entry and coord
375
+	 *
376
+	 * @param $coord
377
+	 * @param array $filter
378
+	 * @return array the spotter information
379
+	 */
380 380
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
381 381
 	{
382 382
 		global $globalDBdriver, $globalLiveInterval;
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 		return $spotter_array;
400 400
 	}
401 401
 
402
-    /**
403
-     * Gets all the spotter information based on the latest data entry and coord
404
-     *
405
-     * @param $coord
406
-     * @param array $filter
407
-     * @return array the spotter information
408
-     */
402
+	/**
403
+	 * Gets all the spotter information based on the latest data entry and coord
404
+	 *
405
+	 * @param $coord
406
+	 * @param array $filter
407
+	 * @return array the spotter information
408
+	 */
409 409
 	public function getMinLiveMarineDatabyCoord($coord, $filter = array())
410 410
 	{
411 411
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -473,15 +473,15 @@  discard block
 block discarded – undo
473 473
 		return $spotter_array;
474 474
 	}
475 475
 
476
-    /**
477
-     * Gets all the spotter information based on a user's latitude and longitude
478
-     *
479
-     * @param $lat
480
-     * @param $lng
481
-     * @param $radius
482
-     * @param $interval
483
-     * @return array the spotter information
484
-     */
476
+	/**
477
+	 * Gets all the spotter information based on a user's latitude and longitude
478
+	 *
479
+	 * @param $lat
480
+	 * @param $lng
481
+	 * @param $radius
482
+	 * @param $interval
483
+	 * @return array the spotter information
484
+	 */
485 485
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
486 486
 	{
487 487
 		$Marine = new Marine($this->db);
@@ -538,32 +538,32 @@  discard block
 block discarded – undo
538 538
 	}
539 539
 
540 540
 
541
-    /**
542
-     * Gets all the spotter information based on a particular callsign
543
-     *
544
-     * @param $ident
545
-     * @return array the spotter information
546
-     */
541
+	/**
542
+	 * Gets all the spotter information based on a particular callsign
543
+	 *
544
+	 * @param $ident
545
+	 * @return array the spotter information
546
+	 */
547 547
 	public function getLastLiveMarineDataByIdent($ident)
548 548
 	{
549 549
 		$Marine = new Marine($this->db);
550 550
 		date_default_timezone_set('UTC');
551 551
 
552 552
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
553
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
553
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
554 554
 
555 555
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
556 556
 
557 557
 		return $spotter_array;
558 558
 	}
559 559
 
560
-    /**
561
-     * Gets all the spotter information based on a particular callsign
562
-     *
563
-     * @param $ident
564
-     * @param $date
565
-     * @return array the spotter information
566
-     */
560
+	/**
561
+	 * Gets all the spotter information based on a particular callsign
562
+	 *
563
+	 * @param $ident
564
+	 * @param $date
565
+	 * @return array the spotter information
566
+	 */
567 567
 	public function getDateLiveMarineDataByIdent($ident,$date)
568 568
 	{
569 569
 		$Marine = new Marine($this->db);
@@ -575,13 +575,13 @@  discard block
 block discarded – undo
575 575
 		return $spotter_array;
576 576
 	}
577 577
 
578
-    /**
579
-     * Gets all the spotter information based on a particular MMSI
580
-     *
581
-     * @param $mmsi
582
-     * @param $date
583
-     * @return array the spotter information
584
-     */
578
+	/**
579
+	 * Gets all the spotter information based on a particular MMSI
580
+	 *
581
+	 * @param $mmsi
582
+	 * @param $date
583
+	 * @return array the spotter information
584
+	 */
585 585
 	public function getDateLiveMarineDataByMMSI($mmsi,$date)
586 586
 	{
587 587
 		$Marine = new Marine($this->db);
@@ -593,53 +593,53 @@  discard block
 block discarded – undo
593 593
 		return $spotter_array;
594 594
 	}
595 595
 
596
-    /**
597
-     * Gets last spotter information based on a particular callsign
598
-     *
599
-     * @param $id
600
-     * @return array the spotter information
601
-     */
596
+	/**
597
+	 * Gets last spotter information based on a particular callsign
598
+	 *
599
+	 * @param $id
600
+	 * @return array the spotter information
601
+	 */
602 602
 	public function getLastLiveMarineDataById($id)
603 603
 	{
604 604
 		$Marine = new Marine($this->db);
605 605
 		date_default_timezone_set('UTC');
606 606
 
607 607
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
608
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
608
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
609 609
 
610 610
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
611 611
 
612 612
 		return $spotter_array;
613 613
 	}
614 614
 
615
-    /**
616
-     * Gets last spotter information based on a particular callsign
617
-     *
618
-     * @param $id
619
-     * @param $date
620
-     * @return array the spotter information
621
-     */
615
+	/**
616
+	 * Gets last spotter information based on a particular callsign
617
+	 *
618
+	 * @param $id
619
+	 * @param $date
620
+	 * @return array the spotter information
621
+	 */
622 622
 	public function getDateLiveMarineDataById($id,$date)
623 623
 	{
624 624
 		$Marine = new Marine($this->db);
625 625
 		date_default_timezone_set('UTC');
626 626
 
627 627
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
628
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
629
-                $date = date('c',$date);
628
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
629
+				$date = date('c',$date);
630 630
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
631 631
 
632 632
 		return $spotter_array;
633 633
 	}
634 634
 
635 635
 
636
-    /**
637
-     * Gets all the spotter information based on a particular id
638
-     *
639
-     * @param $id
640
-     * @param bool $liveinterval
641
-     * @return array the spotter information
642
-     */
636
+	/**
637
+	 * Gets all the spotter information based on a particular id
638
+	 *
639
+	 * @param $id
640
+	 * @param bool $liveinterval
641
+	 * @return array the spotter information
642
+	 */
643 643
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
644 644
 	{
645 645
 		global $globalDBdriver, $globalLiveInterval;
@@ -667,18 +667,18 @@  discard block
 block discarded – undo
667 667
 		return $spotter_array;
668 668
 	}
669 669
 
670
-    /**
671
-     * Gets all the spotter information based on a particular ident
672
-     *
673
-     * @param $ident
674
-     * @return array the spotter information
675
-     */
670
+	/**
671
+	 * Gets all the spotter information based on a particular ident
672
+	 *
673
+	 * @param $ident
674
+	 * @return array the spotter information
675
+	 */
676 676
 	public function getAllLiveMarineDataByIdent($ident)
677 677
 	{
678 678
 		date_default_timezone_set('UTC');
679 679
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
680 680
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
681
-    		try {
681
+			try {
682 682
 			
683 683
 			$sth = $this->db->prepare($query);
684 684
 			$sth->execute(array(':ident' => $ident));
@@ -692,23 +692,23 @@  discard block
 block discarded – undo
692 692
 
693 693
 
694 694
 	/**
695
-	* Deletes all info in the table
696
-	*
697
-	* @return String success or false
698
-	*
699
-	*/
695
+	 * Deletes all info in the table
696
+	 *
697
+	 * @return String success or false
698
+	 *
699
+	 */
700 700
 	public function deleteLiveMarineData()
701 701
 	{
702 702
 		global $globalDBdriver;
703 703
 		if ($globalDBdriver == 'mysql') {
704 704
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
705 705
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
706
-            		//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
706
+					//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
707 707
 		} else {
708 708
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
709 709
 		}
710 710
         
711
-    		try {
711
+			try {
712 712
 			
713 713
 			$sth = $this->db->prepare($query);
714 714
 			$sth->execute();
@@ -720,18 +720,18 @@  discard block
 block discarded – undo
720 720
 	}
721 721
 
722 722
 	/**
723
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
724
-	*
725
-	* @return String success or false
726
-	*
727
-	*/
723
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
724
+	 *
725
+	 * @return String success or false
726
+	 *
727
+	 */
728 728
 	public function deleteLiveMarineDataNotUpdated()
729 729
 	{
730 730
 		global $globalDBdriver, $globalDebug;
731 731
 		if ($globalDBdriver == 'mysql') {
732 732
 			//$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0';
733
-    			$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
734
-    			try {
733
+				$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
734
+				try {
735 735
 				
736 736
 				$sth = $this->db->prepare($query);
737 737
 				$sth->execute();
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 				return "error";
740 740
 			}
741 741
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
742
-                        $i = 0;
743
-                        $j =0;
742
+						$i = 0;
743
+						$j =0;
744 744
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
745 745
 			foreach($all as $row)
746 746
 			{
@@ -748,20 +748,20 @@  discard block
 block discarded – undo
748 748
 				$j++;
749 749
 				if ($j == 30) {
750 750
 					if ($globalDebug) echo ".";
751
-				    	try {
751
+						try {
752 752
 						
753 753
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
754 754
 						$sth->execute();
755 755
 					} catch(PDOException $e) {
756 756
 						return "error";
757 757
 					}
758
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
759
-                                	$j = 0;
758
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
759
+									$j = 0;
760 760
 				}
761 761
 				$query_delete .= "'".$row['fammarine_id']."',";
762 762
 			}
763 763
 			if ($i > 0) {
764
-    				try {
764
+					try {
765 765
 					
766 766
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
767 767
 					$sth->execute();
@@ -772,9 +772,9 @@  discard block
 block discarded – undo
772 772
 			return "success";
773 773
 		} elseif ($globalDBdriver == 'pgsql') {
774 774
 			//$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0";
775
-    			//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
776
-    			$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
777
-    			try {
775
+				//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
776
+				$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
777
+				try {
778 778
 				
779 779
 				$sth = $this->db->prepare($query);
780 780
 				$sth->execute();
@@ -818,18 +818,18 @@  discard block
 block discarded – undo
818 818
 		return 'error';
819 819
 	}
820 820
 
821
-    /**
822
-     * Deletes all info in the table for an ident
823
-     *
824
-     * @param $ident
825
-     * @return String success or false
826
-     */
821
+	/**
822
+	 * Deletes all info in the table for an ident
823
+	 *
824
+	 * @param $ident
825
+	 * @return String success or false
826
+	 */
827 827
 	public function deleteLiveMarineDataByIdent($ident)
828 828
 	{
829 829
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
830 830
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
831 831
         
832
-    		try {
832
+			try {
833 833
 			
834 834
 			$sth = $this->db->prepare($query);
835 835
 			$sth->execute(array(':ident' => $ident));
@@ -840,18 +840,18 @@  discard block
 block discarded – undo
840 840
 		return "success";
841 841
 	}
842 842
 
843
-    /**
844
-     * Deletes all info in the table for an id
845
-     *
846
-     * @param $id
847
-     * @return String success or false
848
-     */
843
+	/**
844
+	 * Deletes all info in the table for an id
845
+	 *
846
+	 * @param $id
847
+	 * @return String success or false
848
+	 */
849 849
 	public function deleteLiveMarineDataById($id)
850 850
 	{
851 851
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
852 852
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
853 853
         
854
-    		try {
854
+			try {
855 855
 			
856 856
 			$sth = $this->db->prepare($query);
857 857
 			$sth->execute(array(':id' => $id));
@@ -864,11 +864,11 @@  discard block
 block discarded – undo
864 864
 
865 865
 
866 866
 	/**
867
-	* Gets the marine races
868
-	*
869
-	* @return array all races
870
-	*
871
-	*/
867
+	 * Gets the marine races
868
+	 *
869
+	 * @return array all races
870
+	 *
871
+	 */
872 872
 	public function getAllRaces()
873 873
 	{
874 874
 		$query  = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name';
@@ -877,12 +877,12 @@  discard block
 block discarded – undo
877 877
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
878 878
 	}
879 879
 
880
-    /**
881
-     * Gets the aircraft ident within the last hour
882
-     *
883
-     * @param $ident
884
-     * @return String the ident
885
-     */
880
+	/**
881
+	 * Gets the aircraft ident within the last hour
882
+	 *
883
+	 * @param $ident
884
+	 * @return String the ident
885
+	 */
886 886
 	public function getIdentFromLastHour($ident)
887 887
 	{
888 888
 		global $globalDBdriver;
@@ -908,14 +908,14 @@  discard block
 block discarded – undo
908 908
 			$ident_result = $row['ident'];
909 909
 		}
910 910
 		return $ident_result;
911
-        }
912
-
913
-    /**
914
-     * Check recent aircraft
915
-     *
916
-     * @param $ident
917
-     * @return String the ident
918
-     */
911
+		}
912
+
913
+	/**
914
+	 * Check recent aircraft
915
+	 *
916
+	 * @param $ident
917
+	 * @return String the ident
918
+	 */
919 919
 	public function checkIdentRecent($ident)
920 920
 	{
921 921
 		global $globalDBdriver;
@@ -941,14 +941,14 @@  discard block
 block discarded – undo
941 941
 			$ident_result = $row['fammarine_id'];
942 942
 		}
943 943
 		return $ident_result;
944
-        }
945
-
946
-    /**
947
-     * Check recent aircraft by id
948
-     *
949
-     * @param $id
950
-     * @return String the ident
951
-     */
944
+		}
945
+
946
+	/**
947
+	 * Check recent aircraft by id
948
+	 *
949
+	 * @param $id
950
+	 * @return String the ident
951
+	 */
952 952
 	public function checkIdRecent($id)
953 953
 	{
954 954
 		global $globalDBdriver;
@@ -974,14 +974,14 @@  discard block
 block discarded – undo
974 974
 			$ident_result = $row['fammarine_id'];
975 975
 		}
976 976
 		return $ident_result;
977
-        }
978
-
979
-    /**
980
-     * Check recent aircraft by mmsi
981
-     *
982
-     * @param $mmsi
983
-     * @return String the ident
984
-     */
977
+		}
978
+
979
+	/**
980
+	 * Check recent aircraft by mmsi
981
+	 *
982
+	 * @param $mmsi
983
+	 * @return String the ident
984
+	 */
985 985
 	public function checkMMSIRecent($mmsi)
986 986
 	{
987 987
 		global $globalDBdriver;
@@ -1007,41 +1007,41 @@  discard block
 block discarded – undo
1007 1007
 			$ident_result = $row['fammarine_id'];
1008 1008
 		}
1009 1009
 		return $ident_result;
1010
-        }
1011
-
1012
-    /**
1013
-     * Adds a new spotter data
1014
-     *
1015
-     * @param String $fammarine_id the ID from flightaware
1016
-     * @param String $ident the flight ident
1017
-     * @param string $latitude
1018
-     * @param string $longitude
1019
-     * @param string $heading
1020
-     * @param string $groundspeed
1021
-     * @param string $date
1022
-     * @param bool $putinarchive
1023
-     * @param string $mmsi
1024
-     * @param string $type
1025
-     * @param string $typeid
1026
-     * @param string $imo
1027
-     * @param string $callsign
1028
-     * @param string $arrival_code
1029
-     * @param string $arrival_date
1030
-     * @param string $status
1031
-     * @param string $statusid
1032
-     * @param bool $noarchive
1033
-     * @param string $format_source
1034
-     * @param string $source_name
1035
-     * @param string $over_country
1036
-     * @param string $captain_id
1037
-     * @param string $captain_name
1038
-     * @param string $race_id
1039
-     * @param string $race_name
1040
-     * @param string $distance
1041
-     * @param string $race_rank
1042
-     * @param string $race_time
1043
-     * @return String success or false
1044
-     */
1010
+		}
1011
+
1012
+	/**
1013
+	 * Adds a new spotter data
1014
+	 *
1015
+	 * @param String $fammarine_id the ID from flightaware
1016
+	 * @param String $ident the flight ident
1017
+	 * @param string $latitude
1018
+	 * @param string $longitude
1019
+	 * @param string $heading
1020
+	 * @param string $groundspeed
1021
+	 * @param string $date
1022
+	 * @param bool $putinarchive
1023
+	 * @param string $mmsi
1024
+	 * @param string $type
1025
+	 * @param string $typeid
1026
+	 * @param string $imo
1027
+	 * @param string $callsign
1028
+	 * @param string $arrival_code
1029
+	 * @param string $arrival_date
1030
+	 * @param string $status
1031
+	 * @param string $statusid
1032
+	 * @param bool $noarchive
1033
+	 * @param string $format_source
1034
+	 * @param string $source_name
1035
+	 * @param string $over_country
1036
+	 * @param string $captain_id
1037
+	 * @param string $captain_name
1038
+	 * @param string $race_id
1039
+	 * @param string $race_name
1040
+	 * @param string $distance
1041
+	 * @param string $race_rank
1042
+	 * @param string $race_time
1043
+	 * @return String success or false
1044
+	 */
1045 1045
 	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '')
1046 1046
 	{
1047 1047
 		global $globalArchive, $globalDebug;
@@ -1123,10 +1123,10 @@  discard block
 block discarded – undo
1123 1123
 		if ($statusid == '') $statusid = NULL;
1124 1124
 		if ($distance == '') $distance = NULL;
1125 1125
 
1126
-            	//if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1127
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1128
-            	if ($arrival_date == '') $arrival_date = NULL;
1129
-            	$query = '';
1126
+				//if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1127
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1128
+				if ($arrival_date == '') $arrival_date = NULL;
1129
+				$query = '';
1130 1130
 		if ($globalArchive) {
1131 1131
 			if ($globalDebug) echo '-- Delete previous data -- ';
1132 1132
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -27,33 +27,33 @@  discard block
 block discarded – undo
27 27
      * @param bool $and
28 28
      * @return string the SQL part
29 29
      */
30
-	public function getFilter($filter = array(),$where = false,$and = false) {
30
+	public function getFilter($filter = array(), $where = false, $and = false) {
31 31
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
32 32
 		$filters = array();
33 33
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
34 34
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
35 35
 				$filters = $globalStatsFilters[$globalFilterName];
36 36
 			} else {
37
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
37
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
38 38
 			}
39 39
 		}
40 40
 		if (isset($filter[0]['source'])) {
41
-			$filters = array_merge($filters,$filter);
41
+			$filters = array_merge($filters, $filter);
42 42
 		}
43
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
43
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
44 44
 		$filter_query_join = '';
45 45
 		$filter_query_where = '';
46
-		foreach($filters as $flt) {
46
+		foreach ($filters as $flt) {
47 47
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
48 48
 				if (isset($flt['source'])) {
49
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
49
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
50 50
 				} else {
51
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
51
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
52 52
 				}
53 53
 			}
54 54
 		}
55 55
 		if (isset($filter['source']) && !empty($filter['source'])) {
56
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
56
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
57 57
 		}
58 58
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
59 59
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
 					$filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
92 92
 				}
93 93
 			}
94
-			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
94
+			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
95 95
 		}
96 96
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
97
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
97
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
98 98
 		}
99 99
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
100 100
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
101 101
 		if ($filter_query_where != '') {
102
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
102
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
103 103
 		}
104 104
 		$filter_query = $filter_query_join.$filter_query_where;
105 105
 		return $filter_query;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 		if ($limit != '')
125 125
 		{
126 126
 			$limit_array = explode(',', $limit);
127
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
128
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
127
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
128
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
129 129
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
130 130
 			{
131 131
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
141 141
 			}
142 142
 		}
143
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
143
+		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
144 144
 
145 145
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
146 146
 		if ($globalDBdriver == 'mysql') {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		} else {
150 150
 			$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query;
151 151
 		}
152
-		$spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true);
152
+		$spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true);
153 153
 
154 154
 		return $spotter_array;
155 155
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		global $globalDBdriver, $globalLiveInterval;
166 166
 		date_default_timezone_set('UTC');
167 167
 
168
-		$filter_query = $this->getFilter($filter,true,true);
168
+		$filter_query = $this->getFilter($filter, true, true);
169 169
 
170 170
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
171 171
 		if ($globalDBdriver == 'mysql') {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		try {
180 180
 			$sth = $this->db->prepare($query);
181 181
 			$sth->execute();
182
-		} catch(PDOException $e) {
182
+		} catch (PDOException $e) {
183 183
 			echo $e->getMessage();
184 184
 			die;
185 185
 		}
@@ -197,26 +197,26 @@  discard block
 block discarded – undo
197 197
      * @param string $id
198 198
      * @return array the spotter information
199 199
      */
200
-	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '')
200
+	public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false, $id = '')
201 201
 	{
202 202
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
203 203
 		date_default_timezone_set('UTC');
204 204
 		$usecoord = false;
205 205
 		if (is_array($coord) && !empty($coord)) {
206
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
207
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
208
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
209
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
206
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
207
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
208
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
209
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
210 210
 			$usecoord = true;
211 211
 		}
212
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
213
-		$filter_query = $this->getFilter($filter,true,true);
212
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
213
+		$filter_query = $this->getFilter($filter, true, true);
214 214
 
215 215
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
216 216
 		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
217 217
 		if ($globalDBdriver == 'mysql') {
218 218
 			if (isset($globalArchive) && $globalArchive === TRUE) {
219
-				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
219
+				$query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
220 220
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
221 221
 				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
222 222
 				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 				    ORDER BY fammarine_id, date";
231 231
 				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
232 232
 			} else {
233
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
233
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
234 234
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
235 235
 				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
236 236
 				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			}
241 241
 		} else {
242 242
 			if (isset($globalArchive) && $globalArchive === TRUE) {
243
-				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
243
+				$query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
244 244
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
245 245
 				if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
246 246
 				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		try {
268 268
 			$sth = $this->db->prepare($query);
269 269
 			$sth->execute($query_values);
270
-		} catch(PDOException $e) {
270
+		} catch (PDOException $e) {
271 271
 			echo $e->getMessage();
272 272
 			die;
273 273
 		}
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
      * @param bool $limit
284 284
      * @return array the spotter information
285 285
      */
286
-	public function getMinLastLiveMarineDataByID($id = '',$filter = array(), $limit = false)
286
+	public function getMinLastLiveMarineDataByID($id = '', $filter = array(), $limit = false)
287 287
 	{
288 288
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
289 289
 		date_default_timezone_set('UTC');
290
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
291
-		$filter_query = $this->getFilter($filter,true,true);
290
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
291
+		$filter_query = $this->getFilter($filter, true, true);
292 292
 
293 293
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
294 294
 		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		try {
334 334
 			$sth = $this->db->prepare($query);
335 335
 			$sth->execute($query_values);
336
-		} catch(PDOException $e) {
336
+		} catch (PDOException $e) {
337 337
 			echo $e->getMessage();
338 338
 			die;
339 339
 		}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	public function getLiveMarineCount($filter = array())
351 351
 	{
352 352
 		global $globalDBdriver, $globalLiveInterval;
353
-		$filter_query = $this->getFilter($filter,true,true);
353
+		$filter_query = $this->getFilter($filter, true, true);
354 354
 
355 355
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
356 356
 		if ($globalDBdriver == 'mysql') {
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		try {
362 362
 			$sth = $this->db->prepare($query);
363 363
 			$sth->execute();
364
-		} catch(PDOException $e) {
364
+		} catch (PDOException $e) {
365 365
 			echo $e->getMessage();
366 366
 			die;
367 367
 		}
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 		$filter_query = $this->getFilter($filter);
386 386
 
387 387
 		if (is_array($coord)) {
388
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
389
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
390
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
391
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
388
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
389
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
390
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
391
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
392 392
 		} else return array();
393 393
 		if ($globalDBdriver == 'mysql') {
394 394
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query;
@@ -411,13 +411,13 @@  discard block
 block discarded – undo
411 411
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
412 412
 		$Marine = new Marine($this->db);
413 413
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
414
-		$filter_query = $this->getFilter($filter,true,true);
414
+		$filter_query = $this->getFilter($filter, true, true);
415 415
 
416 416
 		if (is_array($coord)) {
417
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
418
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
419
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
420
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
417
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
418
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
419
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
420
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
421 421
 		} else return array();
422 422
 		/*
423 423
 		if ($globalDBdriver == 'mysql') {
@@ -432,13 +432,13 @@  discard block
 block discarded – undo
432 432
 		*/
433 433
 		if ($globalDBdriver == 'mysql') {
434 434
 			if (isset($globalArchive) && $globalArchive === TRUE) {
435
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
435
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
436 436
 				    FROM marine_live 
437 437
 				    '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date 
438 438
 				    AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
439 439
 				    AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY race_rank,date DESC';
440 440
 			} else {
441
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
441
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
442 442
 				    FROM marine_live 
443 443
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
444 444
 				    FROM marine_live l 
@@ -450,14 +450,14 @@  discard block
 block discarded – undo
450 450
 			}
451 451
 		} else {
452 452
 			if (isset($globalArchive) && $globalArchive === TRUE) {
453
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
453
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
454 454
 				    FROM marine_live 
455 455
 				    ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date 
456 456
 				    AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
457 457
 				    AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
458 458
 				    AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY race_rank, date DESC";
459 459
 			} else {
460
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
460
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
461 461
 				    FROM marine_live 
462 462
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
463 463
 				    FROM marine_live l 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 				if ($interval == '1m')
518 518
 				{
519 519
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
520
-				} else if ($interval == '15m'){
520
+				} else if ($interval == '15m') {
521 521
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
522 522
 				}
523 523
 			}
@@ -525,14 +525,14 @@  discard block
 block discarded – undo
525 525
 			$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
526 526
 		}
527 527
 
528
-		$query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
528
+		$query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
529 529
                    WHERE marine_live.latitude <> '' 
530 530
                                    AND marine_live.longitude <> '' 
531 531
                    ".$additional_query."
532 532
                    HAVING distance < :radius  
533 533
                                    ORDER BY distance";
534 534
 
535
-		$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
535
+		$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
536 536
 
537 537
 		return $spotter_array;
538 538
 	}
@@ -550,9 +550,9 @@  discard block
 block discarded – undo
550 550
 		date_default_timezone_set('UTC');
551 551
 
552 552
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
553
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
553
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
554 554
 
555
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
555
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true);
556 556
 
557 557
 		return $spotter_array;
558 558
 	}
@@ -564,14 +564,14 @@  discard block
 block discarded – undo
564 564
      * @param $date
565 565
      * @return array the spotter information
566 566
      */
567
-	public function getDateLiveMarineDataByIdent($ident,$date)
567
+	public function getDateLiveMarineDataByIdent($ident, $date)
568 568
 	{
569 569
 		$Marine = new Marine($this->db);
570 570
 		date_default_timezone_set('UTC');
571 571
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
572 572
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
573
-		$date = date('c',$date);
574
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
573
+		$date = date('c', $date);
574
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
575 575
 		return $spotter_array;
576 576
 	}
577 577
 
@@ -582,14 +582,14 @@  discard block
 block discarded – undo
582 582
      * @param $date
583 583
      * @return array the spotter information
584 584
      */
585
-	public function getDateLiveMarineDataByMMSI($mmsi,$date)
585
+	public function getDateLiveMarineDataByMMSI($mmsi, $date)
586 586
 	{
587 587
 		$Marine = new Marine($this->db);
588 588
 		date_default_timezone_set('UTC');
589 589
 		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
590 590
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
591
-		$date = date('c',$date);
592
-		$spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date));
591
+		$date = date('c', $date);
592
+		$spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date));
593 593
 		return $spotter_array;
594 594
 	}
595 595
 
@@ -605,9 +605,9 @@  discard block
 block discarded – undo
605 605
 		date_default_timezone_set('UTC');
606 606
 
607 607
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
608
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
608
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
609 609
 
610
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
610
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true);
611 611
 
612 612
 		return $spotter_array;
613 613
 	}
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
      * @param $date
620 620
      * @return array the spotter information
621 621
      */
622
-	public function getDateLiveMarineDataById($id,$date)
622
+	public function getDateLiveMarineDataById($id, $date)
623 623
 	{
624 624
 		$Marine = new Marine($this->db);
625 625
 		date_default_timezone_set('UTC');
626 626
 
627 627
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
628
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
629
-                $date = date('c',$date);
630
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
628
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
629
+                $date = date('c', $date);
630
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
631 631
 
632 632
 		return $spotter_array;
633 633
 	}
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
      * @param bool $liveinterval
641 641
      * @return array the spotter information
642 642
      */
643
-	public function getAllLiveMarineDataById($id,$liveinterval = false)
643
+	public function getAllLiveMarineDataById($id, $liveinterval = false)
644 644
 	{
645 645
 		global $globalDBdriver, $globalLiveInterval;
646 646
 		date_default_timezone_set('UTC');
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		try {
660 660
 			$sth = $this->db->prepare($query);
661 661
 			$sth->execute(array(':id' => $id));
662
-		} catch(PDOException $e) {
662
+		} catch (PDOException $e) {
663 663
 			echo $e->getMessage();
664 664
 			die;
665 665
 		}
@@ -677,12 +677,12 @@  discard block
 block discarded – undo
677 677
 	{
678 678
 		date_default_timezone_set('UTC');
679 679
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
680
-		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
680
+		$query = self::$global_query.' WHERE marine_live.ident = :ident';
681 681
     		try {
682 682
 			
683 683
 			$sth = $this->db->prepare($query);
684 684
 			$sth->execute(array(':ident' => $ident));
685
-		} catch(PDOException $e) {
685
+		} catch (PDOException $e) {
686 686
 			echo $e->getMessage();
687 687
 			die;
688 688
 		}
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 			
713 713
 			$sth = $this->db->prepare($query);
714 714
 			$sth->execute();
715
-		} catch(PDOException $e) {
715
+		} catch (PDOException $e) {
716 716
 			return "error";
717 717
 		}
718 718
 
@@ -735,14 +735,14 @@  discard block
 block discarded – undo
735 735
 				
736 736
 				$sth = $this->db->prepare($query);
737 737
 				$sth->execute();
738
-			} catch(PDOException $e) {
738
+			} catch (PDOException $e) {
739 739
 				return "error";
740 740
 			}
741 741
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
742 742
                         $i = 0;
743
-                        $j =0;
743
+                        $j = 0;
744 744
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
745
-			foreach($all as $row)
745
+			foreach ($all as $row)
746 746
 			{
747 747
 				$i++;
748 748
 				$j++;
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
 					if ($globalDebug) echo ".";
751 751
 				    	try {
752 752
 						
753
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
753
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
754 754
 						$sth->execute();
755
-					} catch(PDOException $e) {
755
+					} catch (PDOException $e) {
756 756
 						return "error";
757 757
 					}
758 758
                                 	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
@@ -763,9 +763,9 @@  discard block
 block discarded – undo
763 763
 			if ($i > 0) {
764 764
     				try {
765 765
 					
766
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
766
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
767 767
 					$sth->execute();
768
-				} catch(PDOException $e) {
768
+				} catch (PDOException $e) {
769 769
 					return "error";
770 770
 				}
771 771
 			}
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 				
779 779
 				$sth = $this->db->prepare($query);
780 780
 				$sth->execute();
781
-			} catch(PDOException $e) {
781
+			} catch (PDOException $e) {
782 782
 				return "error";
783 783
 			}
784 784
 /*			$query_delete = "DELETE FROM marine_live WHERE fammarine_id IN (";
@@ -827,13 +827,13 @@  discard block
 block discarded – undo
827 827
 	public function deleteLiveMarineDataByIdent($ident)
828 828
 	{
829 829
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
830
-		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
830
+		$query = 'DELETE FROM marine_live WHERE ident = :ident';
831 831
         
832 832
     		try {
833 833
 			
834 834
 			$sth = $this->db->prepare($query);
835 835
 			$sth->execute(array(':ident' => $ident));
836
-		} catch(PDOException $e) {
836
+		} catch (PDOException $e) {
837 837
 			return "error";
838 838
 		}
839 839
 
@@ -849,13 +849,13 @@  discard block
 block discarded – undo
849 849
 	public function deleteLiveMarineDataById($id)
850 850
 	{
851 851
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
852
-		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
852
+		$query = 'DELETE FROM marine_live WHERE fammarine_id = :id';
853 853
         
854 854
     		try {
855 855
 			
856 856
 			$sth = $this->db->prepare($query);
857 857
 			$sth->execute(array(':id' => $id));
858
-		} catch(PDOException $e) {
858
+		} catch (PDOException $e) {
859 859
 			return "error";
860 860
 		}
861 861
 
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 	*/
872 872
 	public function getAllRaces()
873 873
 	{
874
-		$query  = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name';
874
+		$query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name';
875 875
 		$sth = $this->db->prepare($query);
876 876
 		$sth->execute();
877 877
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -887,13 +887,13 @@  discard block
 block discarded – undo
887 887
 	{
888 888
 		global $globalDBdriver;
889 889
 		if ($globalDBdriver == 'mysql') {
890
-			$query  = 'SELECT marine_live.ident FROM marine_live 
890
+			$query = 'SELECT marine_live.ident FROM marine_live 
891 891
 				WHERE marine_live.ident = :ident 
892 892
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
893 893
 				AND marine_live.date < UTC_TIMESTAMP()';
894 894
 			$query_data = array(':ident' => $ident);
895 895
 		} else {
896
-			$query  = "SELECT marine_live.ident FROM marine_live 
896
+			$query = "SELECT marine_live.ident FROM marine_live 
897 897
 				WHERE marine_live.ident = :ident 
898 898
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
899 899
 				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -902,8 +902,8 @@  discard block
 block discarded – undo
902 902
 		
903 903
 		$sth = $this->db->prepare($query);
904 904
 		$sth->execute($query_data);
905
-		$ident_result='';
906
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
905
+		$ident_result = '';
906
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
907 907
 		{
908 908
 			$ident_result = $row['ident'];
909 909
 		}
@@ -920,13 +920,13 @@  discard block
 block discarded – undo
920 920
 	{
921 921
 		global $globalDBdriver;
922 922
 		if ($globalDBdriver == 'mysql') {
923
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
923
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
924 924
 				WHERE marine_live.ident = :ident 
925 925
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
926 926
 //				AND marine_live.date < UTC_TIMESTAMP()";
927 927
 			$query_data = array(':ident' => $ident);
928 928
 		} else {
929
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
929
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
930 930
 				WHERE marine_live.ident = :ident 
931 931
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
932 932
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -935,8 +935,8 @@  discard block
 block discarded – undo
935 935
 		
936 936
 		$sth = $this->db->prepare($query);
937 937
 		$sth->execute($query_data);
938
-		$ident_result='';
939
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
938
+		$ident_result = '';
939
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
940 940
 		{
941 941
 			$ident_result = $row['fammarine_id'];
942 942
 		}
@@ -953,13 +953,13 @@  discard block
 block discarded – undo
953 953
 	{
954 954
 		global $globalDBdriver;
955 955
 		if ($globalDBdriver == 'mysql') {
956
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
956
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
957 957
 				WHERE marine_live.fammarine_id = :id 
958 958
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
959 959
 //				AND marine_live.date < UTC_TIMESTAMP()";
960 960
 			$query_data = array(':id' => $id);
961 961
 		} else {
962
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
962
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
963 963
 				WHERE marine_live.fammarine_id = :id 
964 964
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
965 965
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -968,8 +968,8 @@  discard block
 block discarded – undo
968 968
 		
969 969
 		$sth = $this->db->prepare($query);
970 970
 		$sth->execute($query_data);
971
-		$ident_result='';
972
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
971
+		$ident_result = '';
972
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
973 973
 		{
974 974
 			$ident_result = $row['fammarine_id'];
975 975
 		}
@@ -986,13 +986,13 @@  discard block
 block discarded – undo
986 986
 	{
987 987
 		global $globalDBdriver;
988 988
 		if ($globalDBdriver == 'mysql') {
989
-			$query  = 'SELECT marine_live.fammarine_id FROM marine_live 
989
+			$query = 'SELECT marine_live.fammarine_id FROM marine_live 
990 990
 				WHERE marine_live.mmsi = :mmsi 
991 991
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
992 992
 //				AND marine_live.date < UTC_TIMESTAMP()";
993 993
 			$query_data = array(':mmsi' => $mmsi);
994 994
 		} else {
995
-			$query  = "SELECT marine_live.fammarine_id FROM marine_live 
995
+			$query = "SELECT marine_live.fammarine_id FROM marine_live 
996 996
 				WHERE marine_live.mmsi = :mmsi 
997 997
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
998 998
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -1001,8 +1001,8 @@  discard block
 block discarded – undo
1001 1001
 		
1002 1002
 		$sth = $this->db->prepare($query);
1003 1003
 		$sth->execute($query_data);
1004
-		$ident_result='';
1005
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1004
+		$ident_result = '';
1005
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1006 1006
 		{
1007 1007
 			$ident_result = $row['fammarine_id'];
1008 1008
 		}
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
      * @param string $race_time
1043 1043
      * @return String success or false
1044 1044
      */
1045
-	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '')
1045
+	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '')
1046 1046
 	{
1047 1047
 		global $globalArchive, $globalDebug;
1048 1048
 		$Common = new Common();
@@ -1094,37 +1094,37 @@  discard block
 block discarded – undo
1094 1094
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1095 1095
 
1096 1096
         
1097
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
1098
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1099
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1100
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1101
-		$distance = filter_var($distance,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1102
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1103
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1104
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1105
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1106
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1107
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
1108
-		$typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT);
1109
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
1110
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
1111
-		$statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT);
1112
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
1113
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
1114
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
1115
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
1116
-		$captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING);
1117
-		$captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING);
1118
-		$race_id = filter_var($race_id,FILTER_SANITIZE_STRING);
1119
-		$race_name = filter_var($race_name,FILTER_SANITIZE_STRING);
1120
-		$race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT);
1121
-		$race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1097
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
1098
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1099
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1100
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1101
+		$distance = filter_var($distance, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1102
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1103
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1104
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1105
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1106
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1107
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
1108
+		$typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT);
1109
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
1110
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
1111
+		$statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT);
1112
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
1113
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
1114
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
1115
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
1116
+		$captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING);
1117
+		$captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING);
1118
+		$race_id = filter_var($race_id, FILTER_SANITIZE_STRING);
1119
+		$race_name = filter_var($race_name, FILTER_SANITIZE_STRING);
1120
+		$race_rank = filter_var($race_rank, FILTER_SANITIZE_NUMBER_INT);
1121
+		$race_time = filter_var($race_time, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1122 1122
 		if ($typeid == '') $typeid = NULL;
1123 1123
 		if ($statusid == '') $statusid = NULL;
1124 1124
 		if ($distance == '') $distance = NULL;
1125 1125
 
1126 1126
             	//if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1127
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1127
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1128 1128
             	if ($arrival_date == '') $arrival_date = NULL;
1129 1129
             	$query = '';
1130 1130
 		if ($globalArchive) {
@@ -1133,19 +1133,19 @@  discard block
 block discarded – undo
1133 1133
 		}
1134 1134
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) 
1135 1135
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name,:distance,:race_rank,:race_time)';
1136
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name,':distance' => $distance,':race_time' => $race_time,':race_rank' => $race_rank);
1136
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name, ':distance' => $distance, ':race_time' => $race_time, ':race_rank' => $race_rank);
1137 1137
 		try {
1138 1138
 			$sth = $this->db->prepare($query);
1139 1139
 			$sth->execute($query_values);
1140 1140
 			$sth->closeCursor();
1141
-		} catch(PDOException $e) {
1141
+		} catch (PDOException $e) {
1142 1142
 			return "error : ".$e->getMessage();
1143 1143
 		}
1144 1144
 		
1145 1145
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1146 1146
 			if ($globalDebug) echo '(Add to Marine archive : ';
1147 1147
 			$MarineArchive = new MarineArchive($this->db);
1148
-			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time);
1148
+			$result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country, $captain_id, $captain_name, $race_id, $race_name, $distance, $race_rank, $race_time);
1149 1149
 			if ($globalDebug) echo $result.')';
1150 1150
 		}
1151 1151
 		return "success";
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 
1154 1154
 	public function getOrderBy()
1155 1155
 	{
1156
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1156
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1157 1157
 		return $orderby;
1158 1158
 	}
1159 1159
 
Please login to merge, or discard this patch.
require/class.MarineImport.php 3 patches
Indentation   +266 added lines, -266 removed lines patch added patch discarded remove patch
@@ -16,25 +16,25 @@  discard block
 block discarded – undo
16 16
 require_once(dirname(__FILE__).'/class.Stats.php');
17 17
 require_once(dirname(__FILE__).'/class.Source.php');
18 18
 if (isset($globalServerAPRS) && $globalServerAPRS) {
19
-    require_once(dirname(__FILE__).'/class.APRS.php');
19
+	require_once(dirname(__FILE__).'/class.APRS.php');
20 20
 }
21 21
 
22 22
 class MarineImport {
23
-    private $all_tracked = array();
24
-    private $last_delete_hourly = 0;
25
-    private $last_delete = 0;
26
-    private $stats = array();
27
-    private $tmd = 0;
28
-    private $source_location = array();
29
-    public $db = null;
30
-    public $nb = 0;
23
+	private $all_tracked = array();
24
+	private $last_delete_hourly = 0;
25
+	private $last_delete = 0;
26
+	private $stats = array();
27
+	private $tmd = 0;
28
+	private $source_location = array();
29
+	public $db = null;
30
+	public $nb = 0;
31 31
 
32
-    public function __construct($dbc = null) {
32
+	public function __construct($dbc = null) {
33 33
 	global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB;
34 34
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
35
-	    $Connection = new Connection($dbc);
36
-	    $this->db = $Connection->db();
37
-	    date_default_timezone_set('UTC');
35
+		$Connection = new Connection($dbc);
36
+		$this->db = $Connection->db();
37
+		date_default_timezone_set('UTC');
38 38
 	}
39 39
 	// Get previous source stats
40 40
 	/*
@@ -53,79 +53,79 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 	*/
55 55
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
56
-	    $APRSMarine = new APRSMarine();
57
-	    //$APRSSpotter->connect();
56
+		$APRSMarine = new APRSMarine();
57
+		//$APRSSpotter->connect();
58
+	}
58 59
 	}
59
-    }
60 60
 
61
-    public function checkAll() {
61
+	public function checkAll() {
62 62
 	global $globalDebug, $globalNoDB, $globalVM;
63 63
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
64
-	    if ($globalDebug) echo "Update last seen tracked data...\n";
65
-	    foreach ($this->all_tracked as $key => $flight) {
64
+		if ($globalDebug) echo "Update last seen tracked data...\n";
65
+		foreach ($this->all_tracked as $key => $flight) {
66 66
 		if (isset($this->all_tracked[$key]['id'])) {
67
-		    //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
68
-    		    $Marine = new Marine($this->db);
69
-    		    if (isset($globalVM) && $globalVM) {
67
+			//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
68
+				$Marine = new Marine($this->db);
69
+				if (isset($globalVM) && $globalVM) {
70 70
 			if ($this->all_tracked[$key]['status'] == 'Racing') {
71
-    			    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
72
-    			} else {
73
-    			    $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']);
74
-    			    if ($timerace > time()) $finaldatetime = NULL;
75
-    			    else $finaldatetime = date('Y-m-d H:i:s',$timerace);
76
-    			    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
77
-    			}
78
-    		    } else {
71
+					$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
72
+				} else {
73
+					$timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']);
74
+					if ($timerace > time()) $finaldatetime = NULL;
75
+					else $finaldatetime = date('Y-m-d H:i:s',$timerace);
76
+					$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
77
+				}
78
+				} else {
79 79
 			$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
80
-		    }
80
+			}
81
+		}
81 82
 		}
82
-	    }
83 83
 	}
84
-    }
84
+	}
85 85
 
86
-    public function del() {
86
+	public function del() {
87 87
 	global $globalDebug, $globalNoDB, $globalNoImport;
88 88
 	// Delete old infos
89 89
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
90 90
 	foreach ($this->all_tracked as $key => $flight) {
91
-    	    if (isset($flight['lastupdate'])) {
92
-        	if ($flight['lastupdate'] < (time()-3000)) {
93
-            	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
94
-            		if (isset($this->all_tracked[$key]['id'])) {
95
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
96
-			    /*
91
+			if (isset($flight['lastupdate'])) {
92
+			if ($flight['lastupdate'] < (time()-3000)) {
93
+					if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
94
+					if (isset($this->all_tracked[$key]['id'])) {
95
+						if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
96
+				/*
97 97
 			    $MarineLive = new MarineLive();
98 98
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
99 99
 			    $MarineLive->db = null;
100 100
 			    */
101
-            		    //$real_arrival = $this->arrival($key);
102
-            		    $Marine = new Marine($this->db);
103
-            		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
101
+						//$real_arrival = $this->arrival($key);
102
+						$Marine = new Marine($this->db);
103
+						if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
104 104
 				if (isset($globalVM) && $globalVM) {
105
-				    if ($this->all_tracked[$key]['status'] == 'Racing') {
105
+					if ($this->all_tracked[$key]['status'] == 'Racing') {
106 106
 					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
107
-				    } else {
107
+					} else {
108 108
 					$timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time'];
109
-	        			if ($timerace > time()) $finaldatetime = NULL;
109
+						if ($timerace > time()) $finaldatetime = NULL;
110 110
 					else $finaldatetime = date('Y-m-d H:i:s',$timerace);
111 111
 					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
112
-				    }
112
+					}
113 113
 				} else {
114 114
 					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
115 115
 				}
116 116
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
117
-			    }
118
-			    // Put in archive
117
+				}
118
+				// Put in archive
119 119
 //				$Marine->db = null;
120 120
 			}
121
-            	    }
122
-            	    unset($this->all_tracked[$key]);
123
-    	        }
124
-	    }
125
-        }
126
-    }
121
+					}
122
+					unset($this->all_tracked[$key]);
123
+				}
124
+		}
125
+		}
126
+	}
127 127
 
128
-    public function add($line) {
128
+	public function add($line) {
129 129
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM;
130 130
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
131 131
 	date_default_timezone_set('UTC');
@@ -134,106 +134,106 @@  discard block
 block discarded – undo
134 134
 	
135 135
 	// SBS format is CSV format
136 136
 	if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) {
137
-	    //print_r($line);
138
-  	    if (isset($line['mmsi']) || isset($line['id'])) {
137
+		//print_r($line);
138
+  		if (isset($line['mmsi']) || isset($line['id'])) {
139 139
 
140 140
 		
141 141
 		// Increment message number
142 142
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
143
-		    $current_date = date('Y-m-d');
144
-		    if (isset($line['source_name'])) $source = $line['source_name'];
145
-		    else $source = '';
146
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
147
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
148
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
149
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
150
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
143
+			$current_date = date('Y-m-d');
144
+			if (isset($line['source_name'])) $source = $line['source_name'];
145
+			else $source = '';
146
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
147
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
148
+				$this->stats[$current_date][$source]['msg']['date'] = time();
149
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
150
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
151 151
 		}
152 152
 		
153 153
 		
154 154
 		$Common = new Common();
155 155
 		$AIS = new AIS();
156
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
157
-	        else $id = trim($line['id']);
156
+			if (!isset($line['id'])) $id = trim($line['mmsi']);
157
+			else $id = trim($line['id']);
158 158
 		
159 159
 		if (!isset($this->all_tracked[$id])) {
160
-		    $this->all_tracked[$id] = array();
161
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
162
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => ''));
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
164
-		    if (!isset($line['id'])) {
160
+			$this->all_tracked[$id] = array();
161
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
162
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => ''));
163
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
164
+			if (!isset($line['id'])) {
165 165
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
166 166
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
167
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
168
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
167
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
168
+			if ($globalAllTracked !== FALSE) $dataFound = true;
169 169
 		}
170 170
 		
171 171
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
172
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
173
-		    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
172
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
173
+			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
174 174
 			$Marine = new Marine($this->db);
175 175
 			$identity = $Marine->getIdentity($line['mmsi']);
176 176
 			if (!empty($identity)) {
177
-			    $this->all_tracked[$id]['ident'] = $identity['ship_name'];
178
-			    $this->all_tracked[$id]['type'] = $identity['type'];
179
-			    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type'])));
177
+				$this->all_tracked[$id]['ident'] = $identity['ship_name'];
178
+				$this->all_tracked[$id]['type'] = $identity['type'];
179
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type'])));
180 180
 			}
181 181
 			//print_r($identity);
182 182
 			unset($Marine);
183 183
 			//$dataFound = true;
184
-		    }
184
+			}
185 185
 		}
186 186
 		if (isset($line['type_id'])) {
187
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
188
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id']));
187
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
188
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id']));
189 189
 		}
190 190
 		if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') {
191
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
192
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type'])));
191
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
192
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type'])));
193 193
 		} elseif (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] != '') {
194
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
194
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
195 195
 		}
196 196
 		if (isset($line['status']) && $line['status'] != '') {
197
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
197
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
198 198
 		}
199 199
 		if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) {
200
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
201
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
200
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
201
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
202 202
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
203
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
203
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
204 204
 				$Marine = new Marine($this->db);
205 205
 				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']);
206 206
 				unset($Marine);
207
-			    }
207
+				}
208
+			}
208 209
 			}
209
-		    }
210 210
 		}
211 211
 
212 212
 
213 213
 		if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') {
214
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
214
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
215 215
 		}
216 216
 		if (isset($line['imo']) && $line['imo'] != '') {
217
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
217
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
218 218
 		}
219 219
 		if (isset($line['callsign']) && $line['callsign'] != '') {
220
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
220
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
221 221
 		}
222 222
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
223
-		    if (!isset($this->all_tracked[$id]['arrival_code'])) {
223
+			if (!isset($this->all_tracked[$id]['arrival_code'])) {
224 224
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
225 225
 			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
226 226
 			if ($this->all_tracked[$id]['addedMarine'] != 0) {
227
-			    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
227
+				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
228 228
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
229
-				    $Marine = new Marine($this->db);
230
-				    $fromsource = NULL;
231
-				    $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource);
232
-				    $Marine->db = null;
229
+					$Marine = new Marine($this->db);
230
+					$fromsource = NULL;
231
+					$Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource);
232
+					$Marine->db = null;
233
+				}
233 234
 				}
234
-			    }
235 235
 			}
236
-		    } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
236
+			} elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
237 237
 			$this->all_tracked[$id]['arrival_code'] = $line['arrival_code'];
238 238
 			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
239 239
 			if (!isset($line['id'])) {
@@ -241,50 +241,50 @@  discard block
 block discarded – undo
241 241
 				$this->all_tracked[$id]['forcenew'] = 1;
242 242
 				$this->all_tracked[$id]['addedMarine'] = 0;
243 243
 			}
244
-		    }
244
+			}
245 245
 		}
246 246
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
247
-		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
247
+			if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
248 248
 		}
249 249
 		if (isset($line['captain_id']) && $line['captain_id'] != '') {
250
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id']));
250
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id']));
251 251
 		}
252 252
 		if (isset($line['captain_name']) && $line['captain_name'] != '') {
253
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name']));
253
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name']));
254 254
 		}
255 255
 		if (isset($line['race_id']) && $line['race_id'] != '') {
256
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id']));
256
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id']));
257 257
 		}
258 258
 		if (isset($line['race_name']) && $line['race_name'] != '') {
259
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name']));
259
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name']));
260 260
 		}
261 261
 		if (isset($line['race_rank']) && $line['race_rank'] != '') {
262
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank']));
262
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank']));
263 263
 		}
264 264
 		if (isset($line['race_time']) && $line['race_time'] != '') {
265
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time']));
265
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time']));
266 266
 		}
267 267
 		if (isset($line['race_begin']) && $line['race_begin'] != '') {
268
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin']));
268
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin']));
269 269
 		}
270 270
 		if (isset($line['distance']) && $line['distance'] != '') {
271
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance']));
271
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance']));
272 272
 		}
273 273
 
274 274
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
275 275
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
276
-		    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
276
+			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
277 277
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
278
-			    $timeelapsed = microtime(true);
279
-			    $Marine = new Marine($this->db);
280
-			    $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']);
281
-			    $Marine->db = null;
278
+				$timeelapsed = microtime(true);
279
+				$Marine = new Marine($this->db);
280
+				$Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']);
281
+				$Marine->db = null;
282
+			}
282 283
 			}
283
-		    }
284
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
285
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
284
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
285
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
286 286
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
287
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
287
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
288 288
 				$timeelapsed = microtime(true);
289 289
 				$Marine = new Marine($this->db);
290 290
 				$fromsource = NULL;
@@ -292,20 +292,20 @@  discard block
 block discarded – undo
292 292
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
293 293
 				$Marine->db = null;
294 294
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
295
-			    }
295
+				}
296
+			}
296 297
 			}
297
-		    }
298
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
298
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
299 299
 		}
300 300
 
301 301
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) {
302
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
302
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
303 303
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
304
-		    } else {
304
+			} else {
305 305
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
306 306
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
307 307
 				return '';
308
-		    }
308
+			}
309 309
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) {
310 310
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
311 311
 			return '';
@@ -322,33 +322,33 @@  discard block
 block discarded – undo
322 322
 
323 323
 
324 324
 		if (isset($line['speed'])) {
325
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2)));
326
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
325
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2)));
326
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
327 327
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
328
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
329
-		    if ($distance > 1000 && $distance < 10000) {
328
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
329
+			if ($distance > 1000 && $distance < 10000) {
330 330
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
331 331
 			$speed = $speed*3.6;
332 332
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2)));
333 333
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
334
-		    }
334
+			}
335 335
 		}
336 336
 
337
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
338
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
339
-	    	    else unset($timediff);
340
-	    	    if ($this->tmd > 5 ||
341
-	    		!isset($timediff) ||
342
-	    		$timediff > $globalLiveInterval ||
343
-	    		(
344
-	    		    $timediff > 30 && 
345
-	    		    isset($this->all_tracked[$id]['latitude']) &&
346
-	    		    isset($this->all_tracked[$id]['longitude']) &&
347
-	    		    $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'))
348
-	    		)
349
-	    		) {
337
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
338
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
339
+				else unset($timediff);
340
+				if ($this->tmd > 5 ||
341
+				!isset($timediff) ||
342
+				$timediff > $globalLiveInterval ||
343
+				(
344
+					$timediff > 30 && 
345
+					isset($this->all_tracked[$id]['latitude']) &&
346
+					isset($this->all_tracked[$id]['longitude']) &&
347
+					$Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'))
348
+				)
349
+				) {
350 350
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
351
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
351
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
352 352
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
353 353
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
354 354
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -356,217 +356,217 @@  discard block
 block discarded – undo
356 356
 				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
357 357
 				$timeelapsed = microtime(true);
358 358
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
359
-				    $Marine = new Marine($this->db);
360
-				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
361
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
362
-				    $Marine->db = null;
363
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
359
+					$Marine = new Marine($this->db);
360
+					$all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
361
+					if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
362
+					$Marine->db = null;
363
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
364 364
 				}
365 365
 				$this->tmd = 0;
366 366
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
367
-			    }
367
+				}
368 368
 			}
369 369
 
370 370
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
371 371
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
372 372
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
373
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
374
-				    $dataFound = true;
375
-				    $this->all_tracked[$id]['time_last_coord'] = time();
373
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
374
+					$dataFound = true;
375
+					$this->all_tracked[$id]['time_last_coord'] = time();
376 376
 				}
377 377
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
378 378
 			}
379 379
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
380
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
380
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
381 381
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
382 382
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
383
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
384
-				    $dataFound = true;
385
-				    $this->all_tracked[$id]['time_last_coord'] = time();
383
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
384
+					$dataFound = true;
385
+					$this->all_tracked[$id]['time_last_coord'] = time();
386 386
 				}
387 387
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
388 388
 			}
389 389
 
390
-		    } else if ($globalDebug && $timediff > 20) {
390
+			} else if ($globalDebug && $timediff > 20) {
391 391
 			$this->tmd = $this->tmd + 1;
392 392
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
393 393
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
394 394
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
395 395
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
396
-		    }
396
+			}
397 397
 		}
398 398
 		if (isset($line['last_update']) && $line['last_update'] != '') {
399
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
400
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
399
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
400
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
401 401
 		}
402 402
 		if (isset($line['format_source']) && $line['format_source'] != '') {
403
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
403
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
404 404
 		}
405 405
 		if (isset($line['source_name']) && $line['source_name'] != '') {
406
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
406
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
407 407
 		}
408 408
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
409
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
409
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
410 410
 		}
411 411
 		
412 412
 		if (isset($line['heading']) && $line['heading'] != '') {
413
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
414
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
415
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
416
-		    //$dataFound = true;
413
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
414
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
415
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
416
+			//$dataFound = true;
417 417
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
418
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
419
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
420
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
421
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
418
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
419
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
420
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
421
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
422 422
   		}
423 423
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
424 424
 
425 425
 
426 426
 
427 427
 		if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) {
428
-		    $this->all_tracked[$id]['lastupdate'] = time();
429
-		    if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) {
430
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
431
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
428
+			$this->all_tracked[$id]['lastupdate'] = time();
429
+			if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) {
430
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
431
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
432 432
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
433
-				    if ($globalDebug) echo "Check if vessel is already in DB...";
434
-				    $timeelapsed = microtime(true);
435
-				    $MarineLive = new MarineLive($this->db);
436
-				    if (isset($line['id']) && isset($globalVM) && $globalVM) {
433
+					if ($globalDebug) echo "Check if vessel is already in DB...";
434
+					$timeelapsed = microtime(true);
435
+					$MarineLive = new MarineLive($this->db);
436
+					if (isset($line['id']) && isset($globalVM) && $globalVM) {
437 437
 					$Marine = new Marine($this->db);
438 438
 					$recent_ident = $Marine->checkId($line['id']);
439 439
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
440 440
 					$Marine->db=null;
441
-				    } elseif (isset($line['id'])) {
441
+					} elseif (isset($line['id'])) {
442 442
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
443 443
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
444
-				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
444
+					} elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
445 445
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
446 446
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
447
-				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
447
+					} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
448 448
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
449 449
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
450
-				    } else $recent_ident = '';
451
-				    $MarineLive->db=null;
452
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
453
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
450
+					} else $recent_ident = '';
451
+					$MarineLive->db=null;
452
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
453
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
454 454
 				} else $recent_ident = '';
455
-			    } else {
455
+				} else {
456 456
 				$recent_ident = '';
457 457
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
458
-			    }
459
-			    //if there was no vessel with the same callsign within the last hour and go post it into the archive
460
-			    if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM)))
461
-			    {
458
+				}
459
+				//if there was no vessel with the same callsign within the last hour and go post it into the archive
460
+				if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM)))
461
+				{
462 462
 				if ($globalDebug) {
463 463
 					if ($this->all_tracked[$id]['mmsi'] == '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
464 464
 					else echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
465 465
 				}
466 466
 				//adds the spotter data for the archive
467
-				    $highlight = '';
468
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
469
-				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
467
+					$highlight = '';
468
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
469
+					if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
470 470
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
471
-					    $timeelapsed = microtime(true);
472
-					    $Marine = new Marine($this->db);
473
-					    if (isset($globalVM) && $globalVM && $this->all_tracked[$id]['race_begin'] != '') {
471
+						$timeelapsed = microtime(true);
472
+						$Marine = new Marine($this->db);
473
+						if (isset($globalVM) && $globalVM && $this->all_tracked[$id]['race_begin'] != '') {
474 474
 						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
475
-					    } else {
475
+						} else {
476 476
 						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
477
-					    }
478
-					    $Marine->db = null;
479
-					    if ($globalDebug && isset($result)) echo $result."\n";
480
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
477
+						}
478
+						$Marine->db = null;
479
+						if ($globalDebug && isset($result)) echo $result."\n";
480
+						if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
481 481
 					}
482
-				    }
483
-				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
482
+					}
483
+					if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
484 484
 					// Add source stat in DB
485 485
 					$Stats = new Stats($this->db);
486 486
 					if (!empty($this->stats)) {
487
-					    if ($globalDebug) echo 'Add source stats : ';
488
-				    	    foreach($this->stats as $date => $data) {
487
+						if ($globalDebug) echo 'Add source stats : ';
488
+							foreach($this->stats as $date => $data) {
489 489
 						foreach($data as $source => $sourced) {
490
-					    	    //print_r($sourced);
491
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
492
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
493
-				    		    if (isset($sourced['msg'])) {
494
-				    			if (time() - $sourced['msg']['date'] > 10) {
495
-				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
496
-				    		    	    echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
497
-			    			    	    unset($this->stats[$date][$source]['msg']);
498
-			    				}
499
-			    			    }
500
-			    			}
501
-			    			if ($date != date('Y-m-d')) {
502
-			    			    unset($this->stats[$date]);
503
-			    			}
504
-				    	    }
505
-				    	    if ($globalDebug) echo 'Done'."\n";
490
+								//print_r($sourced);
491
+									if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
492
+									if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
493
+								if (isset($sourced['msg'])) {
494
+								if (time() - $sourced['msg']['date'] > 10) {
495
+										$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
496
+										echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
497
+										unset($this->stats[$date][$source]['msg']);
498
+								}
499
+								}
500
+							}
501
+							if ($date != date('Y-m-d')) {
502
+								unset($this->stats[$date]);
503
+							}
504
+							}
505
+							if ($globalDebug) echo 'Done'."\n";
506 506
 					}
507 507
 					$Stats->db = null;
508
-				    }
508
+					}
509 509
 				    
510
-				    $this->del();
510
+					$this->del();
511 511
 				//$ignoreImport = false;
512 512
 				$this->all_tracked[$id]['addedMarine'] = 1;
513 513
 				//print_r($this->all_tracked[$id]);
514 514
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
515
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
516
-				    //MarineLive->deleteLiveMarineDataNotUpdated();
517
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
515
+					if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
516
+					//MarineLive->deleteLiveMarineDataNotUpdated();
517
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
518 518
 					$MarineLive = new MarineLive($this->db);
519 519
 					$MarineLive->deleteLiveMarineData();
520 520
 					$MarineLive->db=null;
521 521
 					if ($globalDebug) echo " Done\n";
522
-				    }
523
-				    $this->last_delete = time();
522
+					}
523
+					$this->last_delete = time();
524 524
 				}
525
-			    } elseif ($recent_ident != '') {
525
+				} elseif ($recent_ident != '') {
526 526
 				$this->all_tracked[$id]['id'] = $recent_ident;
527 527
 				$this->all_tracked[$id]['addedMarine'] = 1;
528 528
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
529
-				    if ((isset($globalDaemon) && !$globalDaemon) || (isset($globalVM) && $globalVM)) {
529
+					if ((isset($globalDaemon) && !$globalDaemon) || (isset($globalVM) && $globalVM)) {
530 530
 					$Marine = new Marine($this->db);
531 531
 					if (isset($globalVM) && $globalVM) {
532
-					    if ($this->all_tracked[$id]['status'] == 'Racing') {
532
+						if ($this->all_tracked[$id]['status'] == 'Racing') {
533 533
 						$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
534
-					    } else {
534
+						} else {
535 535
 						//$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']);
536 536
 						$timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']);
537 537
 						if ($timerace > time()) $finaldatetime = NULL;
538 538
 						else $finaldatetime = date('Y-m-d H:i:s',$timerace);
539 539
 
540 540
 						$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
541
-					    }
541
+						}
542 542
 					} else {
543
-					    $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
543
+						$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
544 544
 					}
545 545
 					$Marine->db = null;
546
-				    }
546
+					}
547 547
 				}
548 548
 				
549
-			    }
549
+				}
550 550
 			}
551
-		    }
552
-		    //adds the spotter LIVE data
553
-		    if ($globalDebug) {
551
+			}
552
+			//adds the spotter LIVE data
553
+			if ($globalDebug) {
554 554
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
555
-		    }
556
-		    $ignoreImport = false;
557
-		    if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true;
558
-		    if (!$ignoreImport) {
555
+			}
556
+			$ignoreImport = false;
557
+			if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true;
558
+			if (!$ignoreImport) {
559 559
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
560 560
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
561 561
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
562
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
562
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
563 563
 					$timeelapsed = microtime(true);
564 564
 					$MarineLive = new MarineLive($this->db);
565 565
 					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
566 566
 					$MarineLive->db = null;
567 567
 					if ($globalDebug) echo $result."\n";
568 568
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
569
-				    }
569
+					}
570 570
 				}
571 571
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
572 572
 					$APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 					if ($stats_heading == 16) $stats_heading = 0;
602 602
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
603 603
 						for ($i=0;$i<=15;$i++) {
604
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
604
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
605 605
 						}
606 606
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
607 607
 					} else {
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
 					//var_dump($this->stats);
615 615
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
616 616
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
617
-						    end($this->stats[$current_date][$source]['hist']);
618
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
617
+							end($this->stats[$current_date][$source]['hist']);
618
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
619 619
 						} else $mini = 0;
620 620
 						for ($i=$mini;$i<=$distance;$i+=10) {
621
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
621
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
622 622
 						}
623 623
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
624 624
 					} else {
@@ -634,30 +634,30 @@  discard block
 block discarded – undo
634 634
 			
635 635
 			
636 636
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
637
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
637
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
638 638
 				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
639 639
 				$MarineLive = new MarineLive($this->db);
640 640
 				$MarineLive->deleteLiveMarineDataNotUpdated();
641 641
 				$MarineLive->db = null;
642 642
 				//MarineLive->deleteLiveMarineData();
643 643
 				if ($globalDebug) echo " Done\n";
644
-			    }
645
-			    $this->last_delete_hourly = time();
644
+				}
645
+				$this->last_delete_hourly = time();
646 646
 			}
647 647
 			
648
-		    }
649
-		    //$ignoreImport = false;
648
+			}
649
+			//$ignoreImport = false;
650 650
 		}
651 651
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
652 652
 		if ($send) return $this->all_tracked[$id];
653
-	    }
653
+		}
654
+	}
654 655
 	}
655
-    }
656 656
     
657
-    public function race_add($data) {
658
-        $Marine = new Marine();
659
-        $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']);
660
-        $Marine->db = null;
661
-    }
657
+	public function race_add($data) {
658
+		$Marine = new Marine();
659
+		$Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']);
660
+		$Marine->db = null;
661
+	}
662 662
 }
663 663
 ?>
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
     		    $Marine = new Marine($this->db);
69 69
     		    if (isset($globalVM) && $globalVM) {
70 70
 			if ($this->all_tracked[$key]['status'] == 'Racing') {
71
-    			    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
71
+    			    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']);
72 72
     			} else {
73
-    			    $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']);
73
+    			    $timerace = (strtotime($this->all_tracked[$key]['race_begin']) + $this->all_tracked[$key]['race_time']);
74 74
     			    if ($timerace > time()) $finaldatetime = NULL;
75
-    			    else $finaldatetime = date('Y-m-d H:i:s',$timerace);
76
-    			    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
75
+    			    else $finaldatetime = date('Y-m-d H:i:s', $timerace);
76
+    			    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $finaldatetime, $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']);
77 77
     			}
78 78
     		    } else {
79
-			$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
79
+			$Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']);
80 80
 		    }
81 81
 		}
82 82
 	    }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
90 90
 	foreach ($this->all_tracked as $key => $flight) {
91 91
     	    if (isset($flight['lastupdate'])) {
92
-        	if ($flight['lastupdate'] < (time()-3000)) {
92
+        	if ($flight['lastupdate'] < (time() - 3000)) {
93 93
             	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
94 94
             		if (isset($this->all_tracked[$key]['id'])) {
95 95
             		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
             		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
104 104
 				if (isset($globalVM) && $globalVM) {
105 105
 				    if ($this->all_tracked[$key]['status'] == 'Racing') {
106
-					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
106
+					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']);
107 107
 				    } else {
108
-					$timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time'];
108
+					$timerace = strtotime($this->all_tracked[$key]['race_begin']) + $this->all_tracked[$key]['race_time'];
109 109
 	        			if ($timerace > time()) $finaldatetime = NULL;
110
-					else $finaldatetime = date('Y-m-d H:i:s',$timerace);
111
-					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
110
+					else $finaldatetime = date('Y-m-d H:i:s', $timerace);
111
+					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $finaldatetime, $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']);
112 112
 				    }
113 113
 				} else {
114
-					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
114
+					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']);
115 115
 				}
116 116
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
117 117
 			    }
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
     }
127 127
 
128 128
     public function add($line) {
129
-	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM;
129
+	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS, $APRSMarine, $globalLiveInterval, $globalVM;
130 130
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
131 131
 	date_default_timezone_set('UTC');
132 132
 	$dataFound = false;
133 133
 	$send = false;
134 134
 	
135 135
 	// SBS format is CSV format
136
-	if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) {
136
+	if (is_array($line) && (isset($line['mmsi']) || isset($line['id']))) {
137 137
 	    //print_r($line);
138 138
   	    if (isset($line['mmsi']) || isset($line['id'])) {
139 139
 
@@ -158,25 +158,25 @@  discard block
 block discarded – undo
158 158
 		
159 159
 		if (!isset($this->all_tracked[$id])) {
160 160
 		    $this->all_tracked[$id] = array();
161
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
162
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => ''));
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
161
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedMarine' => 0));
162
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'typeid' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '', 'mmsi' => '', 'status' => '', 'status_id' => '', 'imo' => '', 'callsign' => '', 'arrival_code' => '', 'arrival_date' => '', 'mmsi_type' => '', 'captain_id' => '', 'captain_name' => '', 'race_id' => '', 'race_name' => '', 'distance' => NULL, 'race_rank' => NULL, 'race_time' => NULL, 'race_begin' => ''));
163
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time()));
164 164
 		    if (!isset($line['id'])) {
165 165
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
166
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
167
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
166
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi')));
167
+		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id']));
168 168
 		    if ($globalAllTracked !== FALSE) $dataFound = true;
169 169
 		}
170 170
 		
171 171
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
172
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
172
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi' => $line['mmsi']));
173 173
 		    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
174 174
 			$Marine = new Marine($this->db);
175 175
 			$identity = $Marine->getIdentity($line['mmsi']);
176 176
 			if (!empty($identity)) {
177 177
 			    $this->all_tracked[$id]['ident'] = $identity['ship_name'];
178 178
 			    $this->all_tracked[$id]['type'] = $identity['type'];
179
-			    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type'])));
179
+			    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($identity['type'])));
180 180
 			}
181 181
 			//print_r($identity);
182 182
 			unset($Marine);
@@ -184,25 +184,25 @@  discard block
 block discarded – undo
184 184
 		    }
185 185
 		}
186 186
 		if (isset($line['type_id'])) {
187
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
188
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id']));
187
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $AIS->getShipType($line['type_id'])));
188
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $line['type_id']));
189 189
 		}
190 190
 		if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') {
191
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
192
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type'])));
191
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type']));
192
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($line['type'])));
193 193
 		} elseif (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] != '') {
194
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
194
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type']));
195 195
 		}
196 196
 		if (isset($line['status']) && $line['status'] != '') {
197
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
197
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status' => $line['status']));
198 198
 		}
199 199
 		if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) {
200
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
200
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status_id' => $line['status_id']));
201 201
 		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
202 202
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
203 203
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
204 204
 				$Marine = new Marine($this->db);
205
-				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']);
205
+				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['status']);
206 206
 				unset($Marine);
207 207
 			    }
208 208
 			}
@@ -211,24 +211,24 @@  discard block
 block discarded – undo
211 211
 
212 212
 
213 213
 		if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') {
214
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
214
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi_type' => $line['mmsi_type']));
215 215
 		}
216 216
 		if (isset($line['imo']) && $line['imo'] != '') {
217
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
217
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('imo' => $line['imo']));
218 218
 		}
219 219
 		if (isset($line['callsign']) && $line['callsign'] != '') {
220
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
220
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('callsign' => $line['callsign']));
221 221
 		}
222 222
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
223 223
 		    if (!isset($this->all_tracked[$id]['arrival_code'])) {
224
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
224
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_code' => $line['arrival_code']));
225 225
 			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
226 226
 			if ($this->all_tracked[$id]['addedMarine'] != 0) {
227 227
 			    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
228 228
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
229 229
 				    $Marine = new Marine($this->db);
230 230
 				    $fromsource = NULL;
231
-				    $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource);
231
+				    $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['arrival_code'], $fromsource);
232 232
 				    $Marine->db = null;
233 233
 				}
234 234
 			    }
@@ -244,31 +244,31 @@  discard block
 block discarded – undo
244 244
 		    }
245 245
 		}
246 246
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
247
-		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
247
+		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_date' => $line['arrival_date']));
248 248
 		}
249 249
 		if (isset($line['captain_id']) && $line['captain_id'] != '') {
250
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id']));
250
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('captain_id' => $line['captain_id']));
251 251
 		}
252 252
 		if (isset($line['captain_name']) && $line['captain_name'] != '') {
253
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name']));
253
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('captain_name' => $line['captain_name']));
254 254
 		}
255 255
 		if (isset($line['race_id']) && $line['race_id'] != '') {
256
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id']));
256
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_id' => $line['race_id']));
257 257
 		}
258 258
 		if (isset($line['race_name']) && $line['race_name'] != '') {
259
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name']));
259
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_name' => $line['race_name']));
260 260
 		}
261 261
 		if (isset($line['race_rank']) && $line['race_rank'] != '') {
262
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank']));
262
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_rank' => $line['race_rank']));
263 263
 		}
264 264
 		if (isset($line['race_time']) && $line['race_time'] != '') {
265
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time']));
265
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_time' => $line['race_time']));
266 266
 		}
267 267
 		if (isset($line['race_begin']) && $line['race_begin'] != '') {
268
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin']));
268
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_begin' => $line['race_begin']));
269 269
 		}
270 270
 		if (isset($line['distance']) && $line['distance'] != '') {
271
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance']));
271
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('distance' => $line['distance']));
272 272
 		}
273 273
 
274 274
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
@@ -277,44 +277,44 @@  discard block
 block discarded – undo
277 277
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
278 278
 			    $timeelapsed = microtime(true);
279 279
 			    $Marine = new Marine($this->db);
280
-			    $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']);
280
+			    $Marine->addIdentity($this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['type']);
281 281
 			    $Marine->db = null;
282 282
 			}
283 283
 		    }
284
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
284
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident'])));
285 285
 		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
286 286
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
287 287
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
288 288
 				$timeelapsed = microtime(true);
289 289
 				$Marine = new Marine($this->db);
290 290
 				$fromsource = NULL;
291
-				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
291
+				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource);
292 292
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
293 293
 				$Marine->db = null;
294
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
294
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
295 295
 			    }
296 296
 			}
297 297
 		    }
298
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
298
+		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident']));
299 299
 		}
300 300
 
301
-		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) {
301
+		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 30*60 && strtotime($line['datetime']) < time() + 20*60) {
302 302
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
303
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
303
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime']));
304 304
 		    } else {
305 305
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
306 306
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
307 307
 				return '';
308 308
 		    }
309
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) {
309
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time() - 30*60) {
310 310
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
311 311
 			return '';
312
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) {
312
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time() + 20*60) {
313 313
 			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
314 314
 			return '';
315 315
 		} elseif (!isset($line['datetime'])) {
316 316
 			date_default_timezone_set('UTC');
317
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
317
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s')));
318 318
 		} else {
319 319
 			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n";
320 320
 			return '';
@@ -322,20 +322,20 @@  discard block
 block discarded – undo
322 322
 
323 323
 
324 324
 		if (isset($line['speed'])) {
325
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2)));
326
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
325
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'], 2)));
326
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true));
327 327
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
328
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
328
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm');
329 329
 		    if ($distance > 1000 && $distance < 10000) {
330 330
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
331 331
 			$speed = $speed*3.6;
332
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2)));
332
+			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed, 2)));
333 333
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
334 334
 		    }
335 335
 		}
336 336
 
337 337
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
338
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
338
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']);
339 339
 	    	    else unset($timediff);
340 340
 	    	    if ($this->tmd > 5 ||
341 341
 	    		!isset($timediff) ||
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 	    		    $timediff > 30 && 
345 345
 	    		    isset($this->all_tracked[$id]['latitude']) &&
346 346
 	    		    isset($this->all_tracked[$id]['longitude']) &&
347
-	    		    $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'))
347
+	    		    $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'))
348 348
 	    		)
349 349
 	    		) {
350 350
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
351
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
351
+			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) {
352 352
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
353 353
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
354 354
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 				$timeelapsed = microtime(true);
358 358
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
359 359
 				    $Marine = new Marine($this->db);
360
-				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
360
+				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
361 361
 				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
362 362
 				    $Marine->db = null;
363
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
363
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
364 364
 				}
365 365
 				$this->tmd = 0;
366 366
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
@@ -369,55 +369,55 @@  discard block
 block discarded – undo
369 369
 
370 370
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
371 371
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
372
-				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
372
+				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
373 373
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
374 374
 				    $dataFound = true;
375 375
 				    $this->all_tracked[$id]['time_last_coord'] = time();
376 376
 				}
377
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
377
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude']));
378 378
 			}
379 379
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
380 380
 			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
381 381
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
382
-				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
382
+				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
383 383
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
384 384
 				    $dataFound = true;
385 385
 				    $this->all_tracked[$id]['time_last_coord'] = time();
386 386
 				}
387
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
387
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude']));
388 388
 			}
389 389
 
390 390
 		    } else if ($globalDebug && $timediff > 20) {
391 391
 			$this->tmd = $this->tmd + 1;
392 392
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
393
-			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
394
-			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
393
+			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -";
394
+			echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
395 395
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
396 396
 		    }
397 397
 		}
398 398
 		if (isset($line['last_update']) && $line['last_update'] != '') {
399 399
 		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
400
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
400
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update']));
401 401
 		}
402 402
 		if (isset($line['format_source']) && $line['format_source'] != '') {
403
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
403
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source']));
404 404
 		}
405 405
 		if (isset($line['source_name']) && $line['source_name'] != '') {
406
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
406
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name']));
407 407
 		}
408 408
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
409
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
409
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true));
410 410
 		}
411 411
 		
412 412
 		if (isset($line['heading']) && $line['heading'] != '') {
413
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
414
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
415
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
413
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
414
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading'])));
415
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true));
416 416
 		    //$dataFound = true;
417 417
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
418
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
419
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
420
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
418
+  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
419
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading)));
420
+		    if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
421 421
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
422 422
   		}
423 423
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) {
428 428
 		    $this->all_tracked[$id]['lastupdate'] = time();
429 429
 		    if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) {
430
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
430
+		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
431 431
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
432 432
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
433 433
 				    if ($globalDebug) echo "Check if vessel is already in DB...";
@@ -436,28 +436,28 @@  discard block
 block discarded – undo
436 436
 				    if (isset($line['id']) && isset($globalVM) && $globalVM) {
437 437
 					$Marine = new Marine($this->db);
438 438
 					$recent_ident = $Marine->checkId($line['id']);
439
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
440
-					$Marine->db=null;
439
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
440
+					$Marine->db = null;
441 441
 				    } elseif (isset($line['id'])) {
442 442
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
443
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
443
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
444 444
 				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
445 445
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
446
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
446
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
447 447
 				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
448 448
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
449
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
449
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
450 450
 				    } else $recent_ident = '';
451
-				    $MarineLive->db=null;
451
+				    $MarineLive->db = null;
452 452
 				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
453 453
 				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
454 454
 				} else $recent_ident = '';
455 455
 			    } else {
456 456
 				$recent_ident = '';
457
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
457
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0));
458 458
 			    }
459 459
 			    //if there was no vessel with the same callsign within the last hour and go post it into the archive
460
-			    if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM)))
460
+			    if ($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM)))
461 461
 			    {
462 462
 				if ($globalDebug) {
463 463
 					if ($this->all_tracked[$id]['mmsi'] == '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
@@ -465,19 +465,19 @@  discard block
 block discarded – undo
465 465
 				}
466 466
 				//adds the spotter data for the archive
467 467
 				    $highlight = '';
468
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
468
+				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
469 469
 				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
470 470
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
471 471
 					    $timeelapsed = microtime(true);
472 472
 					    $Marine = new Marine($this->db);
473 473
 					    if (isset($globalVM) && $globalVM && $this->all_tracked[$id]['race_begin'] != '') {
474
-						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
474
+						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']);
475 475
 					    } else {
476
-						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
476
+						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']);
477 477
 					    }
478 478
 					    $Marine->db = null;
479 479
 					    if ($globalDebug && isset($result)) echo $result."\n";
480
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
480
+					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
481 481
 					}
482 482
 				    }
483 483
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
@@ -485,15 +485,15 @@  discard block
 block discarded – undo
485 485
 					$Stats = new Stats($this->db);
486 486
 					if (!empty($this->stats)) {
487 487
 					    if ($globalDebug) echo 'Add source stats : ';
488
-				    	    foreach($this->stats as $date => $data) {
489
-						foreach($data as $source => $sourced) {
488
+				    	    foreach ($this->stats as $date => $data) {
489
+						foreach ($data as $source => $sourced) {
490 490
 					    	    //print_r($sourced);
491
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
492
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
491
+				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_marine', $date);
492
+				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_marine', $date);
493 493
 				    		    if (isset($sourced['msg'])) {
494 494
 				    			if (time() - $sourced['msg']['date'] > 10) {
495 495
 				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
496
-				    		    	    echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
496
+				    		    	    echo $Stats->addStatSource($nbmsg, $source, 'msg_marine', $date);
497 497
 			    			    	    unset($this->stats[$date][$source]['msg']);
498 498
 			    				}
499 499
 			    			    }
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
518 518
 					$MarineLive = new MarineLive($this->db);
519 519
 					$MarineLive->deleteLiveMarineData();
520
-					$MarineLive->db=null;
520
+					$MarineLive->db = null;
521 521
 					if ($globalDebug) echo " Done\n";
522 522
 				    }
523 523
 				    $this->last_delete = time();
@@ -530,17 +530,17 @@  discard block
 block discarded – undo
530 530
 					$Marine = new Marine($this->db);
531 531
 					if (isset($globalVM) && $globalVM) {
532 532
 					    if ($this->all_tracked[$id]['status'] == 'Racing') {
533
-						$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
533
+						$Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']);
534 534
 					    } else {
535 535
 						//$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']);
536
-						$timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']);
536
+						$timerace = (strtotime($this->all_tracked[$id]['race_begin']) + $this->all_tracked[$id]['race_time']);
537 537
 						if ($timerace > time()) $finaldatetime = NULL;
538
-						else $finaldatetime = date('Y-m-d H:i:s',$timerace);
538
+						else $finaldatetime = date('Y-m-d H:i:s', $timerace);
539 539
 
540
-						$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
540
+						$Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $finaldatetime, $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']);
541 541
 					    }
542 542
 					} else {
543
-					    $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
543
+					    $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']);
544 544
 					}
545 545
 					$Marine->db = null;
546 546
 				    }
@@ -556,20 +556,20 @@  discard block
 block discarded – undo
556 556
 		    $ignoreImport = false;
557 557
 		    if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true;
558 558
 		    if (!$ignoreImport) {
559
-			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
559
+			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
560 560
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
561 561
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
562 562
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
563 563
 					$timeelapsed = microtime(true);
564 564
 					$MarineLive = new MarineLive($this->db);
565
-					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
565
+					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']);
566 566
 					$MarineLive->db = null;
567 567
 					if ($globalDebug) echo $result."\n";
568
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
568
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
569 569
 				    }
570 570
 				}
571 571
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
572
-					$APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
572
+					$APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']);
573 573
 				}
574 574
 				$this->all_tracked[$id]['putinarchive'] = false;
575 575
 
@@ -588,19 +588,19 @@  discard block
 block discarded – undo
588 588
 							$latitude = $globalCenterLatitude;
589 589
 							$longitude = $globalCenterLongitude;
590 590
 						}
591
-						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude);
591
+						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude);
592 592
 					} else {
593 593
 						$latitude = $this->source_location[$source]['latitude'];
594 594
 						$longitude = $this->source_location[$source]['longitude'];
595 595
 					}
596
-					$stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
596
+					$stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
597 597
 					//$stats_heading = $stats_heading%22.5;
598 598
 					$stats_heading = round($stats_heading/22.5);
599
-					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
599
+					$stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
600 600
 					$current_date = date('Y-m-d');
601 601
 					if ($stats_heading == 16) $stats_heading = 0;
602 602
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
603
-						for ($i=0;$i<=15;$i++) {
603
+						for ($i = 0; $i <= 15; $i++) {
604 604
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
605 605
 						}
606 606
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
@@ -615,9 +615,9 @@  discard block
 block discarded – undo
615 615
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
616 616
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
617 617
 						    end($this->stats[$current_date][$source]['hist']);
618
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
618
+						    $mini = key($this->stats[$current_date][$source]['hist']) + 10;
619 619
 						} else $mini = 0;
620
-						for ($i=$mini;$i<=$distance;$i+=10) {
620
+						for ($i = $mini; $i <= $distance; $i += 10) {
621 621
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
622 622
 						}
623 623
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 
630 630
 				$this->all_tracked[$id]['lastupdate'] = time();
631 631
 				if ($this->all_tracked[$id]['putinarchive']) $send = true;
632
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
632
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n";
633 633
 			//$this->del();
634 634
 			
635 635
 			
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
     
657 657
     public function race_add($data) {
658 658
         $Marine = new Marine();
659
-        $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']);
659
+        $Marine->addRace($data['id'], $data['name'], $data['creator'], $data['desc'], $data['startdate'], $data['markers']);
660 660
         $Marine->db = null;
661 661
     }
662 662
 }
Please login to merge, or discard this patch.
Braces   +225 added lines, -78 removed lines patch added patch discarded remove patch
@@ -61,7 +61,9 @@  discard block
 block discarded – undo
61 61
     public function checkAll() {
62 62
 	global $globalDebug, $globalNoDB, $globalVM;
63 63
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
64
-	    if ($globalDebug) echo "Update last seen tracked data...\n";
64
+	    if ($globalDebug) {
65
+	    	echo "Update last seen tracked data...\n";
66
+	    }
65 67
 	    foreach ($this->all_tracked as $key => $flight) {
66 68
 		if (isset($this->all_tracked[$key]['id'])) {
67 69
 		    //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -71,8 +73,11 @@  discard block
 block discarded – undo
71 73
     			    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
72 74
     			} else {
73 75
     			    $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']);
74
-    			    if ($timerace > time()) $finaldatetime = NULL;
75
-    			    else $finaldatetime = date('Y-m-d H:i:s',$timerace);
76
+    			    if ($timerace > time()) {
77
+    			    	$finaldatetime = NULL;
78
+    			    } else {
79
+    			    	$finaldatetime = date('Y-m-d H:i:s',$timerace);
80
+    			    }
76 81
     			    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
77 82
     			}
78 83
     		    } else {
@@ -86,13 +91,17 @@  discard block
 block discarded – undo
86 91
     public function del() {
87 92
 	global $globalDebug, $globalNoDB, $globalNoImport;
88 93
 	// Delete old infos
89
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
94
+	if ($globalDebug) {
95
+		echo 'Delete old values and update latest data...'."\n";
96
+	}
90 97
 	foreach ($this->all_tracked as $key => $flight) {
91 98
     	    if (isset($flight['lastupdate'])) {
92 99
         	if ($flight['lastupdate'] < (time()-3000)) {
93 100
             	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
94 101
             		if (isset($this->all_tracked[$key]['id'])) {
95
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
102
+            		    if ($globalDebug) {
103
+            		    	echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
104
+            		    }
96 105
 			    /*
97 106
 			    $MarineLive = new MarineLive();
98 107
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
@@ -106,14 +115,19 @@  discard block
 block discarded – undo
106 115
 					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
107 116
 				    } else {
108 117
 					$timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time'];
109
-	        			if ($timerace > time()) $finaldatetime = NULL;
110
-					else $finaldatetime = date('Y-m-d H:i:s',$timerace);
118
+	        			if ($timerace > time()) {
119
+	        				$finaldatetime = NULL;
120
+	        			} else {
121
+						$finaldatetime = date('Y-m-d H:i:s',$timerace);
122
+					}
111 123
 					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
112 124
 				    }
113 125
 				} else {
114 126
 					$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
115 127
 				}
116
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
128
+				if ($globalDebug && $result != 'success') {
129
+					echo '!!! ERROR : '.$result."\n";
130
+				}
117 131
 			    }
118 132
 			    // Put in archive
119 133
 //				$Marine->db = null;
@@ -127,7 +141,9 @@  discard block
 block discarded – undo
127 141
 
128 142
     public function add($line) {
129 143
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM;
130
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
144
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
145
+		$globalCoordMinChange = '0.02';
146
+	}
131 147
 	date_default_timezone_set('UTC');
132 148
 	$dataFound = false;
133 149
 	$send = false;
@@ -141,20 +157,30 @@  discard block
 block discarded – undo
141 157
 		// Increment message number
142 158
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
143 159
 		    $current_date = date('Y-m-d');
144
-		    if (isset($line['source_name'])) $source = $line['source_name'];
145
-		    else $source = '';
146
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
160
+		    if (isset($line['source_name'])) {
161
+		    	$source = $line['source_name'];
162
+		    } else {
163
+		    	$source = '';
164
+		    }
165
+		    if ($source == '' || $line['format_source'] == 'aprs') {
166
+		    	$source = $line['format_source'];
167
+		    }
147 168
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
148 169
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
149 170
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
150
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
171
+		    } else {
172
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
173
+		    }
151 174
 		}
152 175
 		
153 176
 		
154 177
 		$Common = new Common();
155 178
 		$AIS = new AIS();
156
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
157
-	        else $id = trim($line['id']);
179
+	        if (!isset($line['id'])) {
180
+	        	$id = trim($line['mmsi']);
181
+	        } else {
182
+	        	$id = trim($line['id']);
183
+	        }
158 184
 		
159 185
 		if (!isset($this->all_tracked[$id])) {
160 186
 		    $this->all_tracked[$id] = array();
@@ -162,10 +188,16 @@  discard block
 block discarded – undo
162 188
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => ''));
163 189
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
164 190
 		    if (!isset($line['id'])) {
165
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
191
+			if (!isset($globalDaemon)) {
192
+				$globalDaemon = TRUE;
193
+			}
166 194
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
167
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
168
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
195
+		     } else {
196
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
197
+		     }
198
+		    if ($globalAllTracked !== FALSE) {
199
+		    	$dataFound = true;
200
+		    }
169 201
 		}
170 202
 		
171 203
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
@@ -222,7 +254,9 @@  discard block
 block discarded – undo
222 254
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
223 255
 		    if (!isset($this->all_tracked[$id]['arrival_code'])) {
224 256
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
225
-			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
257
+			if ($globalDebug) {
258
+				echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
259
+			}
226 260
 			if ($this->all_tracked[$id]['addedMarine'] != 0) {
227 261
 			    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
228 262
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -235,7 +269,9 @@  discard block
 block discarded – undo
235 269
 			}
236 270
 		    } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
237 271
 			$this->all_tracked[$id]['arrival_code'] = $line['arrival_code'];
238
-			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
272
+			if ($globalDebug) {
273
+				echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
274
+			}
239 275
 			if (!isset($line['id'])) {
240 276
 				$this->all_tracked[$id]['id'] = $id.'-'.date('YmdHi');
241 277
 				$this->all_tracked[$id]['forcenew'] = 1;
@@ -244,7 +280,9 @@  discard block
 block discarded – undo
244 280
 		    }
245 281
 		}
246 282
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
247
-		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
283
+		    if (strtotime($line['arrival_date']) > time()) {
284
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
285
+		    }
248 286
 		}
249 287
 		if (isset($line['captain_id']) && $line['captain_id'] != '') {
250 288
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id']));
@@ -289,34 +327,49 @@  discard block
 block discarded – undo
289 327
 				$Marine = new Marine($this->db);
290 328
 				$fromsource = NULL;
291 329
 				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
292
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
330
+				if ($globalDebug && $result != 'success') {
331
+					echo '!!! ERROR : '.$result."\n";
332
+				}
293 333
 				$Marine->db = null;
294
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
334
+				if ($globalDebugTimeElapsed) {
335
+					echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
336
+				}
295 337
 			    }
296 338
 			}
297 339
 		    }
298
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
340
+		    if (!isset($this->all_tracked[$id]['id'])) {
341
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
342
+		    }
299 343
 		}
300 344
 
301 345
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) {
302 346
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
303 347
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
304 348
 		    } else {
305
-				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
306
-				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
349
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
350
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
351
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
352
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
353
+				}
307 354
 				return '';
308 355
 		    }
309 356
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) {
310
-			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
357
+			if ($globalDebug) {
358
+				echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
359
+			}
311 360
 			return '';
312 361
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) {
313
-			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
362
+			if ($globalDebug) {
363
+				echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
364
+			}
314 365
 			return '';
315 366
 		} elseif (!isset($line['datetime'])) {
316 367
 			date_default_timezone_set('UTC');
317 368
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
318 369
 		} else {
319
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n";
370
+			if ($globalDebug) {
371
+				echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n";
372
+			}
320 373
 			return '';
321 374
 		}
322 375
 
@@ -329,14 +382,21 @@  discard block
 block discarded – undo
329 382
 		    if ($distance > 1000 && $distance < 10000) {
330 383
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
331 384
 			$speed = $speed*3.6;
332
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2)));
333
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
385
+			if ($speed < 1000) {
386
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2)));
387
+			}
388
+  			if ($globalDebug) {
389
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
390
+  			}
334 391
 		    }
335 392
 		}
336 393
 
337 394
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
338
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
339
-	    	    else unset($timediff);
395
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
396
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
397
+	    	    } else {
398
+	    	    	unset($timediff);
399
+	    	    }
340 400
 	    	    if ($this->tmd > 5 ||
341 401
 	    		!isset($timediff) ||
342 402
 	    		$timediff > $globalLiveInterval ||
@@ -353,22 +413,32 @@  discard block
 block discarded – undo
353 413
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
354 414
 				$this->all_tracked[$id]['putinarchive'] = true;
355 415
 				
356
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
416
+				if ($globalDebug) {
417
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
418
+				}
357 419
 				$timeelapsed = microtime(true);
358 420
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
359 421
 				    $Marine = new Marine($this->db);
360 422
 				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
361
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
423
+				    if (!empty($all_country)) {
424
+				    	$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
425
+				    }
362 426
 				    $Marine->db = null;
363
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
427
+				    if ($globalDebugTimeElapsed) {
428
+				    	echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
429
+				    }
364 430
 				}
365 431
 				$this->tmd = 0;
366
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
432
+				if ($globalDebug) {
433
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
434
+				}
367 435
 			    }
368 436
 			}
369 437
 
370 438
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
371
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
439
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
440
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
441
+				}
372 442
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
373 443
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
374 444
 				    $dataFound = true;
@@ -377,8 +447,12 @@  discard block
 block discarded – undo
377 447
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
378 448
 			}
379 449
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
380
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
381
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
450
+			    if ($line['longitude'] > 180) {
451
+			    	$line['longitude'] = $line['longitude'] - 360;
452
+			    }
453
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
454
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
455
+				}
382 456
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
383 457
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
384 458
 				    $dataFound = true;
@@ -396,7 +470,9 @@  discard block
 block discarded – undo
396 470
 		    }
397 471
 		}
398 472
 		if (isset($line['last_update']) && $line['last_update'] != '') {
399
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
473
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
474
+		    	$dataFound = true;
475
+		    }
400 476
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
401 477
 		}
402 478
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -410,15 +486,21 @@  discard block
 block discarded – undo
410 486
 		}
411 487
 		
412 488
 		if (isset($line['heading']) && $line['heading'] != '') {
413
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
489
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
490
+		    	$this->all_tracked[$id]['putinarchive'] = true;
491
+		    }
414 492
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
415 493
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
416 494
 		    //$dataFound = true;
417 495
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
418 496
   		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
419 497
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
420
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
421
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
498
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
499
+		    	$this->all_tracked[$id]['putinarchive'] = true;
500
+		    }
501
+  		    if ($globalDebug) {
502
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
503
+  		    }
422 504
   		}
423 505
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
424 506
 
@@ -430,28 +512,45 @@  discard block
 block discarded – undo
430 512
 		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
431 513
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
432 514
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
433
-				    if ($globalDebug) echo "Check if vessel is already in DB...";
515
+				    if ($globalDebug) {
516
+				    	echo "Check if vessel is already in DB...";
517
+				    }
434 518
 				    $timeelapsed = microtime(true);
435 519
 				    $MarineLive = new MarineLive($this->db);
436 520
 				    if (isset($line['id']) && isset($globalVM) && $globalVM) {
437 521
 					$Marine = new Marine($this->db);
438 522
 					$recent_ident = $Marine->checkId($line['id']);
439
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
523
+					if ($globalDebugTimeElapsed) {
524
+						echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
525
+					}
440 526
 					$Marine->db=null;
441 527
 				    } elseif (isset($line['id'])) {
442 528
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
443
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
529
+					if ($globalDebugTimeElapsed) {
530
+						echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
531
+					}
444 532
 				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
445 533
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
446
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
534
+					if ($globalDebugTimeElapsed) {
535
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
536
+					}
447 537
 				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
448 538
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
449
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
450
-				    } else $recent_ident = '';
539
+					if ($globalDebugTimeElapsed) {
540
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
541
+					}
542
+				    } else {
543
+				    	$recent_ident = '';
544
+				    }
451 545
 				    $MarineLive->db=null;
452
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
453
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
454
-				} else $recent_ident = '';
546
+				    if ($globalDebug && $recent_ident == '') {
547
+				    	echo " Not in DB.\n";
548
+				    } elseif ($globalDebug && $recent_ident != '') {
549
+				    	echo " Already in DB.\n";
550
+				    }
551
+				} else {
552
+					$recent_ident = '';
553
+				}
455 554
 			    } else {
456 555
 				$recent_ident = '';
457 556
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -460,12 +559,17 @@  discard block
 block discarded – undo
460 559
 			    if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM)))
461 560
 			    {
462 561
 				if ($globalDebug) {
463
-					if ($this->all_tracked[$id]['mmsi'] == '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
464
-					else echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
562
+					if ($this->all_tracked[$id]['mmsi'] == '') {
563
+						echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
564
+					} else {
565
+						echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
566
+					}
465 567
 				}
466 568
 				//adds the spotter data for the archive
467 569
 				    $highlight = '';
468
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
570
+				    if (!isset($this->all_tracked[$id]['id'])) {
571
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
572
+				    }
469 573
 				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
470 574
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
471 575
 					    $timeelapsed = microtime(true);
@@ -476,20 +580,30 @@  discard block
 block discarded – undo
476 580
 						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
477 581
 					    }
478 582
 					    $Marine->db = null;
479
-					    if ($globalDebug && isset($result)) echo $result."\n";
480
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
583
+					    if ($globalDebug && isset($result)) {
584
+					    	echo $result."\n";
585
+					    }
586
+					    if ($globalDebugTimeElapsed) {
587
+					    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
588
+					    }
481 589
 					}
482 590
 				    }
483 591
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
484 592
 					// Add source stat in DB
485 593
 					$Stats = new Stats($this->db);
486 594
 					if (!empty($this->stats)) {
487
-					    if ($globalDebug) echo 'Add source stats : ';
595
+					    if ($globalDebug) {
596
+					    	echo 'Add source stats : ';
597
+					    }
488 598
 				    	    foreach($this->stats as $date => $data) {
489 599
 						foreach($data as $source => $sourced) {
490 600
 					    	    //print_r($sourced);
491
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
492
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
601
+				    	    	    if (isset($sourced['polar'])) {
602
+				    	    	    	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
603
+				    	    	    }
604
+				    	    	    if (isset($sourced['hist'])) {
605
+				    	    	    	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
606
+				    	    	    }
493 607
 				    		    if (isset($sourced['msg'])) {
494 608
 				    			if (time() - $sourced['msg']['date'] > 10) {
495 609
 				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -502,7 +616,9 @@  discard block
 block discarded – undo
502 616
 			    			    unset($this->stats[$date]);
503 617
 			    			}
504 618
 				    	    }
505
-				    	    if ($globalDebug) echo 'Done'."\n";
619
+				    	    if ($globalDebug) {
620
+				    	    	echo 'Done'."\n";
621
+				    	    }
506 622
 					}
507 623
 					$Stats->db = null;
508 624
 				    }
@@ -512,13 +628,17 @@  discard block
 block discarded – undo
512 628
 				$this->all_tracked[$id]['addedMarine'] = 1;
513 629
 				//print_r($this->all_tracked[$id]);
514 630
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
515
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
631
+				    if ($globalDebug) {
632
+				    	echo "---- Deleting Live Marine data older than 9 hours...";
633
+				    }
516 634
 				    //MarineLive->deleteLiveMarineDataNotUpdated();
517 635
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
518 636
 					$MarineLive = new MarineLive($this->db);
519 637
 					$MarineLive->deleteLiveMarineData();
520 638
 					$MarineLive->db=null;
521
-					if ($globalDebug) echo " Done\n";
639
+					if ($globalDebug) {
640
+						echo " Done\n";
641
+					}
522 642
 				    }
523 643
 				    $this->last_delete = time();
524 644
 				}
@@ -534,8 +654,11 @@  discard block
 block discarded – undo
534 654
 					    } else {
535 655
 						//$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']);
536 656
 						$timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']);
537
-						if ($timerace > time()) $finaldatetime = NULL;
538
-						else $finaldatetime = date('Y-m-d H:i:s',$timerace);
657
+						if ($timerace > time()) {
658
+							$finaldatetime = NULL;
659
+						} else {
660
+							$finaldatetime = date('Y-m-d H:i:s',$timerace);
661
+						}
539 662
 
540 663
 						$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
541 664
 					    }
@@ -554,18 +677,26 @@  discard block
 block discarded – undo
554 677
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
555 678
 		    }
556 679
 		    $ignoreImport = false;
557
-		    if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true;
680
+		    if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') {
681
+		    	$ignoreImport = true;
682
+		    }
558 683
 		    if (!$ignoreImport) {
559 684
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
560
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
685
+				if ($globalDebug) {
686
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
687
+				}
561 688
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
562 689
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
563 690
 					$timeelapsed = microtime(true);
564 691
 					$MarineLive = new MarineLive($this->db);
565 692
 					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
566 693
 					$MarineLive->db = null;
567
-					if ($globalDebug) echo $result."\n";
568
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
694
+					if ($globalDebug) {
695
+						echo $result."\n";
696
+					}
697
+					if ($globalDebugTimeElapsed) {
698
+						echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
699
+					}
569 700
 				    }
570 701
 				}
571 702
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
@@ -577,7 +708,9 @@  discard block
 block discarded – undo
577 708
 				
578 709
 				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
579 710
 					$source = $this->all_tracked[$id]['source_name'];
580
-					if ($source == '') $source = $this->all_tracked[$id]['format_source'];
711
+					if ($source == '') {
712
+						$source = $this->all_tracked[$id]['format_source'];
713
+					}
581 714
 					if (!isset($this->source_location[$source])) {
582 715
 						$Location = new Source($this->db);
583 716
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -598,7 +731,9 @@  discard block
 block discarded – undo
598 731
 					$stats_heading = round($stats_heading/22.5);
599 732
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
600 733
 					$current_date = date('Y-m-d');
601
-					if ($stats_heading == 16) $stats_heading = 0;
734
+					if ($stats_heading == 16) {
735
+						$stats_heading = 0;
736
+					}
602 737
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
603 738
 						for ($i=0;$i<=15;$i++) {
604 739
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -616,7 +751,9 @@  discard block
 block discarded – undo
616 751
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
617 752
 						    end($this->stats[$current_date][$source]['hist']);
618 753
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
619
-						} else $mini = 0;
754
+						} else {
755
+							$mini = 0;
756
+						}
620 757
 						for ($i=$mini;$i<=$distance;$i+=10) {
621 758
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
622 759
 						}
@@ -628,19 +765,27 @@  discard block
 block discarded – undo
628 765
 				
629 766
 
630 767
 				$this->all_tracked[$id]['lastupdate'] = time();
631
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
632
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
768
+				if ($this->all_tracked[$id]['putinarchive']) {
769
+					$send = true;
770
+				}
771
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
772
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
773
+			}
633 774
 			//$this->del();
634 775
 			
635 776
 			
636 777
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
637 778
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
638
-				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
779
+				if ($globalDebug) {
780
+					echo "---- Deleting Live Marine data Not updated since 2 hour...";
781
+				}
639 782
 				$MarineLive = new MarineLive($this->db);
640 783
 				$MarineLive->deleteLiveMarineDataNotUpdated();
641 784
 				$MarineLive->db = null;
642 785
 				//MarineLive->deleteLiveMarineData();
643
-				if ($globalDebug) echo " Done\n";
786
+				if ($globalDebug) {
787
+					echo " Done\n";
788
+				}
644 789
 			    }
645 790
 			    $this->last_delete_hourly = time();
646 791
 			}
@@ -649,7 +794,9 @@  discard block
 block discarded – undo
649 794
 		    //$ignoreImport = false;
650 795
 		}
651 796
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
652
-		if ($send) return $this->all_tracked[$id];
797
+		if ($send) {
798
+			return $this->all_tracked[$id];
799
+		}
653 800
 	    }
654 801
 	}
655 802
     }
Please login to merge, or discard this patch.
search.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -91,32 +91,32 @@
 block discarded – undo
91 91
 $limit_previous_2 = $limit_end - $absolute_difference;
92 92
 
93 93
 if (
94
-    (isset($_GET['q']) && $_GET['q'] != '') || 
95
-    (isset($_GET['registration']) && $_GET['registration'] != '') || 
96
-    (isset($_GET['aircraft']) && $_GET['aircraft'] != '') ||
97
-    (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') ||
98
-    (isset($_GET['highlights']) && $_GET['highlights'] != '') ||
99
-    (isset($_GET['airline']) && $_GET['airline'] != '') ||
100
-    (isset($_GET['airline_country']) && $_GET['airline_country'] != '') ||
101
-    (isset($_GET['airline_type']) && $_GET['airline_type'] != '') ||
102
-    (isset($_GET['airport']) && $_GET['airport'] != '') ||
103
-    (isset($_GET['airport_country']) && $_GET['airport_country'] != '') ||
104
-    (isset($_GET['callsign']) && $_GET['callsign'] != '') ||
105
-    (isset($_GET['captain_id']) && $_GET['captain_id'] != '') ||
106
-    (isset($_GET['race_id']) && $_GET['race_id'] != '') ||
107
-    (isset($_GET['captain_name']) && $_GET['captain_name'] != '') ||
108
-    (isset($_GET['race_name']) && $_GET['race_name'] != '') ||
109
-    (isset($_GET['owner']) && $_GET['owner'] != '') ||
110
-    (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') ||
111
-    (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') ||
112
-    (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') ||
113
-    (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') ||
114
-    (isset($_GET['mmsi']) && $_GET['mmsi'] != '') ||
115
-    (isset($_GET['imo']) && $_GET['imo'] != '') ||
116
-    ((isset($_GET['origlat']) && $_GET['origlat'] != '') &&
117
-    (isset($_GET['origlon']) && $_GET['origlon'] != '') &&
118
-    (isset($_GET['dist']) && $_GET['dist'] != ''))
119
-    ){  
94
+	(isset($_GET['q']) && $_GET['q'] != '') || 
95
+	(isset($_GET['registration']) && $_GET['registration'] != '') || 
96
+	(isset($_GET['aircraft']) && $_GET['aircraft'] != '') ||
97
+	(isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') ||
98
+	(isset($_GET['highlights']) && $_GET['highlights'] != '') ||
99
+	(isset($_GET['airline']) && $_GET['airline'] != '') ||
100
+	(isset($_GET['airline_country']) && $_GET['airline_country'] != '') ||
101
+	(isset($_GET['airline_type']) && $_GET['airline_type'] != '') ||
102
+	(isset($_GET['airport']) && $_GET['airport'] != '') ||
103
+	(isset($_GET['airport_country']) && $_GET['airport_country'] != '') ||
104
+	(isset($_GET['callsign']) && $_GET['callsign'] != '') ||
105
+	(isset($_GET['captain_id']) && $_GET['captain_id'] != '') ||
106
+	(isset($_GET['race_id']) && $_GET['race_id'] != '') ||
107
+	(isset($_GET['captain_name']) && $_GET['captain_name'] != '') ||
108
+	(isset($_GET['race_name']) && $_GET['race_name'] != '') ||
109
+	(isset($_GET['owner']) && $_GET['owner'] != '') ||
110
+	(isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') ||
111
+	(isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') ||
112
+	(isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') ||
113
+	(isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') ||
114
+	(isset($_GET['mmsi']) && $_GET['mmsi'] != '') ||
115
+	(isset($_GET['imo']) && $_GET['imo'] != '') ||
116
+	((isset($_GET['origlat']) && $_GET['origlat'] != '') &&
117
+	(isset($_GET['origlon']) && $_GET['origlon'] != '') &&
118
+	(isset($_GET['dist']) && $_GET['dist'] != ''))
119
+	){  
120 120
 	$q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING);
121 121
 	$registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING);
122 122
 	$aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
 $sql_date = '';
27 27
 if (isset($_GET['start_date'])) {
28 28
 	//for the date manipulation into the query
29
-	if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
29
+	if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
30 30
 		if (strtotime($_GET['start_date']) !== false && strtotime($_GET['end_date']) !== false) {
31 31
 			//$start_date = $_GET['start_date']." 00:00:00";
32
-			$start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00";
32
+			$start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00";
33 33
 			//$end_date = $_GET['end_date']." 00:00:00";
34
-			$end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
34
+			$end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00";
35 35
 			$sql_date = $start_date.",".$end_date;
36 36
 		}
37
-	} else if($_GET['start_date'] != ""){
37
+	} else if ($_GET['start_date'] != "") {
38 38
 		if (strtotime($_GET['start_date']) !== false) {
39 39
 			//$start_date = $_GET['start_date']." 00:00:00";
40
-			$start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00";
40
+			$start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00";
41 41
 			$sql_date = $start_date;
42 42
 		}
43
-	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
43
+	} else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
44 44
 		if (strtotime($_GET['end_date']) !== false) {
45 45
 			//$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00";
46
-			$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
46
+			$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00";
47 47
 			$sql_date = $end_date;
48 48
 		}
49 49
 	} else $sql_date = '';
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 if (isset($_GET['highest_altitude'])) {
53 53
 	//for altitude manipulation
54
-	if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
55
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
56
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT);
54
+	if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
55
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
56
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT);
57 57
 		$sql_altitude = $start_altitude.",".$end_altitude;
58
-	} else if($_GET['highest_altitude'] != ""){
59
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
58
+	} else if ($_GET['highest_altitude'] != "") {
59
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
60 60
 		$sql_altitude = $end_altitude;
61
-	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
62
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
61
+	} else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
62
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000";
63 63
 		$sql_altitude = $start_altitude;
64 64
 	} else $sql_altitude = '';
65 65
 } else $sql_altitude = '';
66 66
 
67 67
 //calculuation for the pagination
68
-if(!isset($_GET['limit']))
68
+if (!isset($_GET['limit']))
69 69
 {
70 70
 	if (!isset($_GET['number_results']))
71 71
 	{
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 		$limit_end = 25;
74 74
 		$absolute_difference = 25;
75 75
 	} else {
76
-		if ($_GET['number_results'] > 1000){
76
+		if ($_GET['number_results'] > 1000) {
77 77
 			$_GET['number_results'] = 1000;
78 78
 		}
79 79
 		$limit_start = 0;
80
-		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
81
-		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
80
+		$limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
81
+		$absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
82 82
 	}
83
-}  else {
83
+} else {
84 84
 	$limit_explode = explode(",", $_GET['limit']);
85
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
86
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
85
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
86
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
87 87
 }
88 88
 $absolute_difference = abs($limit_start - $limit_end);
89 89
 $limit_next = $limit_end + $absolute_difference;
@@ -116,35 +116,35 @@  discard block
 block discarded – undo
116 116
     ((isset($_GET['origlat']) && $_GET['origlat'] != '') &&
117 117
     (isset($_GET['origlon']) && $_GET['origlon'] != '') &&
118 118
     (isset($_GET['dist']) && $_GET['dist'] != ''))
119
-    ){  
120
-	$q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING);
121
-	$registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING);
122
-	$aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING);
123
-	$manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING);
124
-	$highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING);
125
-	$airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING);
126
-	$airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING);
127
-	$airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING);
128
-	$airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING);
129
-	$airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING);
130
-	$callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING);
131
-	$owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING);
132
-	$pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING);
133
-	$pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING);
134
-	$mmsi = filter_input(INPUT_GET, 'mmsi',FILTER_SANITIZE_NUMBER_INT);
135
-	$imo = filter_input(INPUT_GET, 'imo',FILTER_SANITIZE_NUMBER_INT);
136
-	$captain_id  = filter_input(INPUT_GET, 'captain_id',FILTER_SANITIZE_NUMBER_INT);
137
-	$race_id  = filter_input(INPUT_GET, 'race_id',FILTER_SANITIZE_NUMBER_INT);
138
-	$captain_name  = filter_input(INPUT_GET, 'captain_name',FILTER_SANITIZE_STRING);
139
-	$race_name  = filter_input(INPUT_GET, 'race_name',FILTER_SANITIZE_STRING);
140
-	$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING);
141
-	$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING);
142
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
143
-	$archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT);
144
-	$origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
145
-	$origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
146
-	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
147
-	$number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
119
+    ) {  
120
+	$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
121
+	$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
122
+	$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
123
+	$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
124
+	$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
125
+	$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
126
+	$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
127
+	$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
128
+	$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
129
+	$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
130
+	$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
131
+	$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
132
+	$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
133
+	$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
134
+	$mmsi = filter_input(INPUT_GET, 'mmsi', FILTER_SANITIZE_NUMBER_INT);
135
+	$imo = filter_input(INPUT_GET, 'imo', FILTER_SANITIZE_NUMBER_INT);
136
+	$captain_id = filter_input(INPUT_GET, 'captain_id', FILTER_SANITIZE_NUMBER_INT);
137
+	$race_id = filter_input(INPUT_GET, 'race_id', FILTER_SANITIZE_NUMBER_INT);
138
+	$captain_name = filter_input(INPUT_GET, 'captain_name', FILTER_SANITIZE_STRING);
139
+	$race_name = filter_input(INPUT_GET, 'race_name', FILTER_SANITIZE_STRING);
140
+	$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
141
+	$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
142
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
143
+	$archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT);
144
+	$origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
145
+	$origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
146
+	$dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT);
147
+	$number_results = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
148 148
 	if ($dist != '') {
149 149
 		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
150 150
 		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 	if ($archive == 1) {
154 154
 		if ($type == 'aircraft') {
155 155
 			$SpotterArchive = new SpotterArchive();
156
-			$spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
156
+			$spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
157 157
 		}
158 158
 	} else {
159 159
 		if ($type == 'aircraft') {
160
-			$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
160
+			$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
161 161
 		} elseif ($type == 'tracker') {
162
-			$spotter_array = $Tracker->searchTrackerData($q,$callsign,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
162
+			$spotter_array = $Tracker->searchTrackerData($q, $callsign, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
163 163
 		} elseif ($type == 'marine') {
164
-			$spotter_array = $Marine->searchMarineData($q,$callsign,$mmsi,$imo,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist,$captain_id,$captain_name,$race_id,$race_name);
164
+			$spotter_array = $Marine->searchMarineData($q, $callsign, $mmsi, $imo, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist, $captain_id, $captain_name, $race_id, $race_name);
165 165
 		}
166 166
 	}
167 167
 	 
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 	//remove 3D=true parameter
198 198
 	$no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']);
199 199
 	$kmlURL = str_replace("http://", "kml://", $globalURL);
200
-	if (!isset($_GET['3D'])){
200
+	if (!isset($_GET['3D'])) {
201 201
 		print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>';
202 202
 	} else {
203 203
 		print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>';
204 204
 	}
205
-	if (isset($_GET['3D'])){
205
+	if (isset($_GET['3D'])) {
206 206
 		print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>';
207 207
 	} else {
208 208
 		print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>';
@@ -223,36 +223,36 @@  discard block
 block discarded – undo
223 223
 		print '<div class="column">';
224 224
 		print '<div class="info">';
225 225
 		print '<h1>'._("Search Results for").' ';
226
-		if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; }
227
-		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
228
-		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
229
-		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
230
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
231
-		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
232
-		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
233
-		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
234
-		if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; }
235
-		if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; }
236
-		if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; }
237
-		if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; }
238
-		if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; }
239
-		if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; }
240
-		if (isset($_GET['captain_id']) && $_GET['captain_id'] != ""){ print _("Captain id:").' <span>'.$captain_id.'</span> '; }
241
-		if (isset($_GET['captain_name']) && $_GET['captain_name'] != ""){ print _("Captain name:").' <span>'.$captain_name.'</span> '; }
242
-		if (isset($_GET['race_id']) && $_GET['race_id'] != ""){ print _("Race id:").' <span>'.$race_id.'</span> '; }
243
-		if (isset($_GET['race_name']) && $_GET['race_name'] != ""){ print _("Race name:").' <span>'.$race_name.'</span> '; }
244
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; }
245
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; }
246
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; }
247
-		if (isset($_GET['mmsi']) && $_GET['mmsi'] != ""){ print _("MMSI:").' <span>'.$mmsi.'</span> '; }
248
-		if (isset($_GET['imo']) && $_GET['imo'] != ""){ print _("IMO:").' <span>'.$imo.'</span> '; }
249
-		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; }
250
-		if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; }
251
-		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; }
252
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; }
253
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; }
254
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; }
255
-		if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; }
226
+		if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; }
227
+		if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
228
+		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
229
+		if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; }
230
+		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; }
231
+		if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; }
232
+		if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; }
233
+		if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; }
234
+		if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; }
235
+		if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; }
236
+		if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; }
237
+		if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; }
238
+		if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; }
239
+		if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; }
240
+		if (isset($_GET['captain_id']) && $_GET['captain_id'] != "") { print _("Captain id:").' <span>'.$captain_id.'</span> '; }
241
+		if (isset($_GET['captain_name']) && $_GET['captain_name'] != "") { print _("Captain name:").' <span>'.$captain_name.'</span> '; }
242
+		if (isset($_GET['race_id']) && $_GET['race_id'] != "") { print _("Race id:").' <span>'.$race_id.'</span> '; }
243
+		if (isset($_GET['race_name']) && $_GET['race_name'] != "") { print _("Race name:").' <span>'.$race_name.'</span> '; }
244
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; }
245
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; }
246
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; }
247
+		if (isset($_GET['mmsi']) && $_GET['mmsi'] != "") { print _("MMSI:").' <span>'.$mmsi.'</span> '; }
248
+		if (isset($_GET['imo']) && $_GET['imo'] != "") { print _("IMO:").' <span>'.$imo.'</span> '; }
249
+		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; }
250
+		if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; }
251
+		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; }
252
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; }
253
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; }
254
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; }
255
+		if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; }
256 256
 		print '</h1>';
257 257
 		print '</div>';
258 258
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 					    </select>
387 387
 					</div>
388 388
 				</div>
389
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
389
+				<script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
390 390
 				<div class="form-group">
391 391
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
392 392
 						<div class="col-sm-10">
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 							</select>
396 396
 						</div>
397 397
 				</div>
398
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
398
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
399 399
 				<div class="form-group">
400 400
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
401 401
 					<div class="col-sm-10">
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 					</div>
419 419
 				</div>
420 420
 <?php
421
-	}else {
421
+	} else {
422 422
 ?>
423 423
 				<div class="form-group">
424 424
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
 ?>
432 432
 				<div class="form-group">
433 433
 					<div class="col-sm-offset-2 col-sm-10">
434
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
435
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label>
434
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
435
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label>
436 436
 					</div>
437 437
 				</div>
438 438
 			</fieldset>
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 						</select>
447 447
 					</div>
448 448
 				</div>
449
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
449
+				<script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script>
450 450
 				<div class="form-group">
451 451
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
452 452
 					<div class="col-sm-10">
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 						</select>
456 456
 					</div>
457 457
 				</div>
458
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
458
+				<script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script>
459 459
 				<div class="form-group">
460 460
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
461 461
 					<div class="col-sm-10">
@@ -464,10 +464,10 @@  discard block
 block discarded – undo
464 464
 				</div>
465 465
 				<div class="form-group">
466 466
 					<div class="col-sm-offset-2 col-sm-10">
467
-						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
468
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
469
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
470
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
467
+						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
468
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
469
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
470
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
471 471
 					</div>
472 472
 				</div>
473 473
 			</fieldset>
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 						</select>
482 482
 					</div>
483 483
 				</div>
484
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
484
+				<script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
485 485
 				<div class="form-group">
486 486
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
487 487
 					<div class="col-sm-10">
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 						</select>
491 491
 					</div>
492 492
 				</div>
493
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
493
+				<script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script>
494 494
 			</fieldset>
495 495
 			<fieldset>
496 496
 				<legend><?php echo _("Route"); ?></legend>
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 						</select>
503 503
 					</div>
504 504
 				</div>
505
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
505
+				<script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
506 506
 				<div class="form-group">
507 507
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
508 508
 					<div class="col-sm-10">
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 						</select>
512 512
 					</div>
513 513
 				</div>
514
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
514
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
515 515
 			</fieldset>
516 516
 			<fieldset>
517 517
 				<legend>Altitude</legend>
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 							<option></option>
523 523
 <?php
524 524
 $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000);
525
-foreach($altitude_array as $altitude)
525
+foreach ($altitude_array as $altitude)
526 526
 {
527
-	if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude)
527
+	if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude)
528 528
 	{
529 529
 		print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>';
530 530
 	} else {
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 							<option></option>
543 543
 <?php
544 544
 	$altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000);
545
-	foreach($altitude_array as $altitude)
545
+	foreach ($altitude_array as $altitude)
546 546
 	{
547
-		if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude)
547
+		if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude)
548 548
 		{
549 549
 			print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>';
550 550
 		} else {
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 				<div class="col-sm-10">
707 707
 					<select class="form-control" name="number_results">
708 708
 <?php
709
-$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500,  600, 700, 800, 900, 1000);
710
-foreach($number_results_array as $number)
709
+$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000);
710
+foreach ($number_results_array as $number)
711 711
 {
712
-	if(isset($_GET['number_results']) && $_GET['number_results'] == $number)
712
+	if (isset($_GET['number_results']) && $_GET['number_results'] == $number)
713 713
 	{
714 714
 		print '<option value="'.$number.'" selected="selected">'.$number.'</option>';
715 715
 	} else {
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 		<fieldset>
729 729
 			<div class="form-group">
730 730
 				<div class="col-sm-offset-2 col-sm-10">
731
-					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label>
731
+					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label>
732 732
 					<p class="help-block">Disabled in demo</p>
733 733
 				</div>
734 734
 			</div>
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 		<fieldset>
740 740
 			<div class="form-group">
741 741
 				<div class="col-sm-offset-2 col-sm-10">
742
-					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label>
742
+					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label>
743 743
 				</div>
744 744
 			</div>
745 745
 		</fieldset>
Please login to merge, or discard this patch.
Braces   +158 added lines, -43 removed lines patch added patch discarded remove patch
@@ -46,8 +46,10 @@  discard block
 block discarded – undo
46 46
 			$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
47 47
 			$sql_date = $end_date;
48 48
 		}
49
-	} else $sql_date = '';
50
-}
49
+	} else {
50
+		$sql_date = '';
51
+	}
52
+	}
51 53
 
52 54
 if (isset($_GET['highest_altitude'])) {
53 55
 	//for altitude manipulation
@@ -61,8 +63,12 @@  discard block
 block discarded – undo
61 63
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
62 64
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
63 65
 		$sql_altitude = $start_altitude;
64
-	} else $sql_altitude = '';
65
-} else $sql_altitude = '';
66
+	} else {
67
+		$sql_altitude = '';
68
+	}
69
+	} else {
70
+	$sql_altitude = '';
71
+}
66 72
 
67 73
 //calculuation for the pagination
68 74
 if(!isset($_GET['limit']))
@@ -80,7 +86,7 @@  discard block
 block discarded – undo
80 86
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
81 87
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
82 88
 	}
83
-}  else {
89
+} else {
84 90
 	$limit_explode = explode(",", $_GET['limit']);
85 91
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
86 92
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -146,10 +152,15 @@  discard block
 block discarded – undo
146 152
 	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
147 153
 	$number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
148 154
 	if ($dist != '') {
149
-		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
150
-		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
155
+		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') {
156
+			$dist = $dist*1.60934;
157
+		} elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') {
158
+			$dist = $dist*1.852;
159
+		}
160
+	}
161
+	if (!isset($sql_date)) {
162
+		$sql_date = '';
151 163
 	}
152
-	if (!isset($sql_date)) $sql_date = '';
153 164
 	if ($archive == 1) {
154 165
 		if ($type == 'aircraft') {
155 166
 			$SpotterArchive = new SpotterArchive();
@@ -227,7 +238,10 @@  discard block
 block discarded – undo
227 238
 		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
228 239
 		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
229 240
 		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
230
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
241
+		if (isset($_GET['highlights'])) {
242
+			if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> ';
243
+		}
244
+		}
231 245
 		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
232 246
 		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
233 247
 		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
@@ -367,7 +381,10 @@  discard block
 block discarded – undo
367 381
 			<div class="form-group">
368 382
 				<label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label>
369 383
 				<div class="col-sm-10">
370
-					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
384
+					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) {
385
+	print $q;
386
+}
387
+?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
371 388
 				</div>
372 389
 			</div>
373 390
 		</fieldset>
@@ -386,7 +403,10 @@  discard block
 block discarded – undo
386 403
 					    </select>
387 404
 					</div>
388 405
 				</div>
389
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
406
+				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) {
407
+	print $manufacturer;
408
+}
409
+?>')</script>
390 410
 				<div class="form-group">
391 411
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
392 412
 						<div class="col-sm-10">
@@ -395,11 +415,17 @@  discard block
 block discarded – undo
395 415
 							</select>
396 416
 						</div>
397 417
 				</div>
398
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
418
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) {
419
+	print $aircraft_icao;
420
+}
421
+?>');</script>
399 422
 				<div class="form-group">
400 423
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
401 424
 					<div class="col-sm-10">
402
-						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
425
+						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) {
426
+	print $registration;
427
+}
428
+?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
403 429
 					</div>
404 430
 				</div>
405 431
 <?php
@@ -408,22 +434,31 @@  discard block
 block discarded – undo
408 434
 				<div class="form-group">
409 435
 					<label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> 
410 436
 					<div class="col-sm-10">
411
-						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
437
+						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) {
438
+	print $pilot_id;
439
+}
440
+?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
412 441
 					</div>
413 442
 				</div>
414 443
 				<div class="form-group">
415 444
 					<label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> 
416 445
 					<div class="col-sm-10">
417
-						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
446
+						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) {
447
+	print $pilot_name;
448
+}
449
+?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
418 450
 					</div>
419 451
 				</div>
420 452
 <?php
421
-	}else {
453
+	} else {
422 454
 ?>
423 455
 				<div class="form-group">
424 456
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
425 457
 					<div class="col-sm-10">
426
-						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
458
+						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) {
459
+	print $owner;
460
+}
461
+?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
427 462
 					</div>
428 463
 				</div>
429 464
 <?php
@@ -431,8 +466,14 @@  discard block
 block discarded – undo
431 466
 ?>
432 467
 				<div class="form-group">
433 468
 					<div class="col-sm-offset-2 col-sm-10">
434
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
435
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label>
469
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
470
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
471
+}
472
+} ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
473
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
474
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
475
+}
476
+} ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label>
436 477
 					</div>
437 478
 				</div>
438 479
 			</fieldset>
@@ -446,7 +487,10 @@  discard block
 block discarded – undo
446 487
 						</select>
447 488
 					</div>
448 489
 				</div>
449
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
490
+				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) {
491
+	print $airline;
492
+}
493
+?>');</script>
450 494
 				<div class="form-group">
451 495
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
452 496
 					<div class="col-sm-10">
@@ -455,19 +499,34 @@  discard block
 block discarded – undo
455 499
 						</select>
456 500
 					</div>
457 501
 				</div>
458
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
502
+				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) {
503
+	print $airline_country;
504
+}
505
+?>');</script>
459 506
 				<div class="form-group">
460 507
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
461 508
 					<div class="col-sm-10">
462
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
509
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
510
+	print $callsign;
511
+}
512
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
463 513
 					</div>
464 514
 				</div>
465 515
 				<div class="form-group">
466 516
 					<div class="col-sm-offset-2 col-sm-10">
467 517
 						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
468
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
469
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
470
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
518
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) {
519
+	if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"';
520
+}
521
+} ?>> <?php echo _("Only Passenger airlines"); ?></label>
522
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) {
523
+	if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"';
524
+}
525
+} ?>> <?php echo _("Only Cargo airlines"); ?></label>
526
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) {
527
+	if ( $_GET['airline_type'] == "military"){ print 'checked="checked"';
528
+}
529
+} ?>> <?php echo _("Only Military airlines"); ?></label>
471 530
 					</div>
472 531
 				</div>
473 532
 			</fieldset>
@@ -481,7 +540,10 @@  discard block
 block discarded – undo
481 540
 						</select>
482 541
 					</div>
483 542
 				</div>
484
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
543
+				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) {
544
+	print $airport_icao;
545
+}
546
+?>');</script>
485 547
 				<div class="form-group">
486 548
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
487 549
 					<div class="col-sm-10">
@@ -490,7 +552,10 @@  discard block
 block discarded – undo
490 552
 						</select>
491 553
 					</div>
492 554
 				</div>
493
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
555
+				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) {
556
+	print $airport_country;
557
+}
558
+?>');</script>
494 559
 			</fieldset>
495 560
 			<fieldset>
496 561
 				<legend><?php echo _("Route"); ?></legend>
@@ -502,7 +567,10 @@  discard block
 block discarded – undo
502 567
 						</select>
503 568
 					</div>
504 569
 				</div>
505
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
570
+				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) {
571
+	print $departure_airport_route;
572
+}
573
+?>');</script>
506 574
 				<div class="form-group">
507 575
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
508 576
 					<div class="col-sm-10">
@@ -511,7 +579,10 @@  discard block
 block discarded – undo
511 579
 						</select>
512 580
 					</div>
513 581
 				</div>
514
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
582
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) {
583
+	print $arrival_airport_route;
584
+}
585
+?>');</script>
515 586
 			</fieldset>
516 587
 			<fieldset>
517 588
 				<legend>Altitude</legend>
@@ -561,19 +632,33 @@  discard block
 block discarded – undo
561 632
 				<div class="form-group">
562 633
 					<label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label>
563 634
 					<div class="col-sm-10">
564
-						<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" />
635
+						<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) {
636
+	print $origlat;
637
+}
638
+?>" />
565 639
 					</div>
566 640
 				</div>
567 641
 				<div class="form-group">
568 642
 					<label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label>
569 643
 					<div class="col-sm-10">
570
-						<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" />
644
+						<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) {
645
+	print $origlon;
646
+}
647
+?>" />
571 648
 					</div>
572 649
 				</div>
573 650
 				<div class="form-group">
574
-					<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label>
651
+					<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) {
652
+	print $globalDistanceUnit;
653
+} else {
654
+	print 'km';
655
+}
656
+print ')'; ?></label>
575 657
 					<div class="col-sm-10">
576
-						<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" />
658
+						<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) {
659
+	print $distance;
660
+}
661
+?>" />
577 662
 					</div>
578 663
 				</div>
579 664
 			</fieldset>
@@ -584,7 +669,10 @@  discard block
 block discarded – undo
584 669
 				<div class="form-group">
585 670
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
586 671
 					<div class="col-sm-10">
587
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
672
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
673
+	print $callsign;
674
+}
675
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
588 676
 					</div>
589 677
 				</div>
590 678
 			</fieldset>
@@ -595,7 +683,10 @@  discard block
 block discarded – undo
595 683
 				<div class="form-group">
596 684
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
597 685
 					<div class="col-sm-10">
598
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
686
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
687
+	print $callsign;
688
+}
689
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
599 690
 					</div>
600 691
 				</div>
601 692
 			</fieldset>
@@ -606,7 +697,10 @@  discard block
 block discarded – undo
606 697
 				<div class="form-group">
607 698
 					<label class="control-label col-sm-2"><?php echo _("Captain id"); ?></label> 
608 699
 					<div class="col-sm-10">
609
-						<input type="text" name="captain_id" class="form-control" value="<?php if (isset($_GET['captain_id'])) print $captain_id; ?>" size="8" placeholder="<?php echo _("Captain id"); ?>" />
700
+						<input type="text" name="captain_id" class="form-control" value="<?php if (isset($_GET['captain_id'])) {
701
+	print $captain_id;
702
+}
703
+?>" size="8" placeholder="<?php echo _("Captain id"); ?>" />
610 704
 					</div>
611 705
 				</div>
612 706
 			</fieldset>
@@ -614,7 +708,10 @@  discard block
 block discarded – undo
614 708
 				<div class="form-group">
615 709
 					<label class="control-label col-sm-2"><?php echo _("Captain name"); ?></label> 
616 710
 					<div class="col-sm-10">
617
-						<input type="text" name="captain_name" class="form-control" value="<?php if (isset($_GET['captain_name'])) print $captain_name; ?>" size="8" placeholder="<?php echo _("Captain name"); ?>" />
711
+						<input type="text" name="captain_name" class="form-control" value="<?php if (isset($_GET['captain_name'])) {
712
+	print $captain_name;
713
+}
714
+?>" size="8" placeholder="<?php echo _("Captain name"); ?>" />
618 715
 					</div>
619 716
 				</div>
620 717
 			</fieldset>
@@ -622,7 +719,10 @@  discard block
 block discarded – undo
622 719
 				<div class="form-group">
623 720
 					<label class="control-label col-sm-2"><?php echo _("Race id"); ?></label> 
624 721
 					<div class="col-sm-10">
625
-						<input type="text" name="race_id" class="form-control" value="<?php if (isset($_GET['race_id'])) print $race_id; ?>" size="8" placeholder="<?php echo _("Race id"); ?>" />
722
+						<input type="text" name="race_id" class="form-control" value="<?php if (isset($_GET['race_id'])) {
723
+	print $race_id;
724
+}
725
+?>" size="8" placeholder="<?php echo _("Race id"); ?>" />
626 726
 					</div>
627 727
 				</div>
628 728
 			</fieldset>
@@ -630,7 +730,10 @@  discard block
 block discarded – undo
630 730
 				<div class="form-group">
631 731
 					<label class="control-label col-sm-2"><?php echo _("Race name"); ?></label> 
632 732
 					<div class="col-sm-10">
633
-						<input type="text" name="race_name" class="form-control" value="<?php if (isset($_GET['race_name'])) print $race_name; ?>" size="8" placeholder="<?php echo _("Race name"); ?>" />
733
+						<input type="text" name="race_name" class="form-control" value="<?php if (isset($_GET['race_name'])) {
734
+	print $race_name;
735
+}
736
+?>" size="8" placeholder="<?php echo _("Race name"); ?>" />
634 737
 					</div>
635 738
 				</div>
636 739
 			</fieldset>
@@ -641,7 +744,10 @@  discard block
 block discarded – undo
641 744
 				<div class="form-group">
642 745
 					<label class="control-label col-sm-2"><?php echo _("MMSI"); ?></label> 
643 746
 					<div class="col-sm-10">
644
-						<input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) print $mmsi; ?>" size="8" placeholder="<?php echo _("MMSI"); ?>" />
747
+						<input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) {
748
+	print $mmsi;
749
+}
750
+?>" size="8" placeholder="<?php echo _("MMSI"); ?>" />
645 751
 					</div>
646 752
 				</div>
647 753
 			</fieldset>
@@ -649,7 +755,10 @@  discard block
 block discarded – undo
649 755
 				<div class="form-group">
650 756
 					<label class="control-label col-sm-2"><?php echo _("IMO"); ?></label> 
651 757
 					<div class="col-sm-10">
652
-						<input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) print $imo; ?>" size="8" placeholder="<?php echo _("IMO"); ?>" />
758
+						<input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) {
759
+	print $imo;
760
+}
761
+?>" size="8" placeholder="<?php echo _("IMO"); ?>" />
653 762
 					</div>
654 763
 				</div>
655 764
 			</fieldset>
@@ -663,7 +772,10 @@  discard block
 block discarded – undo
663 772
 					<label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label>
664 773
 					<div class="col-sm-10">
665 774
 						<div class='input-group date' id='datetimepicker1'>
666
-							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
775
+							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') {
776
+	print $start_date;
777
+}
778
+?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
667 779
 							<span class="input-group-addon">
668 780
 								<span class="glyphicon glyphicon-calendar"></span>
669 781
 							</span>
@@ -674,7 +786,10 @@  discard block
 block discarded – undo
674 786
 					<label class="control-label col-sm-2"><?php echo _("End Date"); ?></label>
675 787
 					<div class="col-sm-10">
676 788
 						<div class='input-group date' id='datetimepicker2'>
677
-						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" />
789
+						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') {
790
+	print $end_date;
791
+}
792
+?>" placeholder="<?php echo _("End Date/Time"); ?>" />
678 793
 						<span class="input-group-addon">
679 794
 							<span class="glyphicon glyphicon-calendar"></span>
680 795
 						</span>
Please login to merge, or discard this patch.
weather-json.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
 header('Content-Type: text/javascript');
12 12
 $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
13 13
 $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
14
-if ($latitude == '' || $longitude == '') return '';
14
+if ($latitude == '' || $longitude == '') {
15
+	return '';
16
+}
15 17
 //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n";
16 18
 $airports = $Spotter->closestAirports($latitude,$longitude,300);
17 19
 //print_r($airports);
@@ -20,7 +22,9 @@  discard block
 block discarded – undo
20 22
 $i = 0;
21 23
 $ew = true;
22 24
 $dtf = false;
23
-if (empty($airports)) $ew = false;
25
+if (empty($airports)) {
26
+	$ew = false;
27
+}
24 28
 while($ew) {
25 29
 	$met = $METAR->getMETAR($airports[$i]['icao']);
26 30
 	//print_r($met);
@@ -43,8 +47,12 @@  discard block
 block discarded – undo
43 47
 		}
44 48
 	}
45 49
 	$i++;
46
-	if ($i >= count($airports)) $ew = false;
50
+	if ($i >= count($airports)) {
51
+		$ew = false;
52
+	}
53
+	}
54
+if ($dtf === false) {
55
+	echo json_encode($Weather->openweathermap($latitude,$longitude));
47 56
 }
48
-if ($dtf === false) echo json_encode($Weather->openweathermap($latitude,$longitude));
49 57
 
50 58
 ?>
51 59
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 	header('Content-disposition: attachment; filename="weather.json"');
10 10
 }
11 11
 header('Content-Type: text/javascript');
12
-$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
13
-$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
12
+$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
13
+$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
14 14
 if ($latitude == '' || $longitude == '') return '';
15 15
 //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n";
16
-$airports = $Spotter->closestAirports($latitude,$longitude,300);
16
+$airports = $Spotter->closestAirports($latitude, $longitude, 300);
17 17
 //print_r($airports);
18 18
 $METAR = new METAR();
19 19
 $Weather = new Weather();
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $ew = true;
22 22
 $dtf = false;
23 23
 if (empty($airports)) $ew = false;
24
-while($ew) {
24
+while ($ew) {
25 25
 	$met = $METAR->getMETAR($airports[$i]['icao']);
26 26
 	//print_r($met);
27 27
 	if (!empty($met)) {
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 		//print_r($parsed);
30 30
 		$rain = array();
31 31
 		if (isset($parsed['temperature'])) {
32
-			$rain = array_merge($rain,array('temp' => $parsed['temperature']));
32
+			$rain = array_merge($rain, array('temp' => $parsed['temperature']));
33 33
 		}
34 34
 		if (isset($parsed['rh'])) {
35
-			$rain = array_merge($rain,array('rh' => $parsed['rh']));
35
+			$rain = array_merge($rain, array('rh' => $parsed['rh']));
36 36
 		}
37 37
 		if (isset($parsed['weather']) && $parsed['weather'] == 'CAVOK') {
38
-			echo json_encode(array('clouds' => array(),'rain' => array()));
38
+			echo json_encode(array('clouds' => array(), 'rain' => array()));
39 39
 			$ew  = false;
40 40
 			$dtf = true;
41 41
 		} elseif (isset($parsed['cloud'])) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 			if (!empty($result)) {
44 44
 				//print_r($met);
45 45
 				//print_r($parsed);
46
-				echo json_encode(array('clouds' => $result,'rain' => $rain));
46
+				echo json_encode(array('clouds' => $result, 'rain' => $rain));
47 47
 				$ew = false;
48 48
 				$dtf = true;
49 49
 			}
@@ -52,6 +52,6 @@  discard block
 block discarded – undo
52 52
 	$i++;
53 53
 	if ($i >= count($airports)) $ew = false;
54 54
 }
55
-if ($dtf === false) echo json_encode($Weather->openweathermap($latitude,$longitude));
55
+if ($dtf === false) echo json_encode($Weather->openweathermap($latitude, $longitude));
56 56
 
57 57
 ?>
58 58
\ No newline at end of file
Please login to merge, or discard this patch.