Completed
Push — master ( 637022...8149d9 )
by Yannick
55:10 queued 27:13
created
footer.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
 </div>
7 7
 <footer class="container">
8 8
 	<?php
9
-	    if (isset($sql_time)) {
9
+		if (isset($sql_time)) {
10 10
 	?>
11 11
 	<i><?php echo _("Page generated in").' '.round($sql_time+$page_time,2); ?>s (<?php print round($page_time,2); ?>ms PHP - <?php print round($sql_time,2); ?>ms SQL)</i>
12 12
 	<br />
13 13
 	<?php
14
-	    }
14
+		}
15 15
 	?>
16 16
 	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span>
17 17
 </footer>
Please login to merge, or discard this patch.
live-czml.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
42
-    // Assuming the angles are in radians.
43
-    $c1 = cos($heading/2);
44
-    $s1 = sin($heading/2);
45
-    $c2 = cos($attitude/2);
46
-    $s2 = sin($attitude/2);
47
-    $c3 = cos($bank/2);
48
-    $s3 = sin($bank/2);
49
-    $c1c2 = $c1*$c2;
50
-    $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
42
+	// Assuming the angles are in radians.
43
+	$c1 = cos($heading/2);
44
+	$s1 = sin($heading/2);
45
+	$c2 = cos($attitude/2);
46
+	$s2 = sin($attitude/2);
47
+	$c3 = cos($bank/2);
48
+	$s3 = sin($bank/2);
49
+	$c1c2 = $c1*$c2;
50
+	$s1s2 = $s1*$s2;
51
+	$w =$c1c2*$c3 - $s1s2*$s3;
52
+	$x =$c1c2*$s3 + $s1s2*$c3;
53
+	$y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
+	$z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
+	return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
59 59
 
60 60
 
61 61
 if (isset($_GET['download'])) {
62
-    if ($_GET['download'] == "true")
63
-    {
62
+	if ($_GET['download'] == "true")
63
+	{
64 64
 	header('Content-disposition: attachment; filename="flightairmap.json"');
65
-    }
65
+	}
66 66
 }
67 67
 header('Content-Type: text/javascript');
68 68
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
156 156
 		$coord = explode(',',$_GET['coord']);
157 157
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
158
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
158
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
159 159
 			$coord = array();
160 160
 		}
161 161
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
166 166
 		$coord = explode(',',$_GET['coord']);
167 167
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
168
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
168
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
169 169
 			$coord = array();
170 170
 		}
171 171
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
176 176
 		$coord = explode(',',$_GET['coord']);
177 177
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
178
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
178
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
179 179
 			$coord = array();
180 180
 		}
181 181
 	}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 			$image = "images/placeholder_thumb.png";
266 266
 		}
267 267
 
268
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
269
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
270
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
271
-                if ($prev_flightaware_id != $id) {
268
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
269
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
270
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
271
+				if ($prev_flightaware_id != $id) {
272 272
 			if ($prev_flightaware_id != '') {
273 273
 				/*
274 274
 				if ($nblatlong == 1) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
349 349
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
350 350
 						} else $aircraft_shadow = '';
351
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
351
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
352 352
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
353 353
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
354 354
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
380 380
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
381 381
 						}
382
-    						$output .= '},';
382
+							$output .= '},';
383 383
 					} elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') {
384 384
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20';
385 385
 						$output .= ',"heightReference": "'.$heightrelative.'"';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
388 388
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
389 389
 						}
390
-    						$output .= '},';
390
+							$output .= '},';
391 391
 					} elseif ($aircraft_icao != '') {
392 392
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
393 393
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.
require/class.AIS.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		return ($dec);
58 58
 	}
59 59
 	
60
-    /*
60
+	/*
61 61
     $ais_map64 = array(
62 62
        '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // 48
63 63
        ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C',
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 		//  ' ' --- '?', // 0x20 - 0x3F
98 98
 		//  '@' --- '_', // 0x40 - 0x5F
99 99
 		$ais_chars = array(
100
-		    '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
-		    'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
-		    'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
-		    '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
-		    '(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
-		    '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
-		    '<', '=', '>', '?'
100
+			'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
+			'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
+			'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
+			'^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
+			'(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
+			'2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
+			'<', '=', '>', '?'
107 107
 		);
108 108
 		// "
109 109
 		$rv = '';
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 				}
422 422
 				if ($num_seq > 1) { // for multipart messages
423 423
 					if ($cmsg_sid != $msg_sid // different msg_sid
424
-					    || $msg_sid == -1 // invalid initial msg_sid
425
-					    || ($seq - $pseq) != 1 // not insequence
424
+						|| $msg_sid == -1 // invalid initial msg_sid
425
+						|| ($seq - $pseq) != 1 // not insequence
426 426
 					) {  // invalid for multipart message
427 427
 						$msg_sid = -1;
428 428
 						$cmsg_sid = -1;
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 				$itu = $itu.$pcs[5]; // get itu message
436 436
 				$filler += (int)$pcs[6][0]; // get filler
437 437
 				if ($num_seq == 1 // valid single message
438
-				    || $num_seq == $pseq // valid multi-part message
438
+					|| $num_seq == $pseq // valid multi-part message
439 439
 				) {
440 440
 					/*
441 441
 					if ($num_seq != 1) { // test
@@ -520,13 +520,13 @@  discard block
 block discarded – undo
520 520
 		else $pad = '';
521 521
 		$rv = '';
522 522
 		$ais_chars = array(
523
-		    '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
524
-		    'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
525
-		    'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
526
-		    '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
527
-		    '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
528
-		    '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
529
-		    '<'=>60, '='=>61, '>'=>62, '?'=>63
523
+			'@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
524
+			'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
525
+			'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
526
+			'^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
527
+			'('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
528
+			'2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
529
+			'<'=>60, '='=>61, '>'=>62, '?'=>63
530 530
 		);
531 531
 		// "
532 532
 		$_a = str_split($name);
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	/**
93
-	* Gets all the spotter information based on the latest data entry
94
-	*
95
-	* @return Array the spotter information
96
-	*
97
-	*/
93
+	 * Gets all the spotter information based on the latest data entry
94
+	 *
95
+	 * @return Array the spotter information
96
+	 *
97
+	 */
98 98
 	public function getLiveMarineData($limit = '', $sort = '', $filter = array())
99 99
 	{
100 100
 		global $globalDBdriver, $globalLiveInterval;
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 	}
138 138
 
139 139
 	/**
140
-	* Gets Minimal Live Spotter data
141
-	*
142
-	* @return Array the spotter information
143
-	*
144
-	*/
140
+	 * Gets Minimal Live Spotter data
141
+	 *
142
+	 * @return Array the spotter information
143
+	 *
144
+	 */
145 145
 	public function getMinLiveMarineData($filter = array())
146 146
 	{
147 147
 		global $globalDBdriver, $globalLiveInterval;
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	/**
174
-	* Gets Minimal Live Spotter data since xx seconds
175
-	*
176
-	* @return Array the spotter information
177
-	*
178
-	*/
174
+	 * Gets Minimal Live Spotter data since xx seconds
175
+	 *
176
+	 * @return Array the spotter information
177
+	 *
178
+	 */
179 179
 	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 	}
247 247
 
248 248
 	/**
249
-	* Gets number of latest data entry
250
-	*
251
-	* @return String number of entry
252
-	*
253
-	*/
249
+	 * Gets number of latest data entry
250
+	 *
251
+	 * @return String number of entry
252
+	 *
253
+	 */
254 254
 	public function getLiveMarineCount($filter = array())
255 255
 	{
256 256
 		global $globalDBdriver, $globalLiveInterval;
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
 	}
276 276
 
277 277
 	/**
278
-	* Gets all the spotter information based on the latest data entry and coord
279
-	*
280
-	* @return Array the spotter information
281
-	*
282
-	*/
278
+	 * Gets all the spotter information based on the latest data entry and coord
279
+	 *
280
+	 * @return Array the spotter information
281
+	 *
282
+	 */
283 283
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
284 284
 	{
285 285
 		global $globalDBdriver, $globalLiveInterval;
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 	}
304 304
 
305 305
 	/**
306
-	* Gets all the spotter information based on the latest data entry and coord
307
-	*
308
-	* @return Array the spotter information
309
-	*
310
-	*/
306
+	 * Gets all the spotter information based on the latest data entry and coord
307
+	 *
308
+	 * @return Array the spotter information
309
+	 *
310
+	 */
311 311
 	public function getMinLiveMarineDatabyCoord($coord, $filter = array())
312 312
 	{
313 313
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
 	}
377 377
 
378 378
 	/**
379
-	* Gets all the spotter information based on a user's latitude and longitude
380
-	*
381
-	* @return Array the spotter information
382
-	*
383
-	*/
379
+	 * Gets all the spotter information based on a user's latitude and longitude
380
+	 *
381
+	 * @return Array the spotter information
382
+	 *
383
+	 */
384 384
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
385 385
 	{
386 386
 		$Marine = new Marine($this->db);
@@ -393,75 +393,75 @@  discard block
 block discarded – undo
393 393
 		if ($lng != '')
394 394
 		{
395 395
 			if (!is_numeric($lng))
396
-                        {
397
-                                return false;
398
-                        }
399
-                }
400
-
401
-                if ($radius != '')
402
-                {
403
-                        if (!is_numeric($radius))
404
-                        {
405
-                                return false;
406
-                        }
407
-                }
396
+						{
397
+								return false;
398
+						}
399
+				}
400
+
401
+				if ($radius != '')
402
+				{
403
+						if (!is_numeric($radius))
404
+						{
405
+								return false;
406
+						}
407
+				}
408 408
 		$additional_query = '';
409 409
 		if ($interval != '')
410
-                {
411
-                        if (!is_string($interval))
412
-                        {
413
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
414
-			        return false;
415
-                        } else {
416
-                if ($interval == '1m')
417
-                {
418
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
-                } else if ($interval == '15m'){
420
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421
-                } 
422
-            }
423
-                } else {
424
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425
-        }
426
-
427
-                $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 
410
+				{
411
+						if (!is_string($interval))
412
+						{
413
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
414
+					return false;
415
+						} else {
416
+				if ($interval == '1m')
417
+				{
418
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
+				} else if ($interval == '15m'){
420
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421
+				} 
422
+			}
423
+				} else {
424
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425
+		}
426
+
427
+				$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 
428 428
                    WHERE marine_live.latitude <> '' 
429 429
                                    AND marine_live.longitude <> '' 
430 430
                    ".$additional_query."
431 431
                    HAVING distance < :radius  
432 432
                                    ORDER BY distance";
433 433
 
434
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
434
+				$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
435 435
 
436
-                return $spotter_array;
437
-        }
436
+				return $spotter_array;
437
+		}
438 438
 
439 439
     
440
-        /**
441
-	* Gets all the spotter information based on a particular callsign
442
-	*
443
-	* @return Array the spotter information
444
-	*
445
-	*/
440
+		/**
441
+		 * Gets all the spotter information based on a particular callsign
442
+		 *
443
+		 * @return Array the spotter information
444
+		 *
445
+		 */
446 446
 	public function getLastLiveMarineDataByIdent($ident)
447 447
 	{
448 448
 		$Marine = new Marine($this->db);
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
452
-                $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';
452
+				$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';
453 453
 
454 454
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
458 458
 
459
-        /**
460
-	* Gets all the spotter information based on a particular callsign
461
-	*
462
-	* @return Array the spotter information
463
-	*
464
-	*/
459
+		/**
460
+		 * Gets all the spotter information based on a particular callsign
461
+		 *
462
+		 * @return Array the spotter information
463
+		 *
464
+		 */
465 465
 	public function getDateLiveMarineDataByIdent($ident,$date)
466 466
 	{
467 467
 		$Marine = new Marine($this->db);
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	}
475 475
 
476 476
 	/**
477
-	* Gets all the spotter information based on a particular MMSI
478
-	*
479
-	* @return Array the spotter information
480
-	*
481
-	*/
477
+	 * Gets all the spotter information based on a particular MMSI
478
+	 *
479
+	 * @return Array the spotter information
480
+	 *
481
+	 */
482 482
 	public function getDateLiveMarineDataByMMSI($mmsi,$date)
483 483
 	{
484 484
 		$Marine = new Marine($this->db);
@@ -490,51 +490,51 @@  discard block
 block discarded – undo
490 490
 		return $spotter_array;
491 491
 	}
492 492
 
493
-        /**
494
-	* Gets last spotter information based on a particular callsign
495
-	*
496
-	* @return Array the spotter information
497
-	*
498
-	*/
493
+		/**
494
+		 * Gets last spotter information based on a particular callsign
495
+		 *
496
+		 * @return Array the spotter information
497
+		 *
498
+		 */
499 499
 	public function getLastLiveMarineDataById($id)
500 500
 	{
501 501
 		$Marine = new Marine($this->db);
502 502
 		date_default_timezone_set('UTC');
503 503
 
504 504
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
505
-                $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';
505
+				$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';
506 506
 
507 507
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
508 508
 
509 509
 		return $spotter_array;
510 510
 	}
511 511
 
512
-        /**
513
-	* Gets last spotter information based on a particular callsign
514
-	*
515
-	* @return Array the spotter information
516
-	*
517
-	*/
512
+		/**
513
+		 * Gets last spotter information based on a particular callsign
514
+		 *
515
+		 * @return Array the spotter information
516
+		 *
517
+		 */
518 518
 	public function getDateLiveMarineDataById($id,$date)
519 519
 	{
520 520
 		$Marine = new Marine($this->db);
521 521
 		date_default_timezone_set('UTC');
522 522
 
523 523
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
524
-                $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';
525
-                $date = date('c',$date);
524
+				$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';
525
+				$date = date('c',$date);
526 526
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
527 527
 
528 528
 		return $spotter_array;
529 529
 	}
530 530
 
531 531
 
532
-        /**
533
-	* Gets all the spotter information based on a particular id
534
-	*
535
-	* @return Array the spotter information
536
-	*
537
-	*/
532
+		/**
533
+		 * Gets all the spotter information based on a particular id
534
+		 *
535
+		 * @return Array the spotter information
536
+		 *
537
+		 */
538 538
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
539 539
 	{
540 540
 		global $globalDBdriver, $globalLiveInterval;
@@ -562,18 +562,18 @@  discard block
 block discarded – undo
562 562
 		return $spotter_array;
563 563
 	}
564 564
 
565
-        /**
566
-	* Gets all the spotter information based on a particular ident
567
-	*
568
-	* @return Array the spotter information
569
-	*
570
-	*/
565
+		/**
566
+		 * Gets all the spotter information based on a particular ident
567
+		 *
568
+		 * @return Array the spotter information
569
+		 *
570
+		 */
571 571
 	public function getAllLiveMarineDataByIdent($ident)
572 572
 	{
573 573
 		date_default_timezone_set('UTC');
574 574
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
575 575
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
576
-    		try {
576
+			try {
577 577
 			
578 578
 			$sth = $this->db->prepare($query);
579 579
 			$sth->execute(array(':ident' => $ident));
@@ -587,23 +587,23 @@  discard block
 block discarded – undo
587 587
 
588 588
 
589 589
 	/**
590
-	* Deletes all info in the table
591
-	*
592
-	* @return String success or false
593
-	*
594
-	*/
590
+	 * Deletes all info in the table
591
+	 *
592
+	 * @return String success or false
593
+	 *
594
+	 */
595 595
 	public function deleteLiveMarineData()
596 596
 	{
597 597
 		global $globalDBdriver;
598 598
 		if ($globalDBdriver == 'mysql') {
599 599
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
600 600
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
601
-            		//$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)";
601
+					//$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)";
602 602
 		} else {
603 603
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
604 604
 		}
605 605
         
606
-    		try {
606
+			try {
607 607
 			
608 608
 			$sth = $this->db->prepare($query);
609 609
 			$sth->execute();
@@ -615,18 +615,18 @@  discard block
 block discarded – undo
615 615
 	}
616 616
 
617 617
 	/**
618
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
619
-	*
620
-	* @return String success or false
621
-	*
622
-	*/
618
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
619
+	 *
620
+	 * @return String success or false
621
+	 *
622
+	 */
623 623
 	public function deleteLiveMarineDataNotUpdated()
624 624
 	{
625 625
 		global $globalDBdriver, $globalDebug;
626 626
 		if ($globalDBdriver == 'mysql') {
627 627
 			//$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';
628
-    			$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";
629
-    			try {
628
+				$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";
629
+				try {
630 630
 				
631 631
 				$sth = $this->db->prepare($query);
632 632
 				$sth->execute();
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
 				return "error";
635 635
 			}
636 636
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
637
-                        $i = 0;
638
-                        $j =0;
637
+						$i = 0;
638
+						$j =0;
639 639
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
640 640
 			foreach($all as $row)
641 641
 			{
@@ -643,20 +643,20 @@  discard block
 block discarded – undo
643 643
 				$j++;
644 644
 				if ($j == 30) {
645 645
 					if ($globalDebug) echo ".";
646
-				    	try {
646
+						try {
647 647
 						
648 648
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
649 649
 						$sth->execute();
650 650
 					} catch(PDOException $e) {
651 651
 						return "error";
652 652
 					}
653
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
654
-                                	$j = 0;
653
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
654
+									$j = 0;
655 655
 				}
656 656
 				$query_delete .= "'".$row['fammarine_id']."',";
657 657
 			}
658 658
 			if ($i > 0) {
659
-    				try {
659
+					try {
660 660
 					
661 661
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
662 662
 					$sth->execute();
@@ -667,9 +667,9 @@  discard block
 block discarded – undo
667 667
 			return "success";
668 668
 		} elseif ($globalDBdriver == 'pgsql') {
669 669
 			//$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";
670
-    			//$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";
671
-    			$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)";
672
-    			try {
670
+				//$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";
671
+				$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)";
672
+				try {
673 673
 				
674 674
 				$sth = $this->db->prepare($query);
675 675
 				$sth->execute();
@@ -713,17 +713,17 @@  discard block
 block discarded – undo
713 713
 	}
714 714
 
715 715
 	/**
716
-	* Deletes all info in the table for an ident
717
-	*
718
-	* @return String success or false
719
-	*
720
-	*/
716
+	 * Deletes all info in the table for an ident
717
+	 *
718
+	 * @return String success or false
719
+	 *
720
+	 */
721 721
 	public function deleteLiveMarineDataByIdent($ident)
722 722
 	{
723 723
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
724 724
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
725 725
         
726
-    		try {
726
+			try {
727 727
 			
728 728
 			$sth = $this->db->prepare($query);
729 729
 			$sth->execute(array(':ident' => $ident));
@@ -735,17 +735,17 @@  discard block
 block discarded – undo
735 735
 	}
736 736
 
737 737
 	/**
738
-	* Deletes all info in the table for an id
739
-	*
740
-	* @return String success or false
741
-	*
742
-	*/
738
+	 * Deletes all info in the table for an id
739
+	 *
740
+	 * @return String success or false
741
+	 *
742
+	 */
743 743
 	public function deleteLiveMarineDataById($id)
744 744
 	{
745 745
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
746 746
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
747 747
         
748
-    		try {
748
+			try {
749 749
 			
750 750
 			$sth = $this->db->prepare($query);
751 751
 			$sth->execute(array(':id' => $id));
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 
759 759
 
760 760
 	/**
761
-	* Gets the aircraft ident within the last hour
762
-	*
763
-	* @return String the ident
764
-	*
765
-	*/
761
+	 * Gets the aircraft ident within the last hour
762
+	 *
763
+	 * @return String the ident
764
+	 *
765
+	 */
766 766
 	public function getIdentFromLastHour($ident)
767 767
 	{
768 768
 		global $globalDBdriver, $globalTimezone;
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
 			$ident_result = $row['ident'];
789 789
 		}
790 790
 		return $ident_result;
791
-        }
791
+		}
792 792
 
793 793
 	/**
794
-	* Check recent aircraft
795
-	*
796
-	* @return String the ident
797
-	*
798
-	*/
794
+	 * Check recent aircraft
795
+	 *
796
+	 * @return String the ident
797
+	 *
798
+	 */
799 799
 	public function checkIdentRecent($ident)
800 800
 	{
801 801
 		global $globalDBdriver, $globalTimezone;
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 			$ident_result = $row['fammarine_id'];
822 822
 		}
823 823
 		return $ident_result;
824
-        }
824
+		}
825 825
 
826 826
 	/**
827
-	* Check recent aircraft by id
828
-	*
829
-	* @return String the ident
830
-	*
831
-	*/
827
+	 * Check recent aircraft by id
828
+	 *
829
+	 * @return String the ident
830
+	 *
831
+	 */
832 832
 	public function checkIdRecent($id)
833 833
 	{
834 834
 		global $globalDBdriver, $globalTimezone;
@@ -854,14 +854,14 @@  discard block
 block discarded – undo
854 854
 			$ident_result = $row['fammarine_id'];
855 855
 		}
856 856
 		return $ident_result;
857
-        }
857
+		}
858 858
 
859 859
 	/**
860
-	* Check recent aircraft by mmsi
861
-	*
862
-	* @return String the ident
863
-	*
864
-	*/
860
+	 * Check recent aircraft by mmsi
861
+	 *
862
+	 * @return String the ident
863
+	 *
864
+	 */
865 865
 	public function checkMMSIRecent($mmsi)
866 866
 	{
867 867
 		global $globalDBdriver, $globalTimezone;
@@ -887,19 +887,19 @@  discard block
 block discarded – undo
887 887
 			$ident_result = $row['fammarine_id'];
888 888
 		}
889 889
 		return $ident_result;
890
-        }
890
+		}
891 891
 
892 892
 	/**
893
-	* Adds a new spotter data
894
-	*
895
-	* @param String $fammarine_id the ID from flightaware
896
-	* @param String $ident the flight ident
897
-	* @param String $aircraft_icao the aircraft type
898
-	* @param String $departure_airport_icao the departure airport
899
-	* @param String $arrival_airport_icao the arrival airport
900
-	* @return String success or false
901
-	*
902
-	*/
893
+	 * Adds a new spotter data
894
+	 *
895
+	 * @param String $fammarine_id the ID from flightaware
896
+	 * @param String $ident the flight ident
897
+	 * @param String $aircraft_icao the aircraft type
898
+	 * @param String $departure_airport_icao the departure airport
899
+	 * @param String $arrival_airport_icao the arrival airport
900
+	 * @return String success or false
901
+	 *
902
+	 */
903 903
 	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 = '')
904 904
 	{
905 905
 		global $globalURL, $globalArchive, $globalDebug;
@@ -973,10 +973,10 @@  discard block
 block discarded – undo
973 973
 		if ($typeid == '') $typeid = NULL;
974 974
 		if ($statusid == '') $statusid = NULL;
975 975
 
976
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
977
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
-            	if ($arrival_date == '') $arrival_date = NULL;
979
-            	$query = '';
976
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
977
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
+				if ($arrival_date == '') $arrival_date = NULL;
979
+				$query = '';
980 980
 		if ($globalArchive) {
981 981
 			if ($globalDebug) echo '-- Delete previous data -- ';
982 982
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
Please login to merge, or discard this patch.
aircraft-statistics-airline-country.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	print '<div class="select-item">';
22 22
 	print '<form action="'.$globalURL.'/aircraft" method="get">';
23 23
 	print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
24
-    	print '<option></option>';
25
-    	$Stats = new Stats();
26
-    	$aircraft_types = $Stats->getAllAircraftTypes();
27
-    	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
28
-    	foreach($aircraft_types as $aircrafttype)
29
-    	{
30
-    		if($aircraft_type == $aircrafttype['aircraft_icao'])
31
-    		{
32
-    			print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
33
-    		} else {
34
-    			print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
35
-    		}
24
+		print '<option></option>';
25
+		$Stats = new Stats();
26
+		$aircraft_types = $Stats->getAllAircraftTypes();
27
+		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
28
+		foreach($aircraft_types as $aircrafttype)
29
+		{
30
+			if($aircraft_type == $aircrafttype['aircraft_icao'])
31
+			{
32
+				print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
33
+			} else {
34
+				print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
35
+			}
36 36
 	}
37 37
 	print '</select>';
38 38
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
 	print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>';
62 62
 	print '<div id="chartCountry" class="chart" width="100%"></div><script>';
63 63
 	print 'var series = [';
64
-        $country_data = '';
64
+		$country_data = '';
65 65
 	foreach($airline_array as $airline_item)
66 66
 	{
67 67
 		$country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],';
68 68
 	}
69
-        $country_data = substr($country_data, 0, -1);
70
-        print $country_data;
71
-        print '];';
72
-        print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
73
-        print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
74
-        print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
75
-        print 'new Datamap({
69
+		$country_data = substr($country_data, 0, -1);
70
+		print $country_data;
71
+		print '];';
72
+		print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
73
+		print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
74
+		print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
75
+		print 'new Datamap({
76 76
 	    element: document.getElementById("chartCountry"),
77 77
 	    projection: "mercator", // big world map
78 78
 	    fills: { defaultFill: "#F5F5F5" },
Please login to merge, or discard this patch.
require/class.Marine.php 1 patch
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	/**
85
-	* Executes the SQL statements to get the spotter information
86
-	*
87
-	* @param String $query the SQL query
88
-	* @param Array $params parameter of the query
89
-	* @param String $limitQuery the limit query
90
-	* @return Array the spotter information
91
-	*
92
-	*/
85
+	 * Executes the SQL statements to get the spotter information
86
+	 *
87
+	 * @param String $query the SQL query
88
+	 * @param Array $params parameter of the query
89
+	 * @param String $limitQuery the limit query
90
+	 * @return Array the spotter information
91
+	 *
92
+	 */
93 93
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
94 94
 	{
95 95
 		date_default_timezone_set('UTC');
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	
221 221
 	
222 222
 	/**
223
-	* Gets all the spotter information based on the latest data entry
224
-	*
225
-	* @return Array the spotter information
226
-	*
227
-	*/
223
+	 * Gets all the spotter information based on the latest data entry
224
+	 *
225
+	 * @return Array the spotter information
226
+	 *
227
+	 */
228 228
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
229 229
 	{
230 230
 		global $global_query;
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
 	}
274 274
 
275 275
 	/**
276
-	* Gets all the spotter information based on the callsign
277
-	*
278
-	* @return Array the spotter information
279
-	*
280
-	*/
276
+	 * Gets all the spotter information based on the callsign
277
+	 *
278
+	 * @return Array the spotter information
279
+	 *
280
+	 */
281 281
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
282 282
 	{
283 283
 		global $global_query;
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	}
330 330
 
331 331
 	/**
332
-	* Gets all the marine information based on the type
333
-	*
334
-	* @return Array the marine information
335
-	*
336
-	*/
332
+	 * Gets all the marine information based on the type
333
+	 *
334
+	 * @return Array the marine information
335
+	 *
336
+	 */
337 337
 	public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array())
338 338
 	{
339 339
 		global $global_query;
@@ -441,12 +441,12 @@  discard block
 block discarded – undo
441 441
 
442 442
 
443 443
 	/**
444
-	* Gets all source name
445
-	*
446
-	* @param String type format of source
447
-	* @return Array list of source name
448
-	*
449
-	*/
444
+	 * Gets all source name
445
+	 *
446
+	 * @param String type format of source
447
+	 * @return Array list of source name
448
+	 *
449
+	 */
450 450
 	public function getAllSourceName($type = '',$filters = array())
451 451
 	{
452 452
 		$filter_query = $this->getFilter($filters,true,true);
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 
477 477
 
478 478
 	/**
479
-	* Gets a list of all idents/callsigns
480
-	*
481
-	* @return Array list of ident/callsign names
482
-	*
483
-	*/
479
+	 * Gets a list of all idents/callsigns
480
+	 *
481
+	 * @return Array list of ident/callsign names
482
+	 *
483
+	 */
484 484
 	public function getAllIdents($filters = array())
485 485
 	{
486 486
 		$filter_query = $this->getFilter($filters,true,true);
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 	}
505 505
 
506 506
 	/**
507
-	* Gets all info from a mmsi
508
-	*
509
-	* @return Array ident
510
-	*
511
-	*/
507
+	 * Gets all info from a mmsi
508
+	 *
509
+	 * @return Array ident
510
+	 *
511
+	 */
512 512
 	public function getIdentity($mmsi)
513 513
 	{
514 514
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
 	}
522 522
 
523 523
 	/**
524
-	* Add identity
525
-	*
526
-	*/
524
+	 * Add identity
525
+	 *
526
+	 */
527 527
 	public function addIdentity($mmsi,$imo,$ident,$callsign,$type)
528 528
 	{
529 529
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -589,13 +589,13 @@  discard block
 block discarded – undo
589 589
 	}
590 590
 
591 591
 	/**
592
-	* Update ident tracker data
593
-	*
594
-	* @param String $fammarine_id the ID
595
-	* @param String $ident the marine ident
596
-	* @return String success or false
597
-	*
598
-	*/
592
+	 * Update ident tracker data
593
+	 *
594
+	 * @param String $fammarine_id the ID
595
+	 * @param String $ident the marine ident
596
+	 * @return String success or false
597
+	 *
598
+	 */
599 599
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
600 600
 	{
601 601
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
@@ -610,13 +610,13 @@  discard block
 block discarded – undo
610 610
 	}
611 611
 
612 612
 	/**
613
-	* Update arrival marine data
614
-	*
615
-	* @param String $fammarine_id the ID
616
-	* @param String $arrival_code the marine ident
617
-	* @return String success or false
618
-	*
619
-	*/
613
+	 * Update arrival marine data
614
+	 *
615
+	 * @param String $fammarine_id the ID
616
+	 * @param String $arrival_code the marine ident
617
+	 * @return String success or false
618
+	 *
619
+	 */
620 620
 	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL)
621 621
 	{
622 622
 		$query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id';
@@ -631,19 +631,19 @@  discard block
 block discarded – undo
631 631
 	}
632 632
 
633 633
 	/**
634
-	* Update Status data
635
-	*
636
-	* @param String $fammarine_id the ID
637
-	* @param String $status_id the marine status id
638
-	* @param String $status the marine status
639
-	* @return String success or false
640
-	*
641
-	*/
634
+	 * Update Status data
635
+	 *
636
+	 * @param String $fammarine_id the ID
637
+	 * @param String $status_id the marine status id
638
+	 * @param String $status the marine status
639
+	 * @return String success or false
640
+	 *
641
+	 */
642 642
 	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
643 643
 	{
644 644
 
645 645
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
646
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
646
+				$query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
647 647
 
648 648
 		try {
649 649
 			$sth = $this->db->prepare($query);
@@ -656,17 +656,17 @@  discard block
 block discarded – undo
656 656
 
657 657
 	}
658 658
 	/**
659
-	* Update latest marine data
660
-	*
661
-	* @param String $fammarine_id the ID
662
-	* @param String $ident the marine ident
663
-	* @return String success or false
664
-	*
665
-	*/	
659
+	 * Update latest marine data
660
+	 *
661
+	 * @param String $fammarine_id the ID
662
+	 * @param String $ident the marine ident
663
+	 * @return String success or false
664
+	 *
665
+	 */	
666 666
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
667 667
 	{
668 668
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
669
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
669
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
670 670
 
671 671
 		try {
672 672
 			$sth = $this->db->prepare($query);
@@ -680,30 +680,30 @@  discard block
 block discarded – undo
680 680
 	}
681 681
 
682 682
 	/**
683
-	* Adds a new spotter data
684
-	*
685
-	* @param String $fammarine_id the ID
686
-	* @param String $ident the marine ident
687
-	* @param String $departure_airport_icao the departure airport
688
-	* @param String $arrival_airport_icao the arrival airport
689
-	* @param String $latitude latitude of flight
690
-	* @param String $longitude latitude of flight
691
-	* @param String $waypoints waypoints of flight
692
-	* @param String $heading heading of flight
693
-	* @param String $groundspeed speed of flight
694
-	* @param String $date date of flight
695
-	* @param String $departure_airport_time departure time of flight
696
-	* @param String $arrival_airport_time arrival time of flight
697
-	* @param String $squawk squawk code of flight
698
-	* @param String $route_stop route stop of flight
699
-	* @param String $highlight highlight or not
700
-	* @param String $ModeS ModesS code of flight
701
-	* @param String $registration registration code of flight
702
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
703
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
704
-	* @param String $verticalrate vertival rate of flight
705
-	* @return String success or false
706
-	*/
683
+	 * Adds a new spotter data
684
+	 *
685
+	 * @param String $fammarine_id the ID
686
+	 * @param String $ident the marine ident
687
+	 * @param String $departure_airport_icao the departure airport
688
+	 * @param String $arrival_airport_icao the arrival airport
689
+	 * @param String $latitude latitude of flight
690
+	 * @param String $longitude latitude of flight
691
+	 * @param String $waypoints waypoints of flight
692
+	 * @param String $heading heading of flight
693
+	 * @param String $groundspeed speed of flight
694
+	 * @param String $date date of flight
695
+	 * @param String $departure_airport_time departure time of flight
696
+	 * @param String $arrival_airport_time arrival time of flight
697
+	 * @param String $squawk squawk code of flight
698
+	 * @param String $route_stop route stop of flight
699
+	 * @param String $highlight highlight or not
700
+	 * @param String $ModeS ModesS code of flight
701
+	 * @param String $registration registration code of flight
702
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
703
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
704
+	 * @param String $verticalrate vertival rate of flight
705
+	 * @return String success or false
706
+	 */
707 707
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '')
708 708
 	{
709 709
 		global $globalURL, $globalMarineImageFetch;
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 			$sth->execute($query_values);
819 819
 			$this->db = null;
820 820
 		} catch (PDOException $e) {
821
-		    return "error : ".$e->getMessage();
821
+			return "error : ".$e->getMessage();
822 822
 		}
823 823
 		
824 824
 		return "success";
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 	
828 828
   
829 829
 	/**
830
-	* Gets the aircraft ident within the last hour
831
-	*
832
-	* @return String the ident
833
-	*
834
-	*/
830
+	 * Gets the aircraft ident within the last hour
831
+	 *
832
+	 * @return String the ident
833
+	 *
834
+	 */
835 835
 	public function getIdentFromLastHour($ident)
836 836
 	{
837 837
 		global $globalDBdriver, $globalTimezone;
@@ -847,11 +847,11 @@  discard block
 block discarded – undo
847 847
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
848 848
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
849 849
 			$query_data = array(':ident' => $ident);
850
-    		}
850
+			}
851 851
 		
852 852
 		$sth = $this->db->prepare($query);
853 853
 		$sth->execute($query_data);
854
-    		$ident_result='';
854
+			$ident_result='';
855 855
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
856 856
 		{
857 857
 			$ident_result = $row['ident'];
@@ -862,11 +862,11 @@  discard block
 block discarded – undo
862 862
 	
863 863
 	
864 864
 	/**
865
-	* Gets the aircraft data from the last 20 seconds
866
-	*
867
-	* @return Array the spotter data
868
-	*
869
-	*/
865
+	 * Gets the aircraft data from the last 20 seconds
866
+	 *
867
+	 * @return Array the spotter data
868
+	 *
869
+	 */
870 870
 	public function getRealTimeData($q = '')
871 871
 	{
872 872
 		global $globalDBdriver;
@@ -904,11 +904,11 @@  discard block
 block discarded – undo
904 904
 	
905 905
 
906 906
 	/**
907
-	* Gets all number of flight over countries
908
-	*
909
-	* @return Array the airline country list
910
-	*
911
-	*/
907
+	 * Gets all number of flight over countries
908
+	 *
909
+	 * @return Array the airline country list
910
+	 *
911
+	 */
912 912
 
913 913
 	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
914 914
 	{
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
 	
982 982
 	
983 983
 	/**
984
-	* Gets all callsigns that have flown over
985
-	*
986
-	* @return Array the callsign list
987
-	*
988
-	*/
984
+	 * Gets all callsigns that have flown over
985
+	 *
986
+	 * @return Array the callsign list
987
+	 *
988
+	 */
989 989
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
990 990
 	{
991 991
 		global $globalDBdriver;
@@ -1052,11 +1052,11 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 
1054 1054
 	/**
1055
-	* Counts all dates
1056
-	*
1057
-	* @return Array the date list
1058
-	*
1059
-	*/
1055
+	 * Counts all dates
1056
+	 *
1057
+	 * @return Array the date list
1058
+	 *
1059
+	 */
1060 1060
 	public function countAllDates($filters = array())
1061 1061
 	{
1062 1062
 		global $globalTimezone, $globalDBdriver;
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 	
1103 1103
 	
1104 1104
 	/**
1105
-	* Counts all dates during the last 7 days
1106
-	*
1107
-	* @return Array the date list
1108
-	*
1109
-	*/
1105
+	 * Counts all dates during the last 7 days
1106
+	 *
1107
+	 * @return Array the date list
1108
+	 *
1109
+	 */
1110 1110
 	public function countAllDatesLast7Days($filters = array())
1111 1111
 	{
1112 1112
 		global $globalTimezone, $globalDBdriver;
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 			$query .= " GROUP BY date_name 
1129 1129
 								ORDER BY date_name ASC";
1130 1130
 			$query_data = array(':offset' => $offset);
1131
-    		}
1131
+			}
1132 1132
 		
1133 1133
 		$sth = $this->db->prepare($query);
1134 1134
 		$sth->execute($query_data);
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
 	}
1149 1149
 
1150 1150
 	/**
1151
-	* Counts all dates during the last month
1152
-	*
1153
-	* @return Array the date list
1154
-	*
1155
-	*/
1151
+	 * Counts all dates during the last month
1152
+	 *
1153
+	 * @return Array the date list
1154
+	 *
1155
+	 */
1156 1156
 	public function countAllDatesLastMonth($filters = array())
1157 1157
 	{
1158 1158
 		global $globalTimezone, $globalDBdriver;
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 			$query .= " GROUP BY date_name 
1175 1175
 								ORDER BY date_name ASC";
1176 1176
 			$query_data = array(':offset' => $offset);
1177
-    		}
1177
+			}
1178 1178
 		
1179 1179
 		$sth = $this->db->prepare($query);
1180 1180
 		$sth->execute($query_data);
@@ -1196,11 +1196,11 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
 
1198 1198
 	/**
1199
-	* Counts all month
1200
-	*
1201
-	* @return Array the month list
1202
-	*
1203
-	*/
1199
+	 * Counts all month
1200
+	 *
1201
+	 * @return Array the month list
1202
+	 *
1203
+	 */
1204 1204
 	public function countAllMonths($filters = array())
1205 1205
 	{
1206 1206
 		global $globalTimezone, $globalDBdriver;
@@ -1245,11 +1245,11 @@  discard block
 block discarded – undo
1245 1245
 	
1246 1246
 
1247 1247
 	/**
1248
-	* Counts all dates during the last year
1249
-	*
1250
-	* @return Array the date list
1251
-	*
1252
-	*/
1248
+	 * Counts all dates during the last year
1249
+	 *
1250
+	 * @return Array the date list
1251
+	 *
1252
+	 */
1253 1253
 	public function countAllMonthsLastYear($filters)
1254 1254
 	{
1255 1255
 		global $globalTimezone, $globalDBdriver;
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 			$query .= " GROUP BY year_name, month_name
1272 1272
 								ORDER BY year_name, month_name ASC";
1273 1273
 			$query_data = array(':offset' => $offset);
1274
-    		}
1274
+			}
1275 1275
 		
1276 1276
 		$sth = $this->db->prepare($query);
1277 1277
 		$sth->execute($query_data);
@@ -1294,11 +1294,11 @@  discard block
 block discarded – undo
1294 1294
 	
1295 1295
 	
1296 1296
 	/**
1297
-	* Counts all hours
1298
-	*
1299
-	* @return Array the hour list
1300
-	*
1301
-	*/
1297
+	 * Counts all hours
1298
+	 *
1299
+	 * @return Array the hour list
1300
+	 *
1301
+	 */
1302 1302
 	public function countAllHours($orderby,$filters = array())
1303 1303
 	{
1304 1304
 		global $globalTimezone, $globalDBdriver;
@@ -1361,11 +1361,11 @@  discard block
 block discarded – undo
1361 1361
 	
1362 1362
 	
1363 1363
 	/**
1364
-	* Counts all hours by date
1365
-	*
1366
-	* @return Array the hour list
1367
-	*
1368
-	*/
1364
+	 * Counts all hours by date
1365
+	 *
1366
+	 * @return Array the hour list
1367
+	 *
1368
+	 */
1369 1369
 	public function countAllHoursByDate($date, $filters = array())
1370 1370
 	{
1371 1371
 		global $globalTimezone, $globalDBdriver;
@@ -1409,11 +1409,11 @@  discard block
 block discarded – undo
1409 1409
 	
1410 1410
 	
1411 1411
 	/**
1412
-	* Counts all hours by a ident/callsign
1413
-	*
1414
-	* @return Array the hour list
1415
-	*
1416
-	*/
1412
+	 * Counts all hours by a ident/callsign
1413
+	 *
1414
+	 * @return Array the hour list
1415
+	 *
1416
+	 */
1417 1417
 	public function countAllHoursByIdent($ident, $filters = array())
1418 1418
 	{
1419 1419
 		global $globalTimezone, $globalDBdriver;
@@ -1458,11 +1458,11 @@  discard block
 block discarded – undo
1458 1458
 	
1459 1459
 	
1460 1460
 	/**
1461
-	* Counts all vessels
1462
-	*
1463
-	* @return Integer the number of vessels
1464
-	*
1465
-	*/
1461
+	 * Counts all vessels
1462
+	 *
1463
+	 * @return Integer the number of vessels
1464
+	 *
1465
+	 */
1466 1466
 	public function countOverallMarine($filters = array(),$year = '',$month = '')
1467 1467
 	{
1468 1468
 		global $globalDBdriver;
@@ -1497,11 +1497,11 @@  discard block
 block discarded – undo
1497 1497
 	}
1498 1498
 	
1499 1499
 	/**
1500
-	* Counts all vessel type
1501
-	*
1502
-	* @return Integer the number of vessels
1503
-	*
1504
-	*/
1500
+	 * Counts all vessel type
1501
+	 *
1502
+	 * @return Integer the number of vessels
1503
+	 *
1504
+	 */
1505 1505
 	public function countOverallMarineTypes($filters = array(),$year = '',$month = '')
1506 1506
 	{
1507 1507
 		global $globalDBdriver;
@@ -1536,11 +1536,11 @@  discard block
 block discarded – undo
1536 1536
 	
1537 1537
   
1538 1538
 	/**
1539
-	* Counts all hours of today
1540
-	*
1541
-	* @return Array the hour list
1542
-	*
1543
-	*/
1539
+	 * Counts all hours of today
1540
+	 *
1541
+	 * @return Array the hour list
1542
+	 *
1543
+	 */
1544 1544
 	public function countAllHoursFromToday($filters = array())
1545 1545
 	{
1546 1546
 		global $globalTimezone, $globalDBdriver;
@@ -1580,12 +1580,12 @@  discard block
 block discarded – undo
1580 1580
 	}
1581 1581
     
1582 1582
     
1583
-     /**
1584
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1585
-	*
1586
-	* @return Integer the Barrie Spotter ID
1583
+	 /**
1584
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1585
+	  *
1586
+	  * @return Integer the Barrie Spotter ID
1587 1587
 q	*
1588
-	*/
1588
+	  */
1589 1589
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1590 1590
 	{
1591 1591
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1606,13 +1606,13 @@  discard block
 block discarded – undo
1606 1606
   
1607 1607
  
1608 1608
 	/**
1609
-	* Parses a date string
1610
-	*
1611
-	* @param String $dateString the date string
1612
-	* @param String $timezone the timezone of a user
1613
-	* @return Array the time information
1614
-	*
1615
-	*/
1609
+	 * Parses a date string
1610
+	 *
1611
+	 * @param String $dateString the date string
1612
+	 * @param String $timezone the timezone of a user
1613
+	 * @return Array the time information
1614
+	 *
1615
+	 */
1616 1616
 	public function parseDateString($dateString, $timezone = '')
1617 1617
 	{
1618 1618
 		$time_array = array();
@@ -1645,12 +1645,12 @@  discard block
 block discarded – undo
1645 1645
 	}
1646 1646
 	
1647 1647
 	/**
1648
-	* Parses the direction degrees to working
1649
-	*
1650
-	* @param Float $direction the direction in degrees
1651
-	* @return Array the direction information
1652
-	*
1653
-	*/
1648
+	 * Parses the direction degrees to working
1649
+	 *
1650
+	 * @param Float $direction the direction in degrees
1651
+	 * @return Array the direction information
1652
+	 *
1653
+	 */
1654 1654
 	public function parseDirection($direction = 0)
1655 1655
 	{
1656 1656
 		if ($direction == '') $direction = 0;
@@ -1729,12 +1729,12 @@  discard block
 block discarded – undo
1729 1729
 	
1730 1730
 	
1731 1731
 	/**
1732
-	* Gets Country from latitude/longitude
1733
-	*
1734
-	* @param Float $latitude latitute of the flight
1735
-	* @param Float $longitude longitute of the flight
1736
-	* @return String the countrie
1737
-	*/
1732
+	 * Gets Country from latitude/longitude
1733
+	 *
1734
+	 * @param Float $latitude latitute of the flight
1735
+	 * @param Float $longitude longitute of the flight
1736
+	 * @return String the countrie
1737
+	 */
1738 1738
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1739 1739
 	{
1740 1740
 		global $globalDBdriver, $globalDebug;
@@ -1771,11 +1771,11 @@  discard block
 block discarded – undo
1771 1771
 	}
1772 1772
 
1773 1773
 	/**
1774
-	* Gets Country from iso2
1775
-	*
1776
-	* @param String $iso2 ISO2 country code
1777
-	* @return String the countrie
1778
-	*/
1774
+	 * Gets Country from iso2
1775
+	 *
1776
+	 * @param String $iso2 ISO2 country code
1777
+	 * @return String the countrie
1778
+	 */
1779 1779
 	public function getCountryFromISO2($iso2)
1780 1780
 	{
1781 1781
 		global $globalDBdriver, $globalDebug;
@@ -1804,12 +1804,12 @@  discard block
 block discarded – undo
1804 1804
 
1805 1805
 	
1806 1806
 	/**
1807
-	* Gets the short url from bit.ly
1808
-	*
1809
-	* @param String $url the full url
1810
-	* @return String the bit.ly url
1811
-	*
1812
-	*/
1807
+	 * Gets the short url from bit.ly
1808
+	 *
1809
+	 * @param String $url the full url
1810
+	 * @return String the bit.ly url
1811
+	 *
1812
+	 */
1813 1813
 	public function getBitlyURL($url)
1814 1814
 	{
1815 1815
 		global $globalBitlyAccessToken;
@@ -1836,11 +1836,11 @@  discard block
 block discarded – undo
1836 1836
 
1837 1837
 	
1838 1838
 	/**
1839
-	* Gets all vessels types that have flown over
1840
-	*
1841
-	* @return Array the vessel type list
1842
-	*
1843
-	*/
1839
+	 * Gets all vessels types that have flown over
1840
+	 *
1841
+	 * @return Array the vessel type list
1842
+	 *
1843
+	 */
1844 1844
 	public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1845 1845
 	{
1846 1846
 		global $globalDBdriver;
@@ -1906,11 +1906,11 @@  discard block
 block discarded – undo
1906 1906
 	}
1907 1907
 
1908 1908
 	/**
1909
-	* Gets all the tracker information
1910
-	*
1911
-	* @return Array the tracker information
1912
-	*
1913
-	*/
1909
+	 * Gets all the tracker information
1910
+	 *
1911
+	 * @return Array the tracker information
1912
+	 *
1913
+	 */
1914 1914
 	public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1915 1915
 	{
1916 1916
 		global $globalTimezone, $globalDBdriver;
Please login to merge, or discard this patch.
aircraft-detailed.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 		print '<div class="select-item">';
43 43
 		print '<form action="'.$globalURL.'/aircraft" method="get">';
44 44
 		print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
45
-    		print '<option></option>';
46
-    		$Stats = new Stats();
45
+			print '<option></option>';
46
+			$Stats = new Stats();
47 47
 		$aircraft_types = $Stats->getAllAircraftTypes();
48 48
 		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
49 49
 		foreach($aircraft_types as $aircrafttype)
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 			} else {
55 55
 				print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
56 56
 			}
57
-    		}
58
-    		print '</select>';
59
-	    	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
57
+			}
58
+			print '</select>';
59
+			print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
60 60
 	  	print '</form>';
61 61
 	  	print '</div>';
62 62
 	    
63 63
 		if ($aircraft_type != "NA")
64 64
 		{
65
-	    		print '<div class="info column">';
66
-	      		print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
67
-	      		print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
68
-	      		print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
69
-	      		if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
70
-	    		print '</div>';
65
+				print '<div class="info column">';
66
+		  		print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
67
+		  		print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
68
+		  		print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
69
+		  		if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
70
+				print '</div>';
71 71
 		} else {
72 72
 			print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>';
73 73
 		}
Please login to merge, or discard this patch.
require/class.MarineImport.php 1 patch
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Stats.php');
10 10
 require_once(dirname(__FILE__).'/class.Source.php');
11 11
 if (isset($globalServerAPRS) && $globalServerAPRS) {
12
-    require_once(dirname(__FILE__).'/class.APRS.php');
12
+	require_once(dirname(__FILE__).'/class.APRS.php');
13 13
 }
14 14
 
15 15
 class MarineImport {
16
-    private $all_tracked = array();
17
-    private $last_delete_hourly = 0;
18
-    private $last_delete = 0;
19
-    private $stats = array();
20
-    private $tmd = 0;
21
-    private $source_location = array();
22
-    public $db = null;
23
-    public $nb = 0;
16
+	private $all_tracked = array();
17
+	private $last_delete_hourly = 0;
18
+	private $last_delete = 0;
19
+	private $stats = array();
20
+	private $tmd = 0;
21
+	private $source_location = array();
22
+	public $db = null;
23
+	public $nb = 0;
24 24
 
25
-    public function __construct($dbc = null) {
25
+	public function __construct($dbc = null) {
26 26
 	global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB;
27 27
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
28
-	    $Connection = new Connection($dbc);
29
-	    $this->db = $Connection->db();
30
-	    date_default_timezone_set('UTC');
28
+		$Connection = new Connection($dbc);
29
+		$this->db = $Connection->db();
30
+		date_default_timezone_set('UTC');
31 31
 	}
32 32
 	// Get previous source stats
33 33
 	/*
@@ -46,57 +46,57 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 	*/
48 48
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
49
-	    $APRSMarine = new APRSMarine();
50
-	    //$APRSSpotter->connect();
49
+		$APRSMarine = new APRSMarine();
50
+		//$APRSSpotter->connect();
51
+	}
51 52
 	}
52
-    }
53 53
 
54
-    public function checkAll() {
54
+	public function checkAll() {
55 55
 	global $globalDebug, $globalNoDB;
56 56
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
57
-	    if ($globalDebug) echo "Update last seen tracked data...\n";
58
-	    foreach ($this->all_tracked as $key => $flight) {
57
+		if ($globalDebug) echo "Update last seen tracked data...\n";
58
+		foreach ($this->all_tracked as $key => $flight) {
59 59
 		if (isset($this->all_tracked[$key]['id'])) {
60
-		    //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
61
-    		    $Marine = new Marine($this->db);
62
-    		    $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']);
60
+			//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
61
+				$Marine = new Marine($this->db);
62
+				$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']);
63
+		}
63 64
 		}
64
-	    }
65 65
 	}
66
-    }
66
+	}
67 67
 
68
-    public function del() {
68
+	public function del() {
69 69
 	global $globalDebug, $globalNoDB, $globalNoImport;
70 70
 	// Delete old infos
71 71
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
72 72
 	foreach ($this->all_tracked as $key => $flight) {
73
-    	    if (isset($flight['lastupdate'])) {
74
-        	if ($flight['lastupdate'] < (time()-3000)) {
75
-            	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
76
-            		if (isset($this->all_tracked[$key]['id'])) {
77
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
78
-			    /*
73
+			if (isset($flight['lastupdate'])) {
74
+			if ($flight['lastupdate'] < (time()-3000)) {
75
+					if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
76
+					if (isset($this->all_tracked[$key]['id'])) {
77
+						if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
78
+				/*
79 79
 			    $MarineLive = new MarineLive();
80 80
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
81 81
 			    $MarineLive->db = null;
82 82
 			    */
83
-            		    //$real_arrival = $this->arrival($key);
84
-            		    $Marine = new Marine($this->db);
85
-            		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
83
+						//$real_arrival = $this->arrival($key);
84
+						$Marine = new Marine($this->db);
85
+						if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
86 86
 				$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']);
87 87
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
88
-			    }
89
-			    // Put in archive
88
+				}
89
+				// Put in archive
90 90
 //				$Marine->db = null;
91 91
 			}
92
-            	    }
93
-            	    unset($this->all_tracked[$key]);
94
-    	        }
95
-	    }
96
-        }
97
-    }
92
+					}
93
+					unset($this->all_tracked[$key]);
94
+				}
95
+		}
96
+		}
97
+	}
98 98
 
99
-    public function add($line) {
99
+	public function add($line) {
100 100
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine;
101 101
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
102 102
 	date_default_timezone_set('UTC');
@@ -105,104 +105,104 @@  discard block
 block discarded – undo
105 105
 	
106 106
 	// SBS format is CSV format
107 107
 	if(is_array($line) && isset($line['mmsi'])) {
108
-	    //print_r($line);
109
-  	    if (isset($line['mmsi'])) {
108
+		//print_r($line);
109
+  		if (isset($line['mmsi'])) {
110 110
 
111 111
 		
112 112
 		// Increment message number
113 113
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
114
-		    $current_date = date('Y-m-d');
115
-		    if (isset($line['source_name'])) $source = $line['source_name'];
116
-		    else $source = '';
117
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
118
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
119
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
120
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
121
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
114
+			$current_date = date('Y-m-d');
115
+			if (isset($line['source_name'])) $source = $line['source_name'];
116
+			else $source = '';
117
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
118
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
119
+				$this->stats[$current_date][$source]['msg']['date'] = time();
120
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
121
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
122 122
 		}
123 123
 		
124 124
 		
125 125
 		$Common = new Common();
126 126
 		$AIS = new AIS();
127
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
128
-	        else $id = trim($line['id']);
127
+			if (!isset($line['id'])) $id = trim($line['mmsi']);
128
+			else $id = trim($line['id']);
129 129
 		
130 130
 		if (!isset($this->all_tracked[$id])) {
131
-		    $this->all_tracked[$id] = array();
132
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
133
-		    $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' => ''));
134
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
135
-		    if (!isset($line['id'])) {
131
+			$this->all_tracked[$id] = array();
132
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
133
+			$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' => ''));
134
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
135
+			if (!isset($line['id'])) {
136 136
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
137 137
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
138
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
139
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
138
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
139
+			if ($globalAllTracked !== FALSE) $dataFound = true;
140 140
 		}
141 141
 		
142 142
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
143
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
144
-		    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
143
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
144
+			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
145 145
 			$Marine = new Marine($this->db);
146 146
 			$identity = $Marine->getIdentity($line['mmsi']);
147 147
 			if (!empty($identity)) {
148
-			    $this->all_tracked[$id]['ident'] = $identity['ship_name'];
149
-			    $this->all_tracked[$id]['type'] = $identity['type'];
150
-			    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type'])));
148
+				$this->all_tracked[$id]['ident'] = $identity['ship_name'];
149
+				$this->all_tracked[$id]['type'] = $identity['type'];
150
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type'])));
151 151
 			}
152 152
 			//print_r($identity);
153 153
 			unset($Marine);
154 154
 			//$dataFound = true;
155
-		    }
155
+			}
156 156
 		}
157 157
 		if (isset($line['type_id'])) {
158
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
159
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id']));
158
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
159
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id']));
160 160
 		}
161 161
 		if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') {
162
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type'])));
162
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
163
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type'])));
164 164
 		}
165 165
 		if (isset($line['status']) && $line['status'] != '') {
166
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
166
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
167 167
 		}
168 168
 		if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) {
169
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
170
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
169
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
170
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
171 171
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
172
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
172
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
173 173
 				$Marine = new Marine($this->db);
174 174
 				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']);
175 175
 				unset($Marine);
176
-			    }
176
+				}
177
+			}
177 178
 			}
178
-		    }
179 179
 		}
180 180
 
181 181
 
182 182
 		if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') {
183
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
183
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
184 184
 		}
185 185
 		if (isset($line['imo']) && $line['imo'] != '') {
186
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
186
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
187 187
 		}
188 188
 		if (isset($line['callsign']) && $line['callsign'] != '') {
189
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
189
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
190 190
 		}
191 191
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
192
-		    if (!isset($this->all_tracked[$id]['arrival_code'])) {
192
+			if (!isset($this->all_tracked[$id]['arrival_code'])) {
193 193
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
194 194
 			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
195 195
 			if ($this->all_tracked[$id]['addedMarine'] != 0) {
196
-			    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
196
+				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
197 197
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
198
-				    $Marine = new Marine($this->db);
199
-				    $fromsource = NULL;
200
-				    $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource);
201
-				    $Marine->db = null;
198
+					$Marine = new Marine($this->db);
199
+					$fromsource = NULL;
200
+					$Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource);
201
+					$Marine->db = null;
202
+				}
202 203
 				}
203
-			    }
204 204
 			}
205
-		    } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
205
+			} elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
206 206
 			$this->all_tracked[$id]['arrival_code'] = $line['arrival_code'];
207 207
 			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
208 208
 			if (!isset($line['id'])) {
@@ -210,26 +210,26 @@  discard block
 block discarded – undo
210 210
 				$this->all_tracked[$id]['forcenew'] = 1;
211 211
 				$this->all_tracked[$id]['addedMarine'] = 0;
212 212
 			}
213
-		    }
213
+			}
214 214
 		}
215 215
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
216
-		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
216
+			if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
217 217
 		}
218 218
 
219 219
 		//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'])) {
220 220
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
221
-		    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
221
+			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
222 222
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
223
-			    $timeelapsed = microtime(true);
224
-			    $Marine = new Marine($this->db);
225
-			    $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']);
226
-			    $Marine->db = null;
223
+				$timeelapsed = microtime(true);
224
+				$Marine = new Marine($this->db);
225
+				$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']);
226
+				$Marine->db = null;
227
+			}
227 228
 			}
228
-		    }
229
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
230
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
229
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
230
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
231 231
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
232
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
232
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
233 233
 				$timeelapsed = microtime(true);
234 234
 				$Marine = new Marine($this->db);
235 235
 				$fromsource = NULL;
@@ -237,20 +237,20 @@  discard block
 block discarded – undo
237 237
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
238 238
 				$Marine->db = null;
239 239
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
240
-			    }
240
+				}
241
+			}
241 242
 			}
242
-		    }
243
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
243
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
244 244
 		}
245 245
 
246 246
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) {
247
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
247
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
248 248
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
249
-		    } else {
249
+			} else {
250 250
 				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";
251 251
 				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";
252 252
 				return '';
253
-		    }
253
+			}
254 254
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) {
255 255
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
256 256
 			return '';
@@ -267,24 +267,24 @@  discard block
 block discarded – undo
267 267
 
268 268
 
269 269
 		if (isset($line['speed'])) {
270
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
271
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
270
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
271
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
272 272
 		} 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'])) {
273
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
274
-		    if ($distance > 1000 && $distance < 10000) {
273
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
274
+			if ($distance > 1000 && $distance < 10000) {
275 275
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
276 276
 			$speed = $speed*3.6;
277 277
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
278 278
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
279
-		    }
279
+			}
280 280
 		}
281 281
 
282
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
283
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
284
-	    	    else unset($timediff);
285
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
282
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
283
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
284
+				else unset($timediff);
285
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
286 286
 			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'])) {
287
-			    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'])) {
287
+				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'])) {
288 288
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
289 289
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
290 290
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -292,195 +292,195 @@  discard block
 block discarded – undo
292 292
 				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
293 293
 				$timeelapsed = microtime(true);
294 294
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
295
-				    $Marine = new Marine($this->db);
296
-				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
297
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
298
-				    $Marine->db = null;
299
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
295
+					$Marine = new Marine($this->db);
296
+					$all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
297
+					if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
298
+					$Marine->db = null;
299
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
300 300
 				}
301 301
 				$this->tmd = 0;
302 302
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
303
-			    }
303
+				}
304 304
 			}
305 305
 
306 306
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
307 307
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
308 308
 				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') {
309
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
310
-				    $dataFound = true;
311
-				    $this->all_tracked[$id]['time_last_coord'] = time();
309
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
310
+					$dataFound = true;
311
+					$this->all_tracked[$id]['time_last_coord'] = time();
312 312
 				}
313 313
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
314 314
 			}
315 315
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
316
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
316
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
317 317
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
318 318
 				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') {
319
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
320
-				    $dataFound = true;
321
-				    $this->all_tracked[$id]['time_last_coord'] = time();
319
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
320
+					$dataFound = true;
321
+					$this->all_tracked[$id]['time_last_coord'] = time();
322 322
 				}
323 323
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
324 324
 			}
325 325
 
326
-		    } else if ($globalDebug && $timediff > 20) {
326
+			} else if ($globalDebug && $timediff > 20) {
327 327
 			$this->tmd = $this->tmd + 1;
328 328
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
329 329
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
330 330
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
331 331
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
332
-		    }
332
+			}
333 333
 		}
334 334
 		if (isset($line['last_update']) && $line['last_update'] != '') {
335
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
336
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
335
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
336
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
337 337
 		}
338 338
 		if (isset($line['format_source']) && $line['format_source'] != '') {
339
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
339
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
340 340
 		}
341 341
 		if (isset($line['source_name']) && $line['source_name'] != '') {
342
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
342
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
343 343
 		}
344 344
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
345
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
345
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
346 346
 		}
347 347
 		
348 348
 		if (isset($line['heading']) && $line['heading'] != '') {
349
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
350
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
351
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
352
-		    //$dataFound = true;
349
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
350
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
351
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
352
+			//$dataFound = true;
353 353
   		} 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']) {
354
-  		    $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']);
355
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
356
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
357
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
354
+  			$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']);
355
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
356
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
357
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
358 358
   		}
359 359
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
360 360
 
361 361
 
362 362
 
363 363
 		if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) {
364
-		    $this->all_tracked[$id]['lastupdate'] = time();
365
-		    if ($this->all_tracked[$id]['addedMarine'] == 0) {
366
-		        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'])) {
367
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
364
+			$this->all_tracked[$id]['lastupdate'] = time();
365
+			if ($this->all_tracked[$id]['addedMarine'] == 0) {
366
+				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'])) {
367
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
368 368
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
369
-				    if ($globalDebug) echo "Check if vessel is already in DB...";
370
-				    $timeelapsed = microtime(true);
371
-				    $MarineLive = new MarineLive($this->db);
372
-				    if (isset($line['id'])) {
369
+					if ($globalDebug) echo "Check if vessel is already in DB...";
370
+					$timeelapsed = microtime(true);
371
+					$MarineLive = new MarineLive($this->db);
372
+					if (isset($line['id'])) {
373 373
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
374 374
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
375
-				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
375
+					} elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
376 376
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
377 377
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
378
-				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
378
+					} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
379 379
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
380 380
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
381
-				    } else $recent_ident = '';
382
-				    $MarineLive->db=null;
383
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
384
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
381
+					} else $recent_ident = '';
382
+					$MarineLive->db=null;
383
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
384
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
385 385
 				} else $recent_ident = '';
386
-			    } else {
386
+				} else {
387 387
 				$recent_ident = '';
388 388
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
389
-			    }
390
-			    //if there was no vessel with the same callsign within the last hour and go post it into the archive
391
-			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
392
-			    {
389
+				}
390
+				//if there was no vessel with the same callsign within the last hour and go post it into the archive
391
+				if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
392
+				{
393 393
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
394 394
 				//adds the spotter data for the archive
395
-				    $highlight = '';
396
-				    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')));
397
-				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
395
+					$highlight = '';
396
+					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')));
397
+					if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
398 398
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
399
-					    $timeelapsed = microtime(true);
400
-					    $Marine = new Marine($this->db);
401
-					    $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']);
402
-					    $Marine->db = null;
403
-					    if ($globalDebug && isset($result)) echo $result."\n";
404
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
399
+						$timeelapsed = microtime(true);
400
+						$Marine = new Marine($this->db);
401
+						$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']);
402
+						$Marine->db = null;
403
+						if ($globalDebug && isset($result)) echo $result."\n";
404
+						if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
405
+					}
405 406
 					}
406
-				    }
407
-				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
407
+					if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
408 408
 					// Add source stat in DB
409 409
 					$Stats = new Stats($this->db);
410 410
 					if (!empty($this->stats)) {
411
-					    if ($globalDebug) echo 'Add source stats : ';
412
-				    	    foreach($this->stats as $date => $data) {
411
+						if ($globalDebug) echo 'Add source stats : ';
412
+							foreach($this->stats as $date => $data) {
413 413
 						foreach($data as $source => $sourced) {
414
-					    	    //print_r($sourced);
415
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
416
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
417
-				    		    if (isset($sourced['msg'])) {
418
-				    			if (time() - $sourced['msg']['date'] > 10) {
419
-				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
420
-				    		    	    echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
421
-			    			    	    unset($this->stats[$date][$source]['msg']);
422
-			    				}
423
-			    			    }
424
-			    			}
425
-			    			if ($date != date('Y-m-d')) {
426
-			    			    unset($this->stats[$date]);
427
-			    			}
428
-				    	    }
429
-				    	    if ($globalDebug) echo 'Done'."\n";
414
+								//print_r($sourced);
415
+									if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
416
+									if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
417
+								if (isset($sourced['msg'])) {
418
+								if (time() - $sourced['msg']['date'] > 10) {
419
+										$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
420
+										echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
421
+										unset($this->stats[$date][$source]['msg']);
422
+								}
423
+								}
424
+							}
425
+							if ($date != date('Y-m-d')) {
426
+								unset($this->stats[$date]);
427
+							}
428
+							}
429
+							if ($globalDebug) echo 'Done'."\n";
430 430
 					}
431 431
 					$Stats->db = null;
432
-				    }
432
+					}
433 433
 				    
434
-				    $this->del();
434
+					$this->del();
435 435
 				//$ignoreImport = false;
436 436
 				$this->all_tracked[$id]['addedMarine'] = 1;
437 437
 				//print_r($this->all_tracked[$id]);
438 438
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
439
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
440
-				    //MarineLive->deleteLiveMarineDataNotUpdated();
441
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
439
+					if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
440
+					//MarineLive->deleteLiveMarineDataNotUpdated();
441
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
442 442
 					$MarineLive = new MarineLive($this->db);
443 443
 					$MarineLive->deleteLiveMarineData();
444 444
 					$MarineLive->db=null;
445 445
 					if ($globalDebug) echo " Done\n";
446
-				    }
447
-				    $this->last_delete = time();
446
+					}
447
+					$this->last_delete = time();
448 448
 				}
449
-			    } elseif ($recent_ident != '') {
449
+				} elseif ($recent_ident != '') {
450 450
 				$this->all_tracked[$id]['id'] = $recent_ident;
451 451
 				$this->all_tracked[$id]['addedMarine'] = 1;
452 452
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
453
-				    if (isset($globalDaemon) && !$globalDaemon) {
453
+					if (isset($globalDaemon) && !$globalDaemon) {
454 454
 					$Marine = new Marine($this->db);
455 455
 					$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']);
456 456
 					$Marine->db = null;
457
-				    }
457
+					}
458 458
 				}
459 459
 				
460
-			    }
460
+				}
461 461
 			}
462
-		    }
463
-		    //adds the spotter LIVE data
464
-		    if ($globalDebug) {
462
+			}
463
+			//adds the spotter LIVE data
464
+			if ($globalDebug) {
465 465
 			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";
466
-		    }
467
-		    $ignoreImport = false;
466
+			}
467
+			$ignoreImport = false;
468 468
 
469
-		    if (!$ignoreImport) {
469
+			if (!$ignoreImport) {
470 470
 			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'])) {
471 471
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
472 472
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
473
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
473
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
474 474
 					$timeelapsed = microtime(true);
475 475
 					$MarineLive = new MarineLive($this->db);
476 476
 					$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']);
477 477
 					$MarineLive->db = null;
478 478
 					if ($globalDebug) echo $result."\n";
479 479
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
480
-				    }
480
+					}
481 481
 				}
482 482
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
483
-				    $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']);
483
+					$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']);
484 484
 				}
485 485
 				$this->all_tracked[$id]['putinarchive'] = false;
486 486
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 					if ($stats_heading == 16) $stats_heading = 0;
513 513
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
514 514
 						for ($i=0;$i<=15;$i++) {
515
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
515
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
516 516
 						}
517 517
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
518 518
 					} else {
@@ -525,11 +525,11 @@  discard block
 block discarded – undo
525 525
 					//var_dump($this->stats);
526 526
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
527 527
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
528
-						    end($this->stats[$current_date][$source]['hist']);
529
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
528
+							end($this->stats[$current_date][$source]['hist']);
529
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
530 530
 						} else $mini = 0;
531 531
 						for ($i=$mini;$i<=$distance;$i+=10) {
532
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
532
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
533 533
 						}
534 534
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
535 535
 					} else {
@@ -545,24 +545,24 @@  discard block
 block discarded – undo
545 545
 			
546 546
 			
547 547
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
548
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
548
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
549 549
 				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
550 550
 				$MarineLive = new MarineLive($this->db);
551 551
 				$MarineLive->deleteLiveMarineDataNotUpdated();
552 552
 				$MarineLive->db = null;
553 553
 				//MarineLive->deleteLiveMarineData();
554 554
 				if ($globalDebug) echo " Done\n";
555
-			    }
556
-			    $this->last_delete_hourly = time();
555
+				}
556
+				$this->last_delete_hourly = time();
557 557
 			}
558 558
 			
559
-		    }
560
-		    //$ignoreImport = false;
559
+			}
560
+			//$ignoreImport = false;
561 561
 		}
562 562
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
563 563
 		if ($send) return $this->all_tracked[$id];
564
-	    }
564
+		}
565
+	}
565 566
 	}
566
-    }
567 567
 }
568 568
 ?>
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 	}
134 134
 
135 135
 	/**
136
-	* Gets all the spotter information based on the latest data entry
137
-	*
138
-	* @return Array the spotter information
139
-	*
140
-	*/
136
+	 * Gets all the spotter information based on the latest data entry
137
+	 *
138
+	 * @return Array the spotter information
139
+	 *
140
+	 */
141 141
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
142 142
 	{
143 143
 		global $globalDBdriver, $globalLiveInterval;
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 	}
181 181
 
182 182
 	/**
183
-	* Gets Minimal Live Spotter data
184
-	*
185
-	* @return Array the spotter information
186
-	*
187
-	*/
183
+	 * Gets Minimal Live Spotter data
184
+	 *
185
+	 * @return Array the spotter information
186
+	 *
187
+	 */
188 188
 	public function getMinLiveSpotterData($filter = array())
189 189
 	{
190 190
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 	}
222 222
 
223 223
 	/**
224
-	* Gets Minimal Live Spotter data since xx seconds
225
-	*
226
-	* @return Array the spotter information
227
-	*
228
-	*/
224
+	 * Gets Minimal Live Spotter data since xx seconds
225
+	 *
226
+	 * @return Array the spotter information
227
+	 *
228
+	 */
229 229
 	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false)
230 230
 	{
231 231
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 	}
309 309
 
310 310
 	/**
311
-	* Gets number of latest data entry
312
-	*
313
-	* @return String number of entry
314
-	*
315
-	*/
311
+	 * Gets number of latest data entry
312
+	 *
313
+	 * @return String number of entry
314
+	 *
315
+	 */
316 316
 	public function getLiveSpotterCount($filter = array())
317 317
 	{
318 318
 		global $globalDBdriver, $globalLiveInterval;
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	}
340 340
 
341 341
 	/**
342
-	* Gets all the spotter information based on the latest data entry and coord
343
-	*
344
-	* @return Array the spotter information
345
-	*
346
-	*/
342
+	 * Gets all the spotter information based on the latest data entry and coord
343
+	 *
344
+	 * @return Array the spotter information
345
+	 *
346
+	 */
347 347
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
348 348
 	{
349 349
 		global $globalDBdriver, $globalLiveInterval;
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 	}
369 369
 
370 370
 	/**
371
-	* Gets all the spotter information based on the latest data entry and coord
372
-	*
373
-	* @return Array the spotter information
374
-	*
375
-	*/
371
+	 * Gets all the spotter information based on the latest data entry and coord
372
+	 *
373
+	 * @return Array the spotter information
374
+	 *
375
+	 */
376 376
 	public function getMinLiveSpotterDatabyCoord($coord, $filter = array())
377 377
 	{
378 378
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
 	}
438 438
 
439 439
 	/**
440
-	* Gets all the spotter information based on a user's latitude and longitude
441
-	*
442
-	* @return Array the spotter information
443
-	*
444
-	*/
440
+	 * Gets all the spotter information based on a user's latitude and longitude
441
+	 *
442
+	 * @return Array the spotter information
443
+	 *
444
+	 */
445 445
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
446 446
 	{
447 447
 		$Spotter = new Spotter($this->db);
@@ -451,98 +451,98 @@  discard block
 block discarded – undo
451 451
 				return false;
452 452
 			}
453 453
 		}
454
-        if ($lng != '')
455
-                {
456
-                        if (!is_numeric($lng))
457
-                        {
458
-                                return false;
459
-                        }
460
-                }
461
-
462
-                if ($radius != '')
463
-                {
464
-                        if (!is_numeric($radius))
465
-                        {
466
-                                return false;
467
-                        }
468
-                }
454
+		if ($lng != '')
455
+				{
456
+						if (!is_numeric($lng))
457
+						{
458
+								return false;
459
+						}
460
+				}
461
+
462
+				if ($radius != '')
463
+				{
464
+						if (!is_numeric($radius))
465
+						{
466
+								return false;
467
+						}
468
+				}
469 469
 		$additional_query = '';
470
-        if ($interval != '')
471
-                {
472
-                        if (!is_string($interval))
473
-                        {
474
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
475
-			        return false;
476
-                        } else {
477
-                if ($interval == '1m')
478
-                {
479
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
480
-                } else if ($interval == '15m'){
481
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
482
-                } 
483
-            }
484
-                } else {
485
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
486
-        }
487
-
488
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
470
+		if ($interval != '')
471
+				{
472
+						if (!is_string($interval))
473
+						{
474
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
475
+					return false;
476
+						} else {
477
+				if ($interval == '1m')
478
+				{
479
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
480
+				} else if ($interval == '15m'){
481
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
482
+				} 
483
+			}
484
+				} else {
485
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
486
+		}
487
+
488
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
489 489
                    WHERE spotter_live.latitude <> '' 
490 490
                                    AND spotter_live.longitude <> '' 
491 491
                    ".$additional_query."
492 492
                    HAVING distance < :radius  
493 493
                                    ORDER BY distance";
494 494
 
495
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
495
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
496 496
 
497
-                return $spotter_array;
498
-        }
497
+				return $spotter_array;
498
+		}
499 499
 
500 500
     
501
-        /**
502
-	* Gets all the spotter information based on a particular callsign
503
-	*
504
-	* @return Array the spotter information
505
-	*
506
-	*/
501
+		/**
502
+		 * Gets all the spotter information based on a particular callsign
503
+		 *
504
+		 * @return Array the spotter information
505
+		 *
506
+		 */
507 507
 	public function getLastLiveSpotterDataByIdent($ident)
508 508
 	{
509 509
 		$Spotter = new Spotter($this->db);
510 510
 		date_default_timezone_set('UTC');
511 511
 
512 512
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
513
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
513
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
514 514
 
515 515
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
516 516
 
517 517
 		return $spotter_array;
518 518
 	}
519 519
 
520
-        /**
521
-	* Gets all the spotter information based on a particular callsign
522
-	*
523
-	* @return Array the spotter information
524
-	*
525
-	*/
520
+		/**
521
+		 * Gets all the spotter information based on a particular callsign
522
+		 *
523
+		 * @return Array the spotter information
524
+		 *
525
+		 */
526 526
 	public function getDateLiveSpotterDataByIdent($ident,$date)
527 527
 	{
528 528
 		$Spotter = new Spotter($this->db);
529 529
 		date_default_timezone_set('UTC');
530 530
 
531 531
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
532
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
532
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
533 533
 
534
-                $date = date('c',$date);
534
+				$date = date('c',$date);
535 535
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
536 536
 
537 537
 		return $spotter_array;
538 538
 	}
539 539
 
540
-        /**
541
-	* Gets last spotter information based on a particular callsign
542
-	*
543
-	* @return Array the spotter information
544
-	*
545
-	*/
540
+		/**
541
+		 * Gets last spotter information based on a particular callsign
542
+		 *
543
+		 * @return Array the spotter information
544
+		 *
545
+		 */
546 546
 	public function getLastLiveSpotterDataById($id)
547 547
 	{
548 548
 		$Spotter = new Spotter($this->db);
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
 		return $spotter_array;
554 554
 	}
555 555
 
556
-        /**
557
-	* Gets last spotter information based on a particular callsign
558
-	*
559
-	* @return Array the spotter information
560
-	*
561
-	*/
556
+		/**
557
+		 * Gets last spotter information based on a particular callsign
558
+		 *
559
+		 * @return Array the spotter information
560
+		 *
561
+		 */
562 562
 	public function getDateLiveSpotterDataById($id,$date)
563 563
 	{
564 564
 		$Spotter = new Spotter($this->db);
@@ -571,21 +571,21 @@  discard block
 block discarded – undo
571 571
 		return $spotter_array;
572 572
 	}
573 573
 
574
-        /**
575
-	* Gets altitude information based on a particular callsign
576
-	*
577
-	* @return Array the spotter information
578
-	*
579
-	*/
574
+		/**
575
+		 * Gets altitude information based on a particular callsign
576
+		 *
577
+		 * @return Array the spotter information
578
+		 *
579
+		 */
580 580
 	public function getAltitudeLiveSpotterDataByIdent($ident)
581 581
 	{
582 582
 
583 583
 		date_default_timezone_set('UTC');
584 584
 
585 585
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
586
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
586
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
587 587
 
588
-    		try {
588
+			try {
589 589
 			
590 590
 			$sth = $this->db->prepare($query);
591 591
 			$sth->execute(array(':ident' => $ident));
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
 		return $spotter_array;
599 599
 	}
600 600
 
601
-        /**
602
-	* Gets all the spotter information based on a particular id
603
-	*
604
-	* @return Array the spotter information
605
-	*
606
-	*/
601
+		/**
602
+		 * Gets all the spotter information based on a particular id
603
+		 *
604
+		 * @return Array the spotter information
605
+		 *
606
+		 */
607 607
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
608 608
 	{
609 609
 		global $globalDBdriver, $globalLiveInterval;
@@ -631,18 +631,18 @@  discard block
 block discarded – undo
631 631
 		return $spotter_array;
632 632
 	}
633 633
 
634
-        /**
635
-	* Gets all the spotter information based on a particular ident
636
-	*
637
-	* @return Array the spotter information
638
-	*
639
-	*/
634
+		/**
635
+		 * Gets all the spotter information based on a particular ident
636
+		 *
637
+		 * @return Array the spotter information
638
+		 *
639
+		 */
640 640
 	public function getAllLiveSpotterDataByIdent($ident)
641 641
 	{
642 642
 		date_default_timezone_set('UTC');
643 643
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
644 644
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
645
-    		try {
645
+			try {
646 646
 			
647 647
 			$sth = $this->db->prepare($query);
648 648
 			$sth->execute(array(':ident' => $ident));
@@ -656,23 +656,23 @@  discard block
 block discarded – undo
656 656
 
657 657
 
658 658
 	/**
659
-	* Deletes all info in the table
660
-	*
661
-	* @return String success or false
662
-	*
663
-	*/
659
+	 * Deletes all info in the table
660
+	 *
661
+	 * @return String success or false
662
+	 *
663
+	 */
664 664
 	public function deleteLiveSpotterData()
665 665
 	{
666 666
 		global $globalDBdriver;
667 667
 		if ($globalDBdriver == 'mysql') {
668 668
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
669 669
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
670
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
670
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
671 671
 		} else {
672 672
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
673 673
 		}
674 674
         
675
-    		try {
675
+			try {
676 676
 			
677 677
 			$sth = $this->db->prepare($query);
678 678
 			$sth->execute();
@@ -684,18 +684,18 @@  discard block
 block discarded – undo
684 684
 	}
685 685
 
686 686
 	/**
687
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
688
-	*
689
-	* @return String success or false
690
-	*
691
-	*/
687
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
688
+	 *
689
+	 * @return String success or false
690
+	 *
691
+	 */
692 692
 	public function deleteLiveSpotterDataNotUpdated()
693 693
 	{
694 694
 		global $globalDBdriver, $globalDebug;
695 695
 		if ($globalDBdriver == 'mysql') {
696 696
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
697
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
698
-    			try {
697
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
698
+				try {
699 699
 				
700 700
 				$sth = $this->db->prepare($query);
701 701
 				$sth->execute();
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 				return "error";
704 704
 			}
705 705
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
706
-                        $i = 0;
707
-                        $j =0;
706
+						$i = 0;
707
+						$j =0;
708 708
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
709 709
 			foreach($all as $row)
710 710
 			{
@@ -712,20 +712,20 @@  discard block
 block discarded – undo
712 712
 				$j++;
713 713
 				if ($j == 30) {
714 714
 					if ($globalDebug) echo ".";
715
-				    	try {
715
+						try {
716 716
 						
717 717
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
718 718
 						$sth->execute();
719 719
 					} catch(PDOException $e) {
720 720
 						return "error";
721 721
 					}
722
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
723
-                                	$j = 0;
722
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
723
+									$j = 0;
724 724
 				}
725 725
 				$query_delete .= "'".$row['flightaware_id']."',";
726 726
 			}
727 727
 			if ($i > 0) {
728
-    				try {
728
+					try {
729 729
 					
730 730
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
731 731
 					$sth->execute();
@@ -736,9 +736,9 @@  discard block
 block discarded – undo
736 736
 			return "success";
737 737
 		} elseif ($globalDBdriver == 'pgsql') {
738 738
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
739
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
740
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
741
-    			try {
739
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
740
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
741
+				try {
742 742
 				
743 743
 				$sth = $this->db->prepare($query);
744 744
 				$sth->execute();
@@ -782,17 +782,17 @@  discard block
 block discarded – undo
782 782
 	}
783 783
 
784 784
 	/**
785
-	* Deletes all info in the table for an ident
786
-	*
787
-	* @return String success or false
788
-	*
789
-	*/
785
+	 * Deletes all info in the table for an ident
786
+	 *
787
+	 * @return String success or false
788
+	 *
789
+	 */
790 790
 	public function deleteLiveSpotterDataByIdent($ident)
791 791
 	{
792 792
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
793 793
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
794 794
         
795
-    		try {
795
+			try {
796 796
 			
797 797
 			$sth = $this->db->prepare($query);
798 798
 			$sth->execute(array(':ident' => $ident));
@@ -804,17 +804,17 @@  discard block
 block discarded – undo
804 804
 	}
805 805
 
806 806
 	/**
807
-	* Deletes all info in the table for an id
808
-	*
809
-	* @return String success or false
810
-	*
811
-	*/
807
+	 * Deletes all info in the table for an id
808
+	 *
809
+	 * @return String success or false
810
+	 *
811
+	 */
812 812
 	public function deleteLiveSpotterDataById($id)
813 813
 	{
814 814
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
815 815
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
816 816
         
817
-    		try {
817
+			try {
818 818
 			
819 819
 			$sth = $this->db->prepare($query);
820 820
 			$sth->execute(array(':id' => $id));
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 
828 828
 
829 829
 	/**
830
-	* Gets the aircraft ident within the last hour
831
-	*
832
-	* @return String the ident
833
-	*
834
-	*/
830
+	 * Gets the aircraft ident within the last hour
831
+	 *
832
+	 * @return String the ident
833
+	 *
834
+	 */
835 835
 	public function getIdentFromLastHour($ident)
836 836
 	{
837 837
 		global $globalDBdriver, $globalTimezone;
@@ -857,14 +857,14 @@  discard block
 block discarded – undo
857 857
 			$ident_result = $row['ident'];
858 858
 		}
859 859
 		return $ident_result;
860
-        }
860
+		}
861 861
 
862 862
 	/**
863
-	* Check recent aircraft
864
-	*
865
-	* @return String the ident
866
-	*
867
-	*/
863
+	 * Check recent aircraft
864
+	 *
865
+	 * @return String the ident
866
+	 *
867
+	 */
868 868
 	public function checkIdentRecent($ident)
869 869
 	{
870 870
 		global $globalDBdriver, $globalTimezone;
@@ -890,14 +890,14 @@  discard block
 block discarded – undo
890 890
 			$ident_result = $row['flightaware_id'];
891 891
 		}
892 892
 		return $ident_result;
893
-        }
893
+		}
894 894
 
895 895
 	/**
896
-	* Check recent aircraft by id
897
-	*
898
-	* @return String the ident
899
-	*
900
-	*/
896
+	 * Check recent aircraft by id
897
+	 *
898
+	 * @return String the ident
899
+	 *
900
+	 */
901 901
 	public function checkIdRecent($id)
902 902
 	{
903 903
 		global $globalDBdriver, $globalTimezone;
@@ -923,14 +923,14 @@  discard block
 block discarded – undo
923 923
 			$ident_result = $row['flightaware_id'];
924 924
 		}
925 925
 		return $ident_result;
926
-        }
926
+		}
927 927
 
928 928
 	/**
929
-	* Check recent aircraft by ModeS
930
-	*
931
-	* @return String the ModeS
932
-	*
933
-	*/
929
+	 * Check recent aircraft by ModeS
930
+	 *
931
+	 * @return String the ModeS
932
+	 *
933
+	 */
934 934
 	public function checkModeSRecent($modes)
935 935
 	{
936 936
 		global $globalDBdriver, $globalTimezone;
@@ -960,11 +960,11 @@  discard block
 block discarded – undo
960 960
 	}
961 961
 
962 962
 	/**
963
-	* Gets the aircraft data from the last 20 seconds
964
-	*
965
-	* @return Array the spotter data
966
-	*
967
-	*/
963
+	 * Gets the aircraft data from the last 20 seconds
964
+	 *
965
+	 * @return Array the spotter data
966
+	 *
967
+	 */
968 968
 	public function getRealTimeData($q = '')
969 969
 	{
970 970
 		global $globalDBdriver;
@@ -1006,16 +1006,16 @@  discard block
 block discarded – undo
1006 1006
 	}
1007 1007
 
1008 1008
 	/**
1009
-	* Adds a new spotter data
1010
-	*
1011
-	* @param String $flightaware_id the ID from flightaware
1012
-	* @param String $ident the flight ident
1013
-	* @param String $aircraft_icao the aircraft type
1014
-	* @param String $departure_airport_icao the departure airport
1015
-	* @param String $arrival_airport_icao the arrival airport
1016
-	* @return String success or false
1017
-	*
1018
-	*/
1009
+	 * Adds a new spotter data
1010
+	 *
1011
+	 * @param String $flightaware_id the ID from flightaware
1012
+	 * @param String $ident the flight ident
1013
+	 * @param String $aircraft_icao the aircraft type
1014
+	 * @param String $departure_airport_icao the departure airport
1015
+	 * @param String $arrival_airport_icao the arrival airport
1016
+	 * @return String success or false
1017
+	 *
1018
+	 */
1019 1019
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
1020 1020
 	{
1021 1021
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1158,10 +1158,10 @@  discard block
 block discarded – undo
1158 1158
 		$arrival_airport_country = '';
1159 1159
 		
1160 1160
             	
1161
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1162
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1163
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1164
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1161
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1162
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1163
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1164
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1165 1165
 		
1166 1166
 		$query = '';
1167 1167
 		if ($globalArchive) {
@@ -1182,10 +1182,10 @@  discard block
 block discarded – undo
1182 1182
 			return "error : ".$e->getMessage();
1183 1183
 		}
1184 1184
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1185
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1186
-		    $SpotterArchive = new SpotterArchive($this->db);
1187
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1188
-		    if ($globalDebug) echo $result.')';
1185
+			if ($globalDebug) echo '(Add to SBS archive : ';
1186
+			$SpotterArchive = new SpotterArchive($this->db);
1187
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1188
+			if ($globalDebug) echo $result.')';
1189 1189
 		} elseif ($globalDebug && $putinarchive !== true) {
1190 1190
 			echo '(Not adding to archive)';
1191 1191
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.