Completed
Push — master ( 57ec45...7a0770 )
by Yannick
33:58
created
js/map-marine.3d.js.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
 			var entityid = entity.id;
39 39
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
40 40
 			<?php 
41
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
41
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
42 42
 			?>
43 43
 			if (lastupdateentity != lastupdatemarine) {
44 44
 				viewer.dataSources.get(dsn).entities.remove(entity);
45 45
 				czmldsmarine.entities.removeById(entityid);
46 46
 			}
47 47
 			<?php
48
-			    } else {
48
+				} else {
49 49
 			?>
50 50
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
51 51
 				viewer.dataSources.get(dsn).entities.remove(entity);
52 52
 			}
53 53
 			<?php
54
-			    }
54
+				}
55 55
 			?>
56 56
 		}
57 57
 	}
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 function updateMarineData() {
74 74
 	lastupdatemarine = Date.now();
75 75
 <?php
76
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
76
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
77 77
 ?>
78 78
 	var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&coord='+bbox()+'&update=' + lastupdatemarine);
79 79
 <?php
80
-    } else {
80
+	} else {
81 81
 ?>
82 82
 	var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&update=' + lastupdatemarine);
83 83
 <?php
84
-    }
84
+	}
85 85
 ?>
86 86
 	livemarinedata.then(function (data) { 
87 87
 		displayMarineData(data);
Please login to merge, or discard this patch.
js/map-tracker.3d.js.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 			var entityid = entity.id;
82 82
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
83 83
 			<?php 
84
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
84
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
85 85
 			?>
86 86
 			if (lastupdateentity != lastupdatetracker) {
87 87
 				viewer.dataSources.get(dsn).entities.remove(entity);
88 88
 				czmldstracker.entities.removeById(entityid);
89 89
 			}
90 90
 			<?php
91
-			    } else {
91
+				} else {
92 92
 			?>
93 93
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
94 94
 				viewer.dataSources.get(dsn).entities.remove(entity);
95 95
 				czmldstracker.entities.removeById(entityid);
96 96
 			}
97 97
 			<?php
98
-			    }
98
+				}
99 99
 			?>
100 100
 		}
101 101
 	}
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 function updateTrackerData() {
117 117
 	lastupdatetracker = Date.now();
118 118
 <?php
119
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
119
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
120 120
 ?>
121 121
 	var livetrackerdata = czmldstracker.process('<?php print $globalURL; ?>/live-czml.php?tracker&coord='+bbox()+'&update=' + lastupdatetracker);
122 122
 <?php
123
-    } else {
123
+	} else {
124 124
 ?>
125 125
 	var livetrackerdata = czmldstracker.process('<?php print $globalURL; ?>/live-czml.php?tracker&update=' + lastupdatetracker);
126 126
 <?php
127
-    }
127
+	}
128 128
 ?>  
129 129
 	livetrackerdata.then(function (data) { 
130 130
 		displayTrackerData(data);
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Indentation   +188 added lines, -188 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();
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Gets all the spotter information based on the latest data entry
91
-	*
92
-	* @return Array the spotter information
93
-	*
94
-	*/
90
+	 * Gets all the spotter information based on the latest data entry
91
+	 *
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getLiveMarineData($limit = '', $sort = '', $filter = array())
96 96
 	{
97 97
 		global $globalDBdriver, $globalLiveInterval;
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 
136 136
 	/**
137
-	* Gets Minimal Live Spotter data
138
-	*
139
-	* @return Array the spotter information
140
-	*
141
-	*/
137
+	 * Gets Minimal Live Spotter data
138
+	 *
139
+	 * @return Array the spotter information
140
+	 *
141
+	 */
142 142
 	public function getMinLiveMarineData($filter = array())
143 143
 	{
144 144
 		global $globalDBdriver, $globalLiveInterval;
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 	}
169 169
 
170 170
 	/**
171
-	* Gets Minimal Live Spotter data since xx seconds
172
-	*
173
-	* @return Array the spotter information
174
-	*
175
-	*/
171
+	 * Gets Minimal Live Spotter data since xx seconds
172
+	 *
173
+	 * @return Array the spotter information
174
+	 *
175
+	 */
176 176
 	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
177 177
 	{
178 178
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 	}
244 244
 
245 245
 	/**
246
-	* Gets number of latest data entry
247
-	*
248
-	* @return String number of entry
249
-	*
250
-	*/
246
+	 * Gets number of latest data entry
247
+	 *
248
+	 * @return String number of entry
249
+	 *
250
+	 */
251 251
 	public function getLiveMarineCount($filter = array())
252 252
 	{
253 253
 		global $globalDBdriver, $globalLiveInterval;
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 	}
273 273
 
274 274
 	/**
275
-	* Gets all the spotter information based on the latest data entry and coord
276
-	*
277
-	* @return Array the spotter information
278
-	*
279
-	*/
275
+	 * Gets all the spotter information based on the latest data entry and coord
276
+	 *
277
+	 * @return Array the spotter information
278
+	 *
279
+	 */
280 280
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
281 281
 	{
282 282
 		global $globalDBdriver, $globalLiveInterval;
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 	}
301 301
 
302 302
 	/**
303
-	* Gets all the spotter information based on the latest data entry and coord
304
-	*
305
-	* @return Array the spotter information
306
-	*
307
-	*/
303
+	 * Gets all the spotter information based on the latest data entry and coord
304
+	 *
305
+	 * @return Array the spotter information
306
+	 *
307
+	 */
308 308
 	public function getMinLiveMarineDatabyCoord($coord, $filter = array())
309 309
 	{
310 310
 		global $globalDBdriver, $globalLiveInterval;
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
 	}
333 333
 
334 334
 	/**
335
-	* Gets all the spotter information based on a user's latitude and longitude
336
-	*
337
-	* @return Array the spotter information
338
-	*
339
-	*/
335
+	 * Gets all the spotter information based on a user's latitude and longitude
336
+	 *
337
+	 * @return Array the spotter information
338
+	 *
339
+	 */
340 340
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
341 341
 	{
342 342
 		$Marine = new Marine($this->db);
@@ -349,134 +349,134 @@  discard block
 block discarded – undo
349 349
 		if ($lng != '')
350 350
 		{
351 351
 			if (!is_numeric($lng))
352
-                        {
353
-                                return false;
354
-                        }
355
-                }
356
-
357
-                if ($radius != '')
358
-                {
359
-                        if (!is_numeric($radius))
360
-                        {
361
-                                return false;
362
-                        }
363
-                }
352
+						{
353
+								return false;
354
+						}
355
+				}
356
+
357
+				if ($radius != '')
358
+				{
359
+						if (!is_numeric($radius))
360
+						{
361
+								return false;
362
+						}
363
+				}
364 364
 		$additional_query = '';
365 365
 		if ($interval != '')
366
-                {
367
-                        if (!is_string($interval))
368
-                        {
369
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
370
-			        return false;
371
-                        } else {
372
-                if ($interval == '1m')
373
-                {
374
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
375
-                } else if ($interval == '15m'){
376
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
377
-                } 
378
-            }
379
-                } else {
380
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
381
-        }
382
-
383
-                $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 
366
+				{
367
+						if (!is_string($interval))
368
+						{
369
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
370
+					return false;
371
+						} else {
372
+				if ($interval == '1m')
373
+				{
374
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
375
+				} else if ($interval == '15m'){
376
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
377
+				} 
378
+			}
379
+				} else {
380
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
381
+		}
382
+
383
+				$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 
384 384
                    WHERE marine_live.latitude <> '' 
385 385
                                    AND marine_live.longitude <> '' 
386 386
                    ".$additional_query."
387 387
                    HAVING distance < :radius  
388 388
                                    ORDER BY distance";
389 389
 
390
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
390
+				$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
391 391
 
392
-                return $spotter_array;
393
-        }
392
+				return $spotter_array;
393
+		}
394 394
 
395 395
     
396
-        /**
397
-	* Gets all the spotter information based on a particular callsign
398
-	*
399
-	* @return Array the spotter information
400
-	*
401
-	*/
396
+		/**
397
+		 * Gets all the spotter information based on a particular callsign
398
+		 *
399
+		 * @return Array the spotter information
400
+		 *
401
+		 */
402 402
 	public function getLastLiveMarineDataByIdent($ident)
403 403
 	{
404 404
 		$Marine = new Marine($this->db);
405 405
 		date_default_timezone_set('UTC');
406 406
 
407 407
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
408
-                $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';
408
+				$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';
409 409
 
410 410
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
411 411
 
412 412
 		return $spotter_array;
413 413
 	}
414 414
 
415
-        /**
416
-	* Gets all the spotter information based on a particular callsign
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
415
+		/**
416
+		 * Gets all the spotter information based on a particular callsign
417
+		 *
418
+		 * @return Array the spotter information
419
+		 *
420
+		 */
421 421
 	public function getDateLiveMarineDataByIdent($ident,$date)
422 422
 	{
423 423
 		$Marine = new Marine($this->db);
424 424
 		date_default_timezone_set('UTC');
425 425
 
426 426
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
427
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
427
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
428 428
 
429
-                $date = date('c',$date);
429
+				$date = date('c',$date);
430 430
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
431 431
 
432 432
 		return $spotter_array;
433 433
 	}
434 434
 
435
-        /**
436
-	* Gets last spotter information based on a particular callsign
437
-	*
438
-	* @return Array the spotter information
439
-	*
440
-	*/
435
+		/**
436
+		 * Gets last spotter information based on a particular callsign
437
+		 *
438
+		 * @return Array the spotter information
439
+		 *
440
+		 */
441 441
 	public function getLastLiveMarineDataById($id)
442 442
 	{
443 443
 		$Marine = new Marine($this->db);
444 444
 		date_default_timezone_set('UTC');
445 445
 
446 446
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
447
-                $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';
447
+				$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';
448 448
 
449 449
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
450 450
 
451 451
 		return $spotter_array;
452 452
 	}
453 453
 
454
-        /**
455
-	* Gets last spotter information based on a particular callsign
456
-	*
457
-	* @return Array the spotter information
458
-	*
459
-	*/
454
+		/**
455
+		 * Gets last spotter information based on a particular callsign
456
+		 *
457
+		 * @return Array the spotter information
458
+		 *
459
+		 */
460 460
 	public function getDateLiveMarineDataById($id,$date)
461 461
 	{
462 462
 		$Marine = new Marine($this->db);
463 463
 		date_default_timezone_set('UTC');
464 464
 
465 465
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
466
-                $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';
467
-                $date = date('c',$date);
466
+				$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';
467
+				$date = date('c',$date);
468 468
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
469 469
 
470 470
 		return $spotter_array;
471 471
 	}
472 472
 
473 473
 
474
-        /**
475
-	* Gets all the spotter information based on a particular id
476
-	*
477
-	* @return Array the spotter information
478
-	*
479
-	*/
474
+		/**
475
+		 * Gets all the spotter information based on a particular id
476
+		 *
477
+		 * @return Array the spotter information
478
+		 *
479
+		 */
480 480
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
481 481
 	{
482 482
 		global $globalDBdriver, $globalLiveInterval;
@@ -504,18 +504,18 @@  discard block
 block discarded – undo
504 504
 		return $spotter_array;
505 505
 	}
506 506
 
507
-        /**
508
-	* Gets all the spotter information based on a particular ident
509
-	*
510
-	* @return Array the spotter information
511
-	*
512
-	*/
507
+		/**
508
+		 * Gets all the spotter information based on a particular ident
509
+		 *
510
+		 * @return Array the spotter information
511
+		 *
512
+		 */
513 513
 	public function getAllLiveMarineDataByIdent($ident)
514 514
 	{
515 515
 		date_default_timezone_set('UTC');
516 516
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
517 517
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
518
-    		try {
518
+			try {
519 519
 			
520 520
 			$sth = $this->db->prepare($query);
521 521
 			$sth->execute(array(':ident' => $ident));
@@ -529,23 +529,23 @@  discard block
 block discarded – undo
529 529
 
530 530
 
531 531
 	/**
532
-	* Deletes all info in the table
533
-	*
534
-	* @return String success or false
535
-	*
536
-	*/
532
+	 * Deletes all info in the table
533
+	 *
534
+	 * @return String success or false
535
+	 *
536
+	 */
537 537
 	public function deleteLiveMarineData()
538 538
 	{
539 539
 		global $globalDBdriver;
540 540
 		if ($globalDBdriver == 'mysql') {
541 541
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
542 542
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
543
-            		//$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)";
543
+					//$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)";
544 544
 		} else {
545 545
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
546 546
 		}
547 547
         
548
-    		try {
548
+			try {
549 549
 			
550 550
 			$sth = $this->db->prepare($query);
551 551
 			$sth->execute();
@@ -557,18 +557,18 @@  discard block
 block discarded – undo
557 557
 	}
558 558
 
559 559
 	/**
560
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
561
-	*
562
-	* @return String success or false
563
-	*
564
-	*/
560
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
561
+	 *
562
+	 * @return String success or false
563
+	 *
564
+	 */
565 565
 	public function deleteLiveMarineDataNotUpdated()
566 566
 	{
567 567
 		global $globalDBdriver, $globalDebug;
568 568
 		if ($globalDBdriver == 'mysql') {
569 569
 			//$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';
570
-    			$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";
571
-    			try {
570
+				$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";
571
+				try {
572 572
 				
573 573
 				$sth = $this->db->prepare($query);
574 574
 				$sth->execute();
@@ -576,8 +576,8 @@  discard block
 block discarded – undo
576 576
 				return "error";
577 577
 			}
578 578
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
579
-                        $i = 0;
580
-                        $j =0;
579
+						$i = 0;
580
+						$j =0;
581 581
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
582 582
 			foreach($all as $row)
583 583
 			{
@@ -585,20 +585,20 @@  discard block
 block discarded – undo
585 585
 				$j++;
586 586
 				if ($j == 30) {
587 587
 					if ($globalDebug) echo ".";
588
-				    	try {
588
+						try {
589 589
 						
590 590
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
591 591
 						$sth->execute();
592 592
 					} catch(PDOException $e) {
593 593
 						return "error";
594 594
 					}
595
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
596
-                                	$j = 0;
595
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
596
+									$j = 0;
597 597
 				}
598 598
 				$query_delete .= "'".$row['fammarine_id']."',";
599 599
 			}
600 600
 			if ($i > 0) {
601
-    				try {
601
+					try {
602 602
 					
603 603
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
604 604
 					$sth->execute();
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
 			return "success";
610 610
 		} elseif ($globalDBdriver == 'pgsql') {
611 611
 			//$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";
612
-    			//$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";
613
-    			$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)";
614
-    			try {
612
+				//$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";
613
+				$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)";
614
+				try {
615 615
 				
616 616
 				$sth = $this->db->prepare($query);
617 617
 				$sth->execute();
@@ -655,17 +655,17 @@  discard block
 block discarded – undo
655 655
 	}
656 656
 
657 657
 	/**
658
-	* Deletes all info in the table for an ident
659
-	*
660
-	* @return String success or false
661
-	*
662
-	*/
658
+	 * Deletes all info in the table for an ident
659
+	 *
660
+	 * @return String success or false
661
+	 *
662
+	 */
663 663
 	public function deleteLiveMarineDataByIdent($ident)
664 664
 	{
665 665
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
666 666
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
667 667
         
668
-    		try {
668
+			try {
669 669
 			
670 670
 			$sth = $this->db->prepare($query);
671 671
 			$sth->execute(array(':ident' => $ident));
@@ -677,17 +677,17 @@  discard block
 block discarded – undo
677 677
 	}
678 678
 
679 679
 	/**
680
-	* Deletes all info in the table for an id
681
-	*
682
-	* @return String success or false
683
-	*
684
-	*/
680
+	 * Deletes all info in the table for an id
681
+	 *
682
+	 * @return String success or false
683
+	 *
684
+	 */
685 685
 	public function deleteLiveMarineDataById($id)
686 686
 	{
687 687
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
688 688
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
689 689
         
690
-    		try {
690
+			try {
691 691
 			
692 692
 			$sth = $this->db->prepare($query);
693 693
 			$sth->execute(array(':id' => $id));
@@ -700,11 +700,11 @@  discard block
 block discarded – undo
700 700
 
701 701
 
702 702
 	/**
703
-	* Gets the aircraft ident within the last hour
704
-	*
705
-	* @return String the ident
706
-	*
707
-	*/
703
+	 * Gets the aircraft ident within the last hour
704
+	 *
705
+	 * @return String the ident
706
+	 *
707
+	 */
708 708
 	public function getIdentFromLastHour($ident)
709 709
 	{
710 710
 		global $globalDBdriver, $globalTimezone;
@@ -730,14 +730,14 @@  discard block
 block discarded – undo
730 730
 			$ident_result = $row['ident'];
731 731
 		}
732 732
 		return $ident_result;
733
-        }
733
+		}
734 734
 
735 735
 	/**
736
-	* Check recent aircraft
737
-	*
738
-	* @return String the ident
739
-	*
740
-	*/
736
+	 * Check recent aircraft
737
+	 *
738
+	 * @return String the ident
739
+	 *
740
+	 */
741 741
 	public function checkIdentRecent($ident)
742 742
 	{
743 743
 		global $globalDBdriver, $globalTimezone;
@@ -763,14 +763,14 @@  discard block
 block discarded – undo
763 763
 			$ident_result = $row['fammarine_id'];
764 764
 		}
765 765
 		return $ident_result;
766
-        }
766
+		}
767 767
 
768 768
 	/**
769
-	* Check recent aircraft by id
770
-	*
771
-	* @return String the ident
772
-	*
773
-	*/
769
+	 * Check recent aircraft by id
770
+	 *
771
+	 * @return String the ident
772
+	 *
773
+	 */
774 774
 	public function checkIdRecent($id)
775 775
 	{
776 776
 		global $globalDBdriver, $globalTimezone;
@@ -796,14 +796,14 @@  discard block
 block discarded – undo
796 796
 			$ident_result = $row['fammarine_id'];
797 797
 		}
798 798
 		return $ident_result;
799
-        }
799
+		}
800 800
 
801 801
 	/**
802
-	* Check recent aircraft by mmsi
803
-	*
804
-	* @return String the ident
805
-	*
806
-	*/
802
+	 * Check recent aircraft by mmsi
803
+	 *
804
+	 * @return String the ident
805
+	 *
806
+	 */
807 807
 	public function checkMMSIRecent($mmsi)
808 808
 	{
809 809
 		global $globalDBdriver, $globalTimezone;
@@ -829,19 +829,19 @@  discard block
 block discarded – undo
829 829
 			$ident_result = $row['fammarine_id'];
830 830
 		}
831 831
 		return $ident_result;
832
-        }
832
+		}
833 833
 
834 834
 	/**
835
-	* Adds a new spotter data
836
-	*
837
-	* @param String $fammarine_id the ID from flightaware
838
-	* @param String $ident the flight ident
839
-	* @param String $aircraft_icao the aircraft type
840
-	* @param String $departure_airport_icao the departure airport
841
-	* @param String $arrival_airport_icao the arrival airport
842
-	* @return String success or false
843
-	*
844
-	*/
835
+	 * Adds a new spotter data
836
+	 *
837
+	 * @param String $fammarine_id the ID from flightaware
838
+	 * @param String $ident the flight ident
839
+	 * @param String $aircraft_icao the aircraft type
840
+	 * @param String $departure_airport_icao the departure airport
841
+	 * @param String $arrival_airport_icao the arrival airport
842
+	 * @return String success or false
843
+	 *
844
+	 */
845 845
 	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 = '')
846 846
 	{
847 847
 		global $globalURL, $globalArchive, $globalDebug;
@@ -912,10 +912,10 @@  discard block
 block discarded – undo
912 912
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
913 913
 		
914 914
 
915
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
916
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
917
-            	if ($arrival_date == '') $arrival_date = NULL;
918
-            	$query = '';
915
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
916
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
917
+				if ($arrival_date == '') $arrival_date = NULL;
918
+				$query = '';
919 919
 		if ($globalArchive) {
920 920
 			if ($globalDebug) echo '-- Delete previous data -- ';
921 921
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Indentation   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -85,38 +85,38 @@  discard block
 block discarded – undo
85 85
 		try {
86 86
 			//$Connection = new Connection();
87 87
 			$sth = $Connection->db->prepare($query);
88
-                        $sth->execute(array(':source' => $database_file));
89
-                } catch(PDOException $e) {
90
-                        return "error : ".$e->getMessage();
91
-                }
88
+						$sth->execute(array(':source' => $database_file));
89
+				} catch(PDOException $e) {
90
+						return "error : ".$e->getMessage();
91
+				}
92 92
 
93
-    		if ($globalDebug) echo " - Add routes to DB -";
94
-    		update_db::connect_sqlite($database_file);
93
+			if ($globalDebug) echo " - Add routes to DB -";
94
+			update_db::connect_sqlite($database_file);
95 95
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
96 96
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
97 97
 		try {
98
-                        $sth = update_db::$db_sqlite->prepare($query);
99
-                        $sth->execute();
100
-                } catch(PDOException $e) {
101
-                        return "error : ".$e->getMessage();
102
-                }
98
+						$sth = update_db::$db_sqlite->prepare($query);
99
+						$sth->execute();
100
+				} catch(PDOException $e) {
101
+						return "error : ".$e->getMessage();
102
+				}
103 103
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
104 104
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
105 105
 		$Connection = new Connection();
106 106
 		$sth_dest = $Connection->db->prepare($query_dest);
107 107
 		try {
108 108
 			if ($globalTransaction) $Connection->db->beginTransaction();
109
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
109
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
110 110
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
111 111
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
112 112
 				$sth_dest->execute($query_dest_values);
113
-            		}
113
+					}
114 114
 			if ($globalTransaction) $Connection->db->commit();
115 115
 		} catch(PDOException $e) {
116 116
 			if ($globalTransaction) $Connection->db->rollBack(); 
117 117
 			return "error : ".$e->getMessage();
118 118
 		}
119
-                return '';
119
+				return '';
120 120
 	}
121 121
 	public static function retrieve_route_oneworld($database_file) {
122 122
 		global $globalDebug, $globalTransaction;
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 		try {
128 128
 			//$Connection = new Connection();
129 129
 			$sth = $Connection->db->prepare($query);
130
-                        $sth->execute(array(':source' => 'oneworld'));
131
-                } catch(PDOException $e) {
132
-                        return "error : ".$e->getMessage();
133
-                }
130
+						$sth->execute(array(':source' => 'oneworld'));
131
+				} catch(PDOException $e) {
132
+						return "error : ".$e->getMessage();
133
+				}
134 134
 
135
-    		if ($globalDebug) echo " - Add routes to DB -";
135
+			if ($globalDebug) echo " - Add routes to DB -";
136 136
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
137 137
 		$Spotter = new Spotter();
138 138
 		if ($fh = fopen($database_file,"r")) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			}
157 157
 			if ($globalTransaction) $Connection->db->commit();
158 158
 		}
159
-                return '';
159
+				return '';
160 160
 	}
161 161
 	
162 162
 	public static function retrieve_route_skyteam($database_file) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 		try {
169 169
 			//$Connection = new Connection();
170 170
 			$sth = $Connection->db->prepare($query);
171
-                        $sth->execute(array(':source' => 'skyteam'));
172
-                } catch(PDOException $e) {
173
-                        return "error : ".$e->getMessage();
174
-                }
171
+						$sth->execute(array(':source' => 'skyteam'));
172
+				} catch(PDOException $e) {
173
+						return "error : ".$e->getMessage();
174
+				}
175 175
 
176
-    		if ($globalDebug) echo " - Add routes to DB -";
176
+			if ($globalDebug) echo " - Add routes to DB -";
177 177
 
178 178
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
179 179
 		$Spotter = new Spotter();
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				return "error : ".$e->getMessage();
200 200
 			}
201 201
 		}
202
-                return '';
202
+				return '';
203 203
 	}
204 204
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
205 205
 		global $globalTransaction;
@@ -208,27 +208,27 @@  discard block
 block discarded – undo
208 208
 		try {
209 209
 			$Connection = new Connection();
210 210
 			$sth = $Connection->db->prepare($query);
211
-                        $sth->execute(array(':source' => $database_file));
212
-                } catch(PDOException $e) {
213
-                        return "error : ".$e->getMessage();
214
-                }
211
+						$sth->execute(array(':source' => $database_file));
212
+				} catch(PDOException $e) {
213
+						return "error : ".$e->getMessage();
214
+				}
215 215
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
216 216
 		try {
217 217
 			$Connection = new Connection();
218 218
 			$sth = $Connection->db->prepare($query);
219
-                        $sth->execute(array(':source' => $database_file));
220
-                } catch(PDOException $e) {
221
-                        return "error : ".$e->getMessage();
222
-                }
219
+						$sth->execute(array(':source' => $database_file));
220
+				} catch(PDOException $e) {
221
+						return "error : ".$e->getMessage();
222
+				}
223 223
 
224
-    		update_db::connect_sqlite($database_file);
224
+			update_db::connect_sqlite($database_file);
225 225
 		$query = 'select * from Aircraft';
226 226
 		try {
227
-                        $sth = update_db::$db_sqlite->prepare($query);
228
-                        $sth->execute();
229
-                } catch(PDOException $e) {
230
-                        return "error : ".$e->getMessage();
231
-                }
227
+						$sth = update_db::$db_sqlite->prepare($query);
228
+						$sth->execute();
229
+				} catch(PDOException $e) {
230
+						return "error : ".$e->getMessage();
231
+				}
232 232
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
233 233
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
234 234
 		
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
240 240
 		try {
241 241
 			if ($globalTransaction) $Connection->db->beginTransaction();
242
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
242
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
243 243
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
244 244
 				if ($values['UserString4'] == 'M') $type = 'military';
245 245
 				else $type = null;
246 246
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
247 247
 				$sth_dest->execute($query_dest_values);
248 248
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
249
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
250
-				    $sth_dest_owner->execute($query_dest_owner_values);
249
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
250
+					$sth_dest_owner->execute($query_dest_owner_values);
251 251
 				}
252
-            		}
252
+					}
253 253
 			if ($globalTransaction) $Connection->db->commit();
254 254
 		} catch(PDOException $e) {
255 255
 			return "error : ".$e->getMessage();
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 		try {
261 261
 			$Connection = new Connection();
262 262
 			$sth = $Connection->db->prepare($query);
263
-                        $sth->execute(array(':source' => $database_file));
264
-                } catch(PDOException $e) {
265
-                        return "error : ".$e->getMessage();
266
-                }
263
+						$sth->execute(array(':source' => $database_file));
264
+				} catch(PDOException $e) {
265
+						return "error : ".$e->getMessage();
266
+				}
267 267
 		return '';
268 268
 	}
269 269
 
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 		try {
276 276
 			$Connection = new Connection();
277 277
 			$sth = $Connection->db->prepare($query);
278
-                        $sth->execute(array(':source' => $database_file));
279
-                } catch(PDOException $e) {
280
-                        return "error : ".$e->getMessage();
281
-                }
278
+						$sth->execute(array(':source' => $database_file));
279
+				} catch(PDOException $e) {
280
+						return "error : ".$e->getMessage();
281
+				}
282 282
 		
283 283
 		if ($fh = fopen($database_file,"r")) {
284 284
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -288,26 +288,26 @@  discard block
 block discarded – undo
288 288
 			$sth_dest = $Connection->db->prepare($query_dest);
289 289
 			try {
290 290
 				if ($globalTransaction) $Connection->db->beginTransaction();
291
-            			while (!feof($fh)) {
292
-            				$values = array();
293
-            				$line = $Common->hex2str(fgets($fh,9999));
291
+						while (!feof($fh)) {
292
+							$values = array();
293
+							$line = $Common->hex2str(fgets($fh,9999));
294 294
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
295
-            				$values['ModeS'] = substr($line,0,6);
296
-            				$values['Registration'] = trim(substr($line,69,6));
297
-            				$aircraft_name = trim(substr($line,48,6));
298
-            				// Check if we can find ICAO, else set it to GLID
299
-            				$aircraft_name_split = explode(' ',$aircraft_name);
300
-            				$search_more = '';
301
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
302
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303
-            				$sth_search = $Connection->db->prepare($query_search);
295
+							$values['ModeS'] = substr($line,0,6);
296
+							$values['Registration'] = trim(substr($line,69,6));
297
+							$aircraft_name = trim(substr($line,48,6));
298
+							// Check if we can find ICAO, else set it to GLID
299
+							$aircraft_name_split = explode(' ',$aircraft_name);
300
+							$search_more = '';
301
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
302
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303
+							$sth_search = $Connection->db->prepare($query_search);
304 304
 					try {
305
-                                    		$sth_search->execute();
306
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
307
-	            				//if (count($result) > 0) {
308
-	            				if (isset($result['icao']) && $result['icao'] != '') {
309
-	            				    $values['ICAOTypeCode'] = $result['icao'];
310
-	            				} 
305
+											$sth_search->execute();
306
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
307
+								//if (count($result) > 0) {
308
+								if (isset($result['icao']) && $result['icao'] != '') {
309
+									$values['ICAOTypeCode'] = $result['icao'];
310
+								} 
311 311
 					} catch(PDOException $e) {
312 312
 						return "error : ".$e->getMessage();
313 313
 					}
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 		try {
331 331
 			$Connection = new Connection();
332 332
 			$sth = $Connection->db->prepare($query);
333
-                        $sth->execute(array(':source' => $database_file));
334
-                } catch(PDOException $e) {
335
-                        return "error : ".$e->getMessage();
336
-                }
333
+						$sth->execute(array(':source' => $database_file));
334
+				} catch(PDOException $e) {
335
+						return "error : ".$e->getMessage();
336
+				}
337 337
 		return '';
338 338
 	}
339 339
 
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 		try {
345 345
 			$Connection = new Connection();
346 346
 			$sth = $Connection->db->prepare($query);
347
-                        $sth->execute(array(':source' => $database_file));
348
-                } catch(PDOException $e) {
349
-                        return "error : ".$e->getMessage();
350
-                }
347
+						$sth->execute(array(':source' => $database_file));
348
+				} catch(PDOException $e) {
349
+						return "error : ".$e->getMessage();
350
+				}
351 351
 		
352 352
 		if ($fh = fopen($database_file,"r")) {
353 353
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -358,25 +358,25 @@  discard block
 block discarded – undo
358 358
 			try {
359 359
 				if ($globalTransaction) $Connection->db->beginTransaction();
360 360
 				$tmp = fgetcsv($fh,9999,',',"'");
361
-            			while (!feof($fh)) {
362
-            				$line = fgetcsv($fh,9999,',',"'");
361
+						while (!feof($fh)) {
362
+							$line = fgetcsv($fh,9999,',',"'");
363 363
             				
364 364
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
365 365
 					//print_r($line);
366
-            				$values['ModeS'] = $line[1];
367
-            				$values['Registration'] = $line[3];
368
-            				$values['ICAOTypeCode'] = '';
369
-            				$aircraft_name = $line[2];
370
-            				// Check if we can find ICAO, else set it to GLID
371
-            				$aircraft_name_split = explode(' ',$aircraft_name);
372
-            				$search_more = '';
373
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
374
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375
-            				$sth_search = $Connection->db->prepare($query_search);
366
+							$values['ModeS'] = $line[1];
367
+							$values['Registration'] = $line[3];
368
+							$values['ICAOTypeCode'] = '';
369
+							$aircraft_name = $line[2];
370
+							// Check if we can find ICAO, else set it to GLID
371
+							$aircraft_name_split = explode(' ',$aircraft_name);
372
+							$search_more = '';
373
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
374
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375
+							$sth_search = $Connection->db->prepare($query_search);
376 376
 					try {
377
-                                    		$sth_search->execute();
378
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
377
+											$sth_search->execute();
378
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
380 380
 					} catch(PDOException $e) {
381 381
 						return "error : ".$e->getMessage();
382 382
 					}
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 		try {
400 400
 			$Connection = new Connection();
401 401
 			$sth = $Connection->db->prepare($query);
402
-                        $sth->execute(array(':source' => $database_file));
403
-                } catch(PDOException $e) {
404
-                        return "error : ".$e->getMessage();
405
-                }
402
+						$sth->execute(array(':source' => $database_file));
403
+				} catch(PDOException $e) {
404
+						return "error : ".$e->getMessage();
405
+				}
406 406
 		return '';
407 407
 	}
408 408
 
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
 		try {
414 414
 			$Connection = new Connection();
415 415
 			$sth = $Connection->db->prepare($query);
416
-                        $sth->execute(array(':source' => $database_file));
417
-                } catch(PDOException $e) {
418
-                        return "error : ".$e->getMessage();
419
-                }
416
+						$sth->execute(array(':source' => $database_file));
417
+				} catch(PDOException $e) {
418
+						return "error : ".$e->getMessage();
419
+				}
420 420
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
421 421
 		$Spotter = new Spotter();
422 422
 		if ($fh = fopen($database_file,"r")) {
423 423
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
424 424
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
425
-		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
425
+				$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
426 426
 		        
427 427
 			$Connection = new Connection();
428 428
 			$sth_dest = $Connection->db->prepare($query_dest);
@@ -430,126 +430,126 @@  discard block
 block discarded – undo
430 430
 			try {
431 431
 				if ($globalTransaction) $Connection->db->beginTransaction();
432 432
 				$tmp = fgetcsv($fh,9999,',','"');
433
-            			while (!feof($fh)) {
434
-            				$line = fgetcsv($fh,9999,',','"');
435
-            				$values = array();
436
-            				//print_r($line);
437
-            				if ($country == 'F') {
438
-            				    $values['registration'] = $line[0];
439
-            				    $values['base'] = $line[4];
440
-            				    $values['owner'] = $line[5];
441
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
442
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
443
-					    $values['cancel'] = $line[7];
433
+						while (!feof($fh)) {
434
+							$line = fgetcsv($fh,9999,',','"');
435
+							$values = array();
436
+							//print_r($line);
437
+							if ($country == 'F') {
438
+								$values['registration'] = $line[0];
439
+								$values['base'] = $line[4];
440
+								$values['owner'] = $line[5];
441
+								if ($line[6] == '') $values['date_first_reg'] = null;
442
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
443
+						$values['cancel'] = $line[7];
444 444
 					} elseif ($country == 'EI') {
445
-					    // TODO : add modeS & reg to aircraft_modes
446
-            				    $values['registration'] = $line[0];
447
-            				    $values['base'] = $line[3];
448
-            				    $values['owner'] = $line[2];
449
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
450
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
451
-					    $values['cancel'] = '';
452
-					    $values['modes'] = $line[7];
453
-					    $values['icao'] = $line[8];
445
+						// TODO : add modeS & reg to aircraft_modes
446
+								$values['registration'] = $line[0];
447
+								$values['base'] = $line[3];
448
+								$values['owner'] = $line[2];
449
+								if ($line[1] == '') $values['date_first_reg'] = null;
450
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
451
+						$values['cancel'] = '';
452
+						$values['modes'] = $line[7];
453
+						$values['icao'] = $line[8];
454 454
 					    
455 455
 					} elseif ($country == 'HB') {
456
-					    // TODO : add modeS & reg to aircraft_modes
457
-            				    $values['registration'] = $line[0];
458
-            				    $values['base'] = null;
459
-            				    $values['owner'] = $line[5];
460
-            				    $values['date_first_reg'] = null;
461
-					    $values['cancel'] = '';
462
-					    $values['modes'] = $line[4];
463
-					    $values['icao'] = $line[7];
456
+						// TODO : add modeS & reg to aircraft_modes
457
+								$values['registration'] = $line[0];
458
+								$values['base'] = null;
459
+								$values['owner'] = $line[5];
460
+								$values['date_first_reg'] = null;
461
+						$values['cancel'] = '';
462
+						$values['modes'] = $line[4];
463
+						$values['icao'] = $line[7];
464 464
 					} elseif ($country == 'OK') {
465
-					    // TODO : add modeS & reg to aircraft_modes
466
-            				    $values['registration'] = $line[3];
467
-            				    $values['base'] = null;
468
-            				    $values['owner'] = $line[5];
469
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
470
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
471
-					    $values['cancel'] = '';
465
+						// TODO : add modeS & reg to aircraft_modes
466
+								$values['registration'] = $line[3];
467
+								$values['base'] = null;
468
+								$values['owner'] = $line[5];
469
+								if ($line[18] == '') $values['date_first_reg'] = null;
470
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
471
+						$values['cancel'] = '';
472 472
 					} elseif ($country == 'VH') {
473
-					    // TODO : add modeS & reg to aircraft_modes
474
-            				    $values['registration'] = $line[0];
475
-            				    $values['base'] = null;
476
-            				    $values['owner'] = $line[12];
477
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
478
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
479
-
480
-					    $values['cancel'] = $line[39];
473
+						// TODO : add modeS & reg to aircraft_modes
474
+								$values['registration'] = $line[0];
475
+								$values['base'] = null;
476
+								$values['owner'] = $line[12];
477
+								if ($line[28] == '') $values['date_first_reg'] = null;
478
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
479
+
480
+						$values['cancel'] = $line[39];
481 481
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
482
-            				    $values['registration'] = $line[0];
483
-            				    $values['base'] = null;
484
-            				    $values['owner'] = $line[4];
485
-            				    $values['date_first_reg'] = null;
486
-					    $values['cancel'] = '';
482
+								$values['registration'] = $line[0];
483
+								$values['base'] = null;
484
+								$values['owner'] = $line[4];
485
+								$values['date_first_reg'] = null;
486
+						$values['cancel'] = '';
487 487
 					} elseif ($country == 'CC') {
488
-            				    $values['registration'] = $line[0];
489
-            				    $values['base'] = null;
490
-            				    $values['owner'] = $line[6];
491
-            				    $values['date_first_reg'] = null;
492
-					    $values['cancel'] = '';
488
+								$values['registration'] = $line[0];
489
+								$values['base'] = null;
490
+								$values['owner'] = $line[6];
491
+								$values['date_first_reg'] = null;
492
+						$values['cancel'] = '';
493 493
 					} elseif ($country == 'HJ') {
494
-            				    $values['registration'] = $line[0];
495
-            				    $values['base'] = null;
496
-            				    $values['owner'] = $line[8];
497
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
498
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
-					    $values['cancel'] = '';
494
+								$values['registration'] = $line[0];
495
+								$values['base'] = null;
496
+								$values['owner'] = $line[8];
497
+								if ($line[7] == '') $values['date_first_reg'] = null;
498
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
+						$values['cancel'] = '';
500 500
 					} elseif ($country == 'PP') {
501
-            				    $values['registration'] = $line[0];
502
-            				    $values['base'] = null;
503
-            				    $values['owner'] = $line[4];
504
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
505
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
-					    $values['cancel'] = $line[7];
501
+								$values['registration'] = $line[0];
502
+								$values['base'] = null;
503
+								$values['owner'] = $line[4];
504
+								if ($line[6] == '') $values['date_first_reg'] = null;
505
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
+						$values['cancel'] = $line[7];
507 507
 					} elseif ($country == 'E7') {
508
-            				    $values['registration'] = $line[0];
509
-            				    $values['base'] = null;
510
-            				    $values['owner'] = $line[4];
511
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
512
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
513
-					    $values['cancel'] = '';
508
+								$values['registration'] = $line[0];
509
+								$values['base'] = null;
510
+								$values['owner'] = $line[4];
511
+								if ($line[5] == '') $values['date_first_reg'] = null;
512
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
513
+						$values['cancel'] = '';
514 514
 					} elseif ($country == '8Q') {
515
-            				    $values['registration'] = $line[0];
516
-            				    $values['base'] = null;
517
-            				    $values['owner'] = $line[3];
518
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
519
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
520
-					    $values['cancel'] = '';
515
+								$values['registration'] = $line[0];
516
+								$values['base'] = null;
517
+								$values['owner'] = $line[3];
518
+								if ($line[7] == '') $values['date_first_reg'] = null;
519
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
520
+						$values['cancel'] = '';
521 521
 					} elseif ($country == 'ZK') {
522
-            				    $values['registration'] = $line[0];
523
-            				    $values['base'] = null;
524
-            				    $values['owner'] = $line[3];
525
-            				    $values['date_first_reg'] = null;
526
-					    $values['cancel'] = '';
527
-					    $values['modes'] = $line[5];
528
-					    $values['icao'] = $line[9];
522
+								$values['registration'] = $line[0];
523
+								$values['base'] = null;
524
+								$values['owner'] = $line[3];
525
+								$values['date_first_reg'] = null;
526
+						$values['cancel'] = '';
527
+						$values['modes'] = $line[5];
528
+						$values['icao'] = $line[9];
529 529
 					} elseif ($country == 'M') {
530
-            				    $values['registration'] = $line[0];
531
-            				    $values['base'] = null;
532
-            				    $values['owner'] = $line[6];
533
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
534
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
535
-					    $values['modes'] = $line[4];
536
-					    $values['icao'] = $line[10];
530
+								$values['registration'] = $line[0];
531
+								$values['base'] = null;
532
+								$values['owner'] = $line[6];
533
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
534
+						$values['cancel'] = date("Y-m-d",strtotime($line[8]));
535
+						$values['modes'] = $line[4];
536
+						$values['icao'] = $line[10];
537 537
 					} elseif ($country == 'OY') {
538
-            				    $values['registration'] = $line[0];
539
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
540
-					    $values['modes'] = $line[5];
541
-					    $values['icao'] = $line[6];
538
+								$values['registration'] = $line[0];
539
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
540
+						$values['modes'] = $line[5];
541
+						$values['icao'] = $line[6];
542 542
 					} elseif ($country == 'PH') {
543
-            				    $values['registration'] = $line[0];
544
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
545
-					    $values['modes'] = $line[4];
546
-					    $values['icao'] = $line[5];
543
+								$values['registration'] = $line[0];
544
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
545
+						$values['modes'] = $line[4];
546
+						$values['icao'] = $line[5];
547 547
 					} elseif ($country == 'OM' || $country == 'TF') {
548
-            				    $values['registration'] = $line[0];
549
-            				    $values['base'] = null;
550
-            				    $values['owner'] = $line[3];
551
-            				    $values['date_first_reg'] = null;
552
-					    $values['cancel'] = '';
548
+								$values['registration'] = $line[0];
549
+								$values['base'] = null;
550
+								$values['owner'] = $line[3];
551
+								$values['date_first_reg'] = null;
552
+						$values['cancel'] = '';
553 553
 					}
554 554
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
555 555
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                         return "error : ".$e->getMessage();
683 683
                 }
684 684
                 */
685
-                /*
685
+				/*
686 686
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
687 687
 		try {
688 688
 			$Connection = new Connection();
@@ -927,10 +927,10 @@  discard block
 block discarded – undo
927 927
 		try {
928 928
 			$Connection = new Connection();
929 929
 			$sth = $Connection->db->prepare($query);
930
-                        $sth->execute(array(':source' => 'translation.csv'));
931
-                } catch(PDOException $e) {
932
-                        return "error : ".$e->getMessage();
933
-                }
930
+						$sth->execute(array(':source' => 'translation.csv'));
931
+				} catch(PDOException $e) {
932
+						return "error : ".$e->getMessage();
933
+				}
934 934
 
935 935
 		
936 936
 		//update_db::unzip($out_file);
@@ -949,21 +949,21 @@  discard block
 block discarded – undo
949 949
 					$data = $row;
950 950
 					$operator = $data[2];
951 951
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
952
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
953
-                                                //echo substr($operator, 0, 2)."\n";;
954
-                                                if (count($airline_array) > 0) {
952
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
953
+												//echo substr($operator, 0, 2)."\n";;
954
+												if (count($airline_array) > 0) {
955 955
 							//print_r($airline_array);
956 956
 							$operator = $airline_array[0]['icao'].substr($operator,2);
957
-                                                }
958
-                                        }
957
+												}
958
+										}
959 959
 					
960 960
 					$operator_correct = $data[3];
961 961
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
962
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
963
-                                                if (count($airline_array) > 0) {
964
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
965
-                                            	}
966
-                                        }
962
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
963
+												if (count($airline_array) > 0) {
964
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
965
+												}
966
+										}
967 967
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
968 968
 					try {
969 969
 						$sth = $Connection->db->prepare($query);
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 			//$Connection->db->commit();
978 978
 		}
979 979
 		return '';
980
-        }
980
+		}
981 981
 	
982 982
 	public static function translation_fam() {
983 983
 		global $tmp_dir, $globalTransaction;
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 			//$Connection->db->commit();
1016 1016
 		}
1017 1017
 		return '';
1018
-        }
1018
+		}
1019 1019
 
1020 1020
 	/*
1021 1021
 	* This function use FAA public data.
@@ -1027,19 +1027,19 @@  discard block
 block discarded – undo
1027 1027
 		try {
1028 1028
 			$Connection = new Connection();
1029 1029
 			$sth = $Connection->db->prepare($query);
1030
-                        $sth->execute(array(':source' => 'website_faa'));
1031
-                } catch(PDOException $e) {
1032
-                        return "error : ".$e->getMessage();
1033
-                }
1030
+						$sth->execute(array(':source' => 'website_faa'));
1031
+				} catch(PDOException $e) {
1032
+						return "error : ".$e->getMessage();
1033
+				}
1034 1034
 
1035 1035
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
1036 1036
 		try {
1037 1037
 			$Connection = new Connection();
1038 1038
 			$sth = $Connection->db->prepare($query);
1039
-                        $sth->execute(array(':source' => 'website_faa'));
1040
-                } catch(PDOException $e) {
1041
-                        return "error : ".$e->getMessage();
1042
-                }
1039
+						$sth->execute(array(':source' => 'website_faa'));
1040
+				} catch(PDOException $e) {
1041
+						return "error : ".$e->getMessage();
1042
+				}
1043 1043
 
1044 1044
 		$delimiter = ",";
1045 1045
 		$mfr = array();
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 		}
1208 1208
 		*/
1209 1209
 		return '';
1210
-        }
1210
+		}
1211 1211
         
1212 1212
 	public static function owner_fam() {
1213 1213
 		global $tmp_dir, $globalTransaction;
@@ -1215,10 +1215,10 @@  discard block
 block discarded – undo
1215 1215
 		try {
1216 1216
 			$Connection = new Connection();
1217 1217
 			$sth = $Connection->db->prepare($query);
1218
-                        $sth->execute(array(':source' => 'website_fam'));
1219
-                } catch(PDOException $e) {
1220
-                        return "error : ".$e->getMessage();
1221
-                }
1218
+						$sth->execute(array(':source' => 'website_fam'));
1219
+				} catch(PDOException $e) {
1220
+						return "error : ".$e->getMessage();
1221
+				}
1222 1222
 
1223 1223
 		$delimiter = "\t";
1224 1224
 		$Connection = new Connection();
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 			if ($globalTransaction) $Connection->db->commit();
1245 1245
 		}
1246 1246
 		return '';
1247
-        }
1247
+		}
1248 1248
 
1249 1249
 	public static function routes_fam() {
1250 1250
 		global $tmp_dir, $globalTransaction, $globalDebug;
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 			if ($globalTransaction) $Connection->db->commit();
1280 1280
 		}
1281 1281
 		return '';
1282
-        }
1282
+		}
1283 1283
 
1284 1284
 	public static function marine_identity_fam() {
1285 1285
 		global $tmp_dir, $globalTransaction;
@@ -1287,10 +1287,10 @@  discard block
 block discarded – undo
1287 1287
 		try {
1288 1288
 			$Connection = new Connection();
1289 1289
 			$sth = $Connection->db->prepare($query);
1290
-                        $sth->execute();
1291
-                } catch(PDOException $e) {
1292
-                        return "error : ".$e->getMessage();
1293
-                }
1290
+						$sth->execute();
1291
+				} catch(PDOException $e) {
1292
+						return "error : ".$e->getMessage();
1293
+				}
1294 1294
 
1295 1295
 		
1296 1296
 		//update_db::unzip($out_file);
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 			if ($globalTransaction) $Connection->db->commit();
1321 1321
 		}
1322 1322
 		return '';
1323
-        }
1323
+		}
1324 1324
 
1325 1325
 	public static function satellite_fam() {
1326 1326
 		global $tmp_dir, $globalTransaction;
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 			if ($globalTransaction) $Connection->db->commit();
1392 1392
 		}
1393 1393
 		return '';
1394
-        }
1394
+		}
1395 1395
 
1396 1396
 	public static function tle($filename,$tletype) {
1397 1397
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1402,10 +1402,10 @@  discard block
 block discarded – undo
1402 1402
 		try {
1403 1403
 			$Connection = new Connection();
1404 1404
 			$sth = $Connection->db->prepare($query);
1405
-                        $sth->execute(array(':source' => $filename));
1406
-                } catch(PDOException $e) {
1407
-                        return "error : ".$e->getMessage();
1408
-                }
1405
+						$sth->execute(array(':source' => $filename));
1406
+				} catch(PDOException $e) {
1407
+						return "error : ".$e->getMessage();
1408
+				}
1409 1409
 		
1410 1410
 		$Connection = new Connection();
1411 1411
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 			//$Connection->db->commit();
1441 1441
 		}
1442 1442
 		return '';
1443
-        }
1443
+		}
1444 1444
 
1445 1445
 	public static function satellite_ucsdb($filename) {
1446 1446
 		global $tmp_dir, $globalTransaction;
@@ -1689,11 +1689,11 @@  discard block
 block discarded – undo
1689 1689
 							try {
1690 1690
 								$sth = $Connection->db->prepare($query);
1691 1691
 								$sth->execute(array(
1692
-								    ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1693
-								    ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1694
-								    ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1695
-								    ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1696
-								    )
1692
+									':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1693
+									':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1694
+									':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1695
+									':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1696
+									)
1697 1697
 								);
1698 1698
 							} catch(PDOException $e) {
1699 1699
 								return "error : ".$e->getMessage();
@@ -1717,13 +1717,13 @@  discard block
 block discarded – undo
1717 1717
 			//$Connection->db->commit();
1718 1718
 		}
1719 1719
 		return '';
1720
-        }
1720
+		}
1721 1721
 
1722 1722
 	/**
1723
-        * Convert a HTML table to an array
1724
-        * @param String $data HTML page
1725
-        * @return Array array of the tables in HTML page
1726
-        */
1723
+	 * Convert a HTML table to an array
1724
+	 * @param String $data HTML page
1725
+	 * @return Array array of the tables in HTML page
1726
+	 */
1727 1727
 /*
1728 1728
         private static function table2array($data) {
1729 1729
                 $html = str_get_html($data);
@@ -1753,11 +1753,11 @@  discard block
 block discarded – undo
1753 1753
                 return(array_filter($tabledata));
1754 1754
         }
1755 1755
 */
1756
-       /**
1757
-        * Get data from form result
1758
-        * @param String $url form URL
1759
-        * @return String the result
1760
-        */
1756
+	   /**
1757
+	    * Get data from form result
1758
+	    * @param String $url form URL
1759
+	    * @return String the result
1760
+	    */
1761 1761
 /*
1762 1762
         private static function getData($url) {
1763 1763
                 $ch = curl_init();
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
 			if ($globalTransaction) $Connection->db->commit();
1851 1851
 		}
1852 1852
 		return '';
1853
-        }
1853
+		}
1854 1854
 
1855 1855
 	public static function ivao_airlines($filename) {
1856 1856
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1860,10 +1860,10 @@  discard block
 block discarded – undo
1860 1860
 		try {
1861 1861
 			$Connection = new Connection();
1862 1862
 			$sth = $Connection->db->prepare($query);
1863
-                        $sth->execute();
1864
-                } catch(PDOException $e) {
1865
-                        return "error : ".$e->getMessage();
1866
-                }
1863
+						$sth->execute();
1864
+				} catch(PDOException $e) {
1865
+						return "error : ".$e->getMessage();
1866
+				}
1867 1867
 
1868 1868
 		$header = NULL;
1869 1869
 		$delimiter = ':';
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 			if ($globalTransaction) $Connection->db->commit();
1888 1888
 		}
1889 1889
 		return '';
1890
-        }
1890
+		}
1891 1891
 	
1892 1892
 	public static function update_airspace() {
1893 1893
 		global $tmp_dir, $globalDBdriver;
@@ -1897,11 +1897,11 @@  discard block
 block discarded – undo
1897 1897
 			$query = 'DROP TABLE airspace';
1898 1898
 			try {
1899 1899
 				$sth = $Connection->db->prepare($query);
1900
-                    		$sth->execute();
1901
-	                } catch(PDOException $e) {
1900
+							$sth->execute();
1901
+					} catch(PDOException $e) {
1902 1902
 				return "error : ".$e->getMessage();
1903
-	                }
1904
-	        }
1903
+					}
1904
+			}
1905 1905
 
1906 1906
 
1907 1907
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -1966,10 +1966,10 @@  discard block
 block discarded – undo
1966 1966
 			$query = 'DROP TABLE countries';
1967 1967
 			try {
1968 1968
 				$sth = $Connection->db->prepare($query);
1969
-            	        	$sth->execute();
1970
-	                } catch(PDOException $e) {
1971
-    	                	echo "error : ".$e->getMessage();
1972
-	                }
1969
+							$sth->execute();
1970
+					} catch(PDOException $e) {
1971
+							echo "error : ".$e->getMessage();
1972
+					}
1973 1973
 		}
1974 1974
 		if ($globalDBdriver == 'mysql') {
1975 1975
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
 						$error = update_db::airlines_fam();
2427 2427
 						update_db::insert_airlines_version($airlines_md5);
2428 2428
 					} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed.";
2429
-			    } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2429
+				} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2430 2430
 			} elseif ($globalDebug) echo "No update.";
2431 2431
 		} else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed.";
2432 2432
 		if ($error != '') {
@@ -2800,12 +2800,12 @@  discard block
 block discarded – undo
2800 2800
 		echo $data;
2801 2801
 		*/
2802 2802
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2803
-		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2804
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2805
-		    $result = fread($fh,100000000);
2806
-		    //echo $result;
2807
-		    //var_dump(str_get_html($result));
2808
-		    //print_r(self::table2array($result));
2803
+			//var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2804
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
2805
+			$result = fread($fh,100000000);
2806
+			//echo $result;
2807
+			//var_dump(str_get_html($result));
2808
+			//print_r(self::table2array($result));
2809 2809
 		}
2810 2810
 
2811 2811
 	}
@@ -2819,10 +2819,10 @@  discard block
 block discarded – undo
2819 2819
 		try {
2820 2820
 			$Connection = new Connection();
2821 2821
 			$sth = $Connection->db->prepare($query);
2822
-                        $sth->execute();
2823
-                } catch(PDOException $e) {
2824
-                        return "error : ".$e->getMessage();
2825
-                }
2822
+						$sth->execute();
2823
+				} catch(PDOException $e) {
2824
+						return "error : ".$e->getMessage();
2825
+				}
2826 2826
 
2827 2827
 		$error = '';
2828 2828
 		if ($globalDebug) echo "Notam : Download...";
@@ -2878,8 +2878,8 @@  discard block
 block discarded – undo
2878 2878
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2879 2879
 					$data['permanent'] = 0;
2880 2880
 				} else {
2881
-				    $data['date_end'] = NULL;
2882
-				    $data['permanent'] = 1;
2881
+					$data['date_end'] = NULL;
2882
+					$data['permanent'] = 1;
2883 2883
 				}
2884 2884
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2885 2885
 				$NOTAM = new NOTAM();
@@ -2953,13 +2953,13 @@  discard block
 block discarded – undo
2953 2953
 		try {
2954 2954
 			$Connection = new Connection();
2955 2955
 			$sth = $Connection->db->prepare($query);
2956
-                        $sth->execute();
2957
-                } catch(PDOException $e) {
2958
-                        return "error : ".$e->getMessage();
2959
-                }
2960
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2961
-                if ($row['nb'] > 0) return false;
2962
-                else return true;
2956
+						$sth->execute();
2957
+				} catch(PDOException $e) {
2958
+						return "error : ".$e->getMessage();
2959
+				}
2960
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2961
+				if ($row['nb'] > 0) return false;
2962
+				else return true;
2963 2963
 	}
2964 2964
 
2965 2965
 	public static function insert_last_update() {
@@ -2968,10 +2968,10 @@  discard block
 block discarded – undo
2968 2968
 		try {
2969 2969
 			$Connection = new Connection();
2970 2970
 			$sth = $Connection->db->prepare($query);
2971
-                        $sth->execute();
2972
-                } catch(PDOException $e) {
2973
-                        return "error : ".$e->getMessage();
2974
-                }
2971
+						$sth->execute();
2972
+				} catch(PDOException $e) {
2973
+						return "error : ".$e->getMessage();
2974
+				}
2975 2975
 	}
2976 2976
 
2977 2977
 	public static function check_airspace_version($version) {
@@ -2979,13 +2979,13 @@  discard block
 block discarded – undo
2979 2979
 		try {
2980 2980
 			$Connection = new Connection();
2981 2981
 			$sth = $Connection->db->prepare($query);
2982
-                        $sth->execute(array(':version' => $version));
2983
-                } catch(PDOException $e) {
2984
-                        return "error : ".$e->getMessage();
2985
-                }
2986
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2987
-                if ($row['nb'] > 0) return true;
2988
-                else return false;
2982
+						$sth->execute(array(':version' => $version));
2983
+				} catch(PDOException $e) {
2984
+						return "error : ".$e->getMessage();
2985
+				}
2986
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2987
+				if ($row['nb'] > 0) return true;
2988
+				else return false;
2989 2989
 	}
2990 2990
 
2991 2991
 	public static function check_geoid_version($version) {
@@ -2993,13 +2993,13 @@  discard block
 block discarded – undo
2993 2993
 		try {
2994 2994
 			$Connection = new Connection();
2995 2995
 			$sth = $Connection->db->prepare($query);
2996
-                        $sth->execute(array(':version' => $version));
2997
-                } catch(PDOException $e) {
2998
-                        return "error : ".$e->getMessage();
2999
-                }
3000
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3001
-                if ($row['nb'] > 0) return true;
3002
-                else return false;
2996
+						$sth->execute(array(':version' => $version));
2997
+				} catch(PDOException $e) {
2998
+						return "error : ".$e->getMessage();
2999
+				}
3000
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3001
+				if ($row['nb'] > 0) return true;
3002
+				else return false;
3003 3003
 	}
3004 3004
 
3005 3005
 	public static function check_marine_identity_version($version) {
@@ -3100,10 +3100,10 @@  discard block
 block discarded – undo
3100 3100
 		try {
3101 3101
 			$Connection = new Connection();
3102 3102
 			$sth = $Connection->db->prepare($query);
3103
-                        $sth->execute(array(':version' => $version));
3104
-                } catch(PDOException $e) {
3105
-                        return "error : ".$e->getMessage();
3106
-                }
3103
+						$sth->execute(array(':version' => $version));
3104
+				} catch(PDOException $e) {
3105
+						return "error : ".$e->getMessage();
3106
+				}
3107 3107
 	}
3108 3108
 
3109 3109
 	public static function insert_marine_identity_version($version) {
@@ -3140,13 +3140,13 @@  discard block
 block discarded – undo
3140 3140
 		try {
3141 3141
 			$Connection = new Connection();
3142 3142
 			$sth = $Connection->db->prepare($query);
3143
-                        $sth->execute();
3144
-                } catch(PDOException $e) {
3145
-                        return "error : ".$e->getMessage();
3146
-                }
3147
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3148
-                if ($row['nb'] > 0) return false;
3149
-                else return true;
3143
+						$sth->execute();
3144
+				} catch(PDOException $e) {
3145
+						return "error : ".$e->getMessage();
3146
+				}
3147
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3148
+				if ($row['nb'] > 0) return false;
3149
+				else return true;
3150 3150
 	}
3151 3151
 
3152 3152
 	public static function insert_last_notam_update() {
@@ -3155,10 +3155,10 @@  discard block
 block discarded – undo
3155 3155
 		try {
3156 3156
 			$Connection = new Connection();
3157 3157
 			$sth = $Connection->db->prepare($query);
3158
-                        $sth->execute();
3159
-                } catch(PDOException $e) {
3160
-                        return "error : ".$e->getMessage();
3161
-                }
3158
+						$sth->execute();
3159
+				} catch(PDOException $e) {
3160
+						return "error : ".$e->getMessage();
3161
+				}
3162 3162
 	}
3163 3163
 
3164 3164
 	public static function check_last_airspace_update() {
@@ -3171,13 +3171,13 @@  discard block
 block discarded – undo
3171 3171
 		try {
3172 3172
 			$Connection = new Connection();
3173 3173
 			$sth = $Connection->db->prepare($query);
3174
-                        $sth->execute();
3175
-                } catch(PDOException $e) {
3176
-                        return "error : ".$e->getMessage();
3177
-                }
3178
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3179
-                if ($row['nb'] > 0) return false;
3180
-                else return true;
3174
+						$sth->execute();
3175
+				} catch(PDOException $e) {
3176
+						return "error : ".$e->getMessage();
3177
+				}
3178
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3179
+				if ($row['nb'] > 0) return false;
3180
+				else return true;
3181 3181
 	}
3182 3182
 
3183 3183
 	public static function insert_last_airspace_update() {
@@ -3186,10 +3186,10 @@  discard block
 block discarded – undo
3186 3186
 		try {
3187 3187
 			$Connection = new Connection();
3188 3188
 			$sth = $Connection->db->prepare($query);
3189
-                        $sth->execute();
3190
-                } catch(PDOException $e) {
3191
-                        return "error : ".$e->getMessage();
3192
-                }
3189
+						$sth->execute();
3190
+				} catch(PDOException $e) {
3191
+						return "error : ".$e->getMessage();
3192
+				}
3193 3193
 	}
3194 3194
 
3195 3195
 	public static function check_last_geoid_update() {
@@ -3202,13 +3202,13 @@  discard block
 block discarded – undo
3202 3202
 		try {
3203 3203
 			$Connection = new Connection();
3204 3204
 			$sth = $Connection->db->prepare($query);
3205
-                        $sth->execute();
3206
-                } catch(PDOException $e) {
3207
-                        return "error : ".$e->getMessage();
3208
-                }
3209
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3210
-                if ($row['nb'] > 0) return false;
3211
-                else return true;
3205
+						$sth->execute();
3206
+				} catch(PDOException $e) {
3207
+						return "error : ".$e->getMessage();
3208
+				}
3209
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3210
+				if ($row['nb'] > 0) return false;
3211
+				else return true;
3212 3212
 	}
3213 3213
 
3214 3214
 	public static function insert_last_geoid_update() {
@@ -3217,10 +3217,10 @@  discard block
 block discarded – undo
3217 3217
 		try {
3218 3218
 			$Connection = new Connection();
3219 3219
 			$sth = $Connection->db->prepare($query);
3220
-                        $sth->execute();
3221
-                } catch(PDOException $e) {
3222
-                        return "error : ".$e->getMessage();
3223
-                }
3220
+						$sth->execute();
3221
+				} catch(PDOException $e) {
3222
+						return "error : ".$e->getMessage();
3223
+				}
3224 3224
 	}
3225 3225
 
3226 3226
 	public static function check_last_owner_update() {
@@ -3248,10 +3248,10 @@  discard block
 block discarded – undo
3248 3248
 		try {
3249 3249
 			$Connection = new Connection();
3250 3250
 			$sth = $Connection->db->prepare($query);
3251
-                        $sth->execute();
3252
-                } catch(PDOException $e) {
3253
-                        return "error : ".$e->getMessage();
3254
-                }
3251
+						$sth->execute();
3252
+				} catch(PDOException $e) {
3253
+						return "error : ".$e->getMessage();
3254
+				}
3255 3255
 	}
3256 3256
 
3257 3257
 	public static function check_last_airlines_update() {
@@ -3295,13 +3295,13 @@  discard block
 block discarded – undo
3295 3295
 		try {
3296 3296
 			$Connection = new Connection();
3297 3297
 			$sth = $Connection->db->prepare($query);
3298
-                        $sth->execute();
3299
-                } catch(PDOException $e) {
3300
-                        return "error : ".$e->getMessage();
3301
-                }
3302
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3303
-                if ($row['nb'] > 0) return false;
3304
-                else return true;
3298
+						$sth->execute();
3299
+				} catch(PDOException $e) {
3300
+						return "error : ".$e->getMessage();
3301
+				}
3302
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3303
+				if ($row['nb'] > 0) return false;
3304
+				else return true;
3305 3305
 	}
3306 3306
 
3307 3307
 	public static function insert_last_schedules_update() {
@@ -3481,10 +3481,10 @@  discard block
 block discarded – undo
3481 3481
 		try {
3482 3482
 			$Connection = new Connection();
3483 3483
 			$sth = $Connection->db->prepare($query);
3484
-                        $sth->execute();
3485
-                } catch(PDOException $e) {
3486
-                        return "error : ".$e->getMessage();
3487
-                }
3484
+						$sth->execute();
3485
+				} catch(PDOException $e) {
3486
+						return "error : ".$e->getMessage();
3487
+				}
3488 3488
 	}
3489 3489
 	public static function delete_duplicateowner() {
3490 3490
 		global $globalDBdriver;
@@ -3496,10 +3496,10 @@  discard block
 block discarded – undo
3496 3496
 		try {
3497 3497
 			$Connection = new Connection();
3498 3498
 			$sth = $Connection->db->prepare($query);
3499
-                        $sth->execute();
3500
-                } catch(PDOException $e) {
3501
-                        return "error : ".$e->getMessage();
3502
-                }
3499
+						$sth->execute();
3500
+				} catch(PDOException $e) {
3501
+						return "error : ".$e->getMessage();
3502
+				}
3503 3503
 	}
3504 3504
 	
3505 3505
 	public static function update_all() {
Please login to merge, or discard this patch.
sitemap.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 		foreach($spotter_array as $spotter_item)
18 18
 		{
19 19
 			$output .= '<url>';
20
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
21
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
22
-			    $output .= '<changefreq>weekly</changefreq>';
20
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
21
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
22
+				$output .= '<changefreq>weekly</changefreq>';
23 23
 			$output .= '</url>';
24 24
 		}
25 25
 	$output .= '</urlset>';
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 		foreach($aircraft_types as $aircraft_item)
35 35
 		{
36 36
 			$output .= '<url>';
37
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>';
38
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
39
-			    $output .= '<changefreq>daily</changefreq>';
37
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>';
38
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
39
+				$output .= '<changefreq>daily</changefreq>';
40 40
 			$output .= '</url>';
41 41
 		}
42 42
 	$output .= '</urlset>';
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 		foreach($aircraft_registrations as $aircraft_item)
52 52
 		{
53 53
 			$output .= '<url>';
54
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>';
55
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
56
-			    $output .= '<changefreq>daily</changefreq>';
54
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>';
55
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
56
+				$output .= '<changefreq>daily</changefreq>';
57 57
 			$output .= '</url>';
58 58
 		}
59 59
 	$output .= '</urlset>';
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 		foreach($airline_names as $airline_item)
68 68
 		{
69 69
 			$output .= '<url>';
70
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>';
71
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
72
-			    $output .= '<changefreq>daily</changefreq>';
70
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>';
71
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
72
+				$output .= '<changefreq>daily</changefreq>';
73 73
 			$output .= '</url>';
74 74
 		}
75 75
 	$output .= '</urlset>';
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 		foreach($airport_names as $airport_item)
85 85
 		{
86 86
 			$output .= '<url>';
87
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
88
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
89
-			    $output .= '<changefreq>daily</changefreq>';
87
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
88
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
89
+				$output .= '<changefreq>daily</changefreq>';
90 90
 			$output .= '</url>';
91 91
 		}
92 92
 	$output .= '</urlset>';
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 		foreach($manufacturer_names as $manufacturer_item)
102 102
 		{
103 103
 			$output .= '<url>';
104
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.urlencode(strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer']))).'</loc>';
105
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
106
-			    $output .= '<changefreq>daily</changefreq>';
104
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.urlencode(strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer']))).'</loc>';
105
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
106
+				$output .= '<changefreq>daily</changefreq>';
107 107
 			$output .= '</url>';
108 108
 		}
109 109
 	$output .= '</urlset>';
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 		foreach($country_names as $country_item)
118 118
 		{
119 119
 			$output .= '<url>';
120
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.urlencode(strtolower(str_replace(" ", "-", $country_item['country']))).'</loc>';
121
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
122
-			    $output .= '<changefreq>daily</changefreq>';
120
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.urlencode(strtolower(str_replace(" ", "-", $country_item['country']))).'</loc>';
121
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
122
+				$output .= '<changefreq>daily</changefreq>';
123 123
 			$output .= '</url>';
124 124
 		}
125 125
 	$output .= '</urlset>';
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 		{
135 135
 			if (ctype_alnum($ident_item['ident'])) {
136 136
 				$output .= '<url>';
137
-				    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/ident/'.urlencode($ident_item['ident']).'</loc>';
138
-				    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
139
-				    $output .= '<changefreq>daily</changefreq>';
137
+					$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/ident/'.urlencode($ident_item['ident']).'</loc>';
138
+					$output .= '<lastmod>'.date("c", time()).'</lastmod>';
139
+					$output .= '<changefreq>daily</changefreq>';
140 140
 				$output .= '</url>';
141 141
 			}
142 142
 		}
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 		foreach($date_names as $date_item)
152 152
 		{
153 153
 			$output .= '<url>';
154
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
155
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
156
-			    $output .= '<changefreq>daily</changefreq>';
154
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
155
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
156
+				$output .= '<changefreq>daily</changefreq>';
157 157
 			$output .= '</url>';
158 158
 		}
159 159
 	$output .= '</urlset>';
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 		foreach($route_names as $route_item)
168 168
 		{
169 169
 			$output .= '<url>';
170
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
171
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
172
-			    $output .= '<changefreq>daily</changefreq>';
170
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
171
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
172
+				$output .= '<changefreq>daily</changefreq>';
173 173
 			$output .= '</url>';
174 174
 		}
175 175
 	$output .= '</urlset>';
@@ -181,117 +181,117 @@  discard block
 block discarded – undo
181 181
 		
182 182
 		/* STATIC PAGES */
183 183
 		$output .= '<url>';
184
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/</loc>';
185
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
186
-		    $output .= '<changefreq>daily</changefreq>';
184
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/</loc>';
185
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
186
+			$output .= '<changefreq>daily</changefreq>';
187 187
 		$output .= '</url>';
188 188
 		$output .= '<url>';
189
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/latest</loc>';
190
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
191
-		    $output .= '<changefreq>daily</changefreq>';
189
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/latest</loc>';
190
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
191
+			$output .= '<changefreq>daily</changefreq>';
192 192
 		$output .= '</url>';
193 193
 		$output .= '<url>';
194
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/highlights</loc>';
195
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
196
-		    $output .= '<changefreq>daily</changefreq>';
194
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/highlights</loc>';
195
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
196
+			$output .= '<changefreq>daily</changefreq>';
197 197
 		$output .= '</url>';
198 198
 		$output .= '<url>';
199
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft</loc>';
200
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
201
-		    $output .= '<changefreq>daily</changefreq>';
199
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft</loc>';
200
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
201
+			$output .= '<changefreq>daily</changefreq>';
202 202
 		$output .= '</url>';
203 203
 		$output .= '<url>';
204
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline</loc>';
205
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
206
-		    $output .= '<changefreq>daily</changefreq>';
204
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline</loc>';
205
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
206
+			$output .= '<changefreq>daily</changefreq>';
207 207
 		$output .= '</url>';
208 208
 		$output .= '<url>';
209
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport</loc>';
210
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
211
-		    $output .= '<changefreq>daily</changefreq>';
209
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport</loc>';
210
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
211
+			$output .= '<changefreq>daily</changefreq>';
212 212
 		$output .= '</url>';
213 213
 		$output .= '<url>';
214
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/search</loc>';
215
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
216
-		    $output .= '<changefreq>daily</changefreq>';
214
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/search</loc>';
215
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
216
+			$output .= '<changefreq>daily</changefreq>';
217 217
 		$output .= '</url>';
218 218
 		$output .= '<url>';
219
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/about</loc>';
220
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
221
-		    $output .= '<changefreq>weekly</changefreq>';
219
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/about</loc>';
220
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
221
+			$output .= '<changefreq>weekly</changefreq>';
222 222
 		$output .= '</url>';
223 223
 		
224 224
 		
225 225
 		/* STATISTIC PAGES */
226 226
 		$output .= '<url>';
227
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/aircraft</loc>';
228
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
229
-		    $output .= '<changefreq>daily</changefreq>';
227
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/aircraft</loc>';
228
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
229
+			$output .= '<changefreq>daily</changefreq>';
230 230
 		$output .= '</url>';
231 231
 		$output .= '<url>';
232
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/registration</loc>';
233
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
234
-		    $output .= '<changefreq>daily</changefreq>';
232
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/registration</loc>';
233
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
234
+			$output .= '<changefreq>daily</changefreq>';
235 235
 		$output .= '</url>';
236 236
 		$output .= '<url>';
237
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/manufacturer</loc>';
238
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
239
-		    $output .= '<changefreq>daily</changefreq>';
237
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/manufacturer</loc>';
238
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
239
+			$output .= '<changefreq>daily</changefreq>';
240 240
 		$output .= '</url>';
241 241
 		$output .= '<url>';
242
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline</loc>';
243
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
244
-		    $output .= '<changefreq>daily</changefreq>';
242
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline</loc>';
243
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
244
+			$output .= '<changefreq>daily</changefreq>';
245 245
 		$output .= '</url>';
246 246
 		$output .= '<url>';
247
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline-country</loc>';
248
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
249
-		    $output .= '<changefreq>daily</changefreq>';
247
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline-country</loc>';
248
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
249
+			$output .= '<changefreq>daily</changefreq>';
250 250
 		$output .= '</url>';
251 251
 		$output .= '<url>';
252
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure</loc>';
253
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
254
-		    $output .= '<changefreq>daily</changefreq>';
252
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure</loc>';
253
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
254
+			$output .= '<changefreq>daily</changefreq>';
255 255
 		$output .= '</url>';
256 256
 		$output .= '<url>';
257
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure-country</loc>';
258
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
259
-		    $output .= '<changefreq>daily</changefreq>';
257
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure-country</loc>';
258
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
259
+			$output .= '<changefreq>daily</changefreq>';
260 260
 		$output .= '</url>';
261 261
 		$output .= '<url>';
262
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival</loc>';
263
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
264
-		    $output .= '<changefreq>daily</changefreq>';
262
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival</loc>';
263
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
264
+			$output .= '<changefreq>daily</changefreq>';
265 265
 		$output .= '</url>';
266 266
 		$output .= '<url>';
267
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival-country</loc>';
268
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
269
-		    $output .= '<changefreq>daily</changefreq>';
267
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival-country</loc>';
268
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
269
+			$output .= '<changefreq>daily</changefreq>';
270 270
 		$output .= '</url>';
271 271
 		$output .= '<url>';
272
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-airport</loc>';
273
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
274
-		    $output .= '<changefreq>daily</changefreq>';
272
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-airport</loc>';
273
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
274
+			$output .= '<changefreq>daily</changefreq>';
275 275
 		$output .= '</url>';
276 276
 		$output .= '<url>';
277
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-waypoint</loc>';
278
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
279
-		    $output .= '<changefreq>daily</changefreq>';
277
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-waypoint</loc>';
278
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
279
+			$output .= '<changefreq>daily</changefreq>';
280 280
 		$output .= '</url>';
281 281
 		$output .= '<url>';
282
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/callsign</loc>';
283
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
284
-		    $output .= '<changefreq>daily</changefreq>';
282
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/callsign</loc>';
283
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
284
+			$output .= '<changefreq>daily</changefreq>';
285 285
 		$output .= '</url>';
286 286
 		$output .= '<url>';
287
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/date</loc>';
288
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
289
-		    $output .= '<changefreq>daily</changefreq>';
287
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/date</loc>';
288
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
289
+			$output .= '<changefreq>daily</changefreq>';
290 290
 		$output .= '</url>';
291 291
 		$output .= '<url>';
292
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/time</loc>';
293
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
294
-		    $output .= '<changefreq>daily</changefreq>';
292
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/time</loc>';
293
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
294
+			$output .= '<changefreq>daily</changefreq>';
295 295
 		$output .= '</url>';
296 296
 	$output .= '</urlset>';
297 297
 	
@@ -301,37 +301,37 @@  discard block
 block discarded – undo
301 301
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
302 302
 	$output .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
303 303
 		$output .= '<sitemap>';
304
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/static</loc>';
304
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/static</loc>';
305 305
 		$output .= '</sitemap>';
306 306
 		$output .= '<sitemap>';
307
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/flight</loc>';
307
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/flight</loc>';
308 308
 		$output .= '</sitemap>';
309 309
 		$output .= '<sitemap>';
310
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/aircraft</loc>';
310
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/aircraft</loc>';
311 311
 		$output .= '</sitemap>';
312 312
 		$output .= '<sitemap>';
313
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/registration</loc>';
313
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/registration</loc>';
314 314
 		$output .= '</sitemap>';
315 315
 		$output .= '<sitemap>';
316
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airline</loc>';
316
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airline</loc>';
317 317
 		$output .= '</sitemap>';
318 318
 		$output .= '<sitemap>';
319
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airport</loc>';
319
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airport</loc>';
320 320
 		$output .= '</sitemap>';
321 321
 		$output .= '<sitemap>';
322
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/manufacturer</loc>';
322
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/manufacturer</loc>';
323 323
 		$output .= '</sitemap>';
324 324
 		$output .= '<sitemap>';
325
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/country</loc>';
325
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/country</loc>';
326 326
 		$output .= '</sitemap>';
327 327
 		$output .= '<sitemap>';
328
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/ident</loc>';
328
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/ident</loc>';
329 329
 		$output .= '</sitemap>';
330 330
 		$output .= '<sitemap>';
331
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/date</loc>';
331
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/date</loc>';
332 332
 		$output .= '</sitemap>';
333 333
 		$output .= '<sitemap>';
334
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/route</loc>';
334
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/route</loc>';
335 335
 		$output .= '</sitemap>';
336 336
 	$output .= '</sitemapindex>';
337 337
 	
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -405,17 +405,17 @@  discard block
 block discarded – undo
405 405
 			}
406 406
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
407 407
 		} else $all = array();
408
-                if (empty($all)) {
409
-	                $Spotter = new Spotter($this->db);
410
-            		$filters = array();
408
+				if (empty($all)) {
409
+					$Spotter = new Spotter($this->db);
410
+					$filters = array();
411 411
 			$filters = array('year' => $year,'month' => $month);
412
-            		if ($filter_name != '') {
413
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
412
+					if ($filter_name != '') {
413
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
414 414
 			}
415 415
 			//$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
416
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
417
-                }
418
-                return $all;
416
+					$all = $Spotter->countAllAirlines($limit,0,'',$filters);
417
+				}
418
+				return $all;
419 419
 	}
420 420
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
421 421
 		global $globalStatsFilters;
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
 			return "error : ".$e->getMessage();
1613 1613
 		}
1614 1614
 	}
1615
-        /*
1615
+		/*
1616 1616
 	public function getStatsSource($date,$stats_type = '') {
1617 1617
 		if ($stats_type == '') {
1618 1618
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
@@ -2574,8 +2574,8 @@  discard block
 block discarded – undo
2574 2574
 					}
2575 2575
 					if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
2576 2576
 					$alldata = $Spotter->countAllMonthsAircrafts($filter);
2577
-				    	foreach ($alldata as $number) {
2578
-			    			$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2577
+						foreach ($alldata as $number) {
2578
+							$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2579 2579
 					}
2580 2580
 					if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
2581 2581
 					$alldata = $Spotter->countAllMonthsRealArrivals($filter);
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Indentation   +528 added lines, -528 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 	}
11 11
 
12 12
 	/**
13
-	* Get SQL query part for filter used
14
-	* @param Array $filter the filter
15
-	* @return Array the SQL part
16
-	*/
13
+	 * Get SQL query part for filter used
14
+	 * @param Array $filter the filter
15
+	 * @return Array the SQL part
16
+	 */
17 17
 	public function getFilter($filter = array(),$where = false,$and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
@@ -151,44 +151,44 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 
154
-        /**
155
-        * Gets all the spotter information based on a particular callsign
156
-        *
157
-        * @return Array the spotter information
158
-        *
159
-        */
160
-        public function getLastArchiveSpotterDataByIdent($ident)
161
-        {
154
+		/**
155
+		 * Gets all the spotter information based on a particular callsign
156
+		 *
157
+		 * @return Array the spotter information
158
+		 *
159
+		 */
160
+		public function getLastArchiveSpotterDataByIdent($ident)
161
+		{
162 162
 		$Spotter = new Spotter($this->db);
163
-                date_default_timezone_set('UTC');
163
+				date_default_timezone_set('UTC');
164 164
 
165
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
166
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
167
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
165
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
166
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
167
+				$query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
168 168
 
169
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
169
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
170 170
 
171
-                return $spotter_array;
172
-        }
171
+				return $spotter_array;
172
+		}
173 173
 
174 174
 
175
-        /**
176
-        * Gets last the spotter information based on a particular id
177
-        *
178
-        * @return Array the spotter information
179
-        *
180
-        */
181
-        public function getLastArchiveSpotterDataById($id)
182
-        {
183
-    		$Spotter = new Spotter($this->db);
184
-                date_default_timezone_set('UTC');
185
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
186
-                //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
187
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
188
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
175
+		/**
176
+		 * Gets last the spotter information based on a particular id
177
+		 *
178
+		 * @return Array the spotter information
179
+		 *
180
+		 */
181
+		public function getLastArchiveSpotterDataById($id)
182
+		{
183
+			$Spotter = new Spotter($this->db);
184
+				date_default_timezone_set('UTC');
185
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
186
+				//$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
187
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
188
+				$query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
189 189
 
190 190
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
191
-                  /*
191
+				  /*
192 192
                 try {
193 193
                         $Connection = new Connection();
194 194
                         $sth = Connection->$db->prepare($query);
@@ -198,122 +198,122 @@  discard block
 block discarded – undo
198 198
                 }
199 199
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
200 200
                 */
201
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
202
-
203
-                return $spotter_array;
204
-        }
205
-
206
-        /**
207
-        * Gets all the spotter information based on a particular id
208
-        *
209
-        * @return Array the spotter information
210
-        *
211
-        */
212
-        public function getAllArchiveSpotterDataById($id)
201
+				$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
202
+
203
+				return $spotter_array;
204
+		}
205
+
206
+		/**
207
+		 * Gets all the spotter information based on a particular id
208
+		 *
209
+		 * @return Array the spotter information
210
+		 *
211
+		 */
212
+		public function getAllArchiveSpotterDataById($id)
213 213
 	{
214
-                date_default_timezone_set('UTC');
215
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
216
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
214
+				date_default_timezone_set('UTC');
215
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
216
+				$query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
217 217
 
218 218
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
219 219
 
220
-                try {
221
-                        $sth = $this->db->prepare($query);
222
-                        $sth->execute(array(':id' => $id));
223
-                } catch(PDOException $e) {
224
-                        echo $e->getMessage();
225
-                        die;
226
-                }
227
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
228
-
229
-                return $spotter_array;
230
-        }
231
-
232
-        /**
233
-        * Gets coordinate & time spotter information based on a particular id
234
-        *
235
-        * @return Array the spotter information
236
-        *
237
-        */
238
-        public function getCoordArchiveSpotterDataById($id)
239
-        {
240
-                date_default_timezone_set('UTC');
241
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
242
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
220
+				try {
221
+						$sth = $this->db->prepare($query);
222
+						$sth->execute(array(':id' => $id));
223
+				} catch(PDOException $e) {
224
+						echo $e->getMessage();
225
+						die;
226
+				}
227
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
228
+
229
+				return $spotter_array;
230
+		}
231
+
232
+		/**
233
+		 * Gets coordinate & time spotter information based on a particular id
234
+		 *
235
+		 * @return Array the spotter information
236
+		 *
237
+		 */
238
+		public function getCoordArchiveSpotterDataById($id)
239
+		{
240
+				date_default_timezone_set('UTC');
241
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
242
+				$query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
243 243
 
244 244
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
245 245
 
246
-                try {
247
-                        $sth = $this->db->prepare($query);
248
-                        $sth->execute(array(':id' => $id));
249
-                } catch(PDOException $e) {
250
-                        echo $e->getMessage();
251
-                        die;
252
-                }
253
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
246
+				try {
247
+						$sth = $this->db->prepare($query);
248
+						$sth->execute(array(':id' => $id));
249
+				} catch(PDOException $e) {
250
+						echo $e->getMessage();
251
+						die;
252
+				}
253
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
254 254
 
255
-                return $spotter_array;
256
-        }
255
+				return $spotter_array;
256
+		}
257 257
 
258 258
 
259
-        /**
260
-        * Gets altitude information based on a particular callsign
261
-        *
262
-        * @return Array the spotter information
263
-        *
264
-        */
265
-        public function getAltitudeArchiveSpotterDataByIdent($ident)
266
-        {
259
+		/**
260
+		 * Gets altitude information based on a particular callsign
261
+		 *
262
+		 * @return Array the spotter information
263
+		 *
264
+		 */
265
+		public function getAltitudeArchiveSpotterDataByIdent($ident)
266
+		{
267 267
 
268
-                date_default_timezone_set('UTC');
268
+				date_default_timezone_set('UTC');
269 269
 
270
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
271
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
270
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
271
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
272 272
 
273
-                try {
274
-                        $sth = $this->db->prepare($query);
275
-                        $sth->execute(array(':ident' => $ident));
276
-                } catch(PDOException $e) {
277
-                        echo $e->getMessage();
278
-                        die;
279
-                }
280
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
273
+				try {
274
+						$sth = $this->db->prepare($query);
275
+						$sth->execute(array(':ident' => $ident));
276
+				} catch(PDOException $e) {
277
+						echo $e->getMessage();
278
+						die;
279
+				}
280
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
281 281
 
282
-                return $spotter_array;
283
-        }
282
+				return $spotter_array;
283
+		}
284 284
 
285
-        /**
286
-        * Gets altitude information based on a particular id
287
-        *
288
-        * @return Array the spotter information
289
-        *
290
-        */
291
-        public function getAltitudeArchiveSpotterDataById($id)
292
-        {
285
+		/**
286
+		 * Gets altitude information based on a particular id
287
+		 *
288
+		 * @return Array the spotter information
289
+		 *
290
+		 */
291
+		public function getAltitudeArchiveSpotterDataById($id)
292
+		{
293 293
 
294
-                date_default_timezone_set('UTC');
294
+				date_default_timezone_set('UTC');
295 295
 
296
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
297
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
296
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
297
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
298 298
 
299
-                try {
300
-                        $sth = $this->db->prepare($query);
301
-                        $sth->execute(array(':id' => $id));
302
-                } catch(PDOException $e) {
303
-                        echo $e->getMessage();
304
-                        die;
305
-                }
306
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
299
+				try {
300
+						$sth = $this->db->prepare($query);
301
+						$sth->execute(array(':id' => $id));
302
+				} catch(PDOException $e) {
303
+						echo $e->getMessage();
304
+						die;
305
+				}
306
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
307 307
 
308
-                return $spotter_array;
309
-        }
308
+				return $spotter_array;
309
+		}
310 310
 
311
-        /**
312
-        * Gets altitude & speed information based on a particular id
313
-        *
314
-        * @return Array the spotter information
315
-        *
316
-        */
311
+		/**
312
+		 * Gets altitude & speed information based on a particular id
313
+		 *
314
+		 * @return Array the spotter information
315
+		 *
316
+		 */
317 317
 	public function getAltitudeSpeedArchiveSpotterDataById($id)
318 318
 	{
319 319
 		date_default_timezone_set('UTC');
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 		return $spotter_array;
331 331
 	}
332 332
 
333
-        /**
334
-        * Gets altitude information based on a particular callsign
335
-        *
336
-        * @return Array the spotter information
337
-        *
338
-        */
333
+		/**
334
+		 * Gets altitude information based on a particular callsign
335
+		 *
336
+		 * @return Array the spotter information
337
+		 *
338
+		 */
339 339
 	public function getLastAltitudeArchiveSpotterDataByIdent($ident)
340 340
 	{
341 341
 		date_default_timezone_set('UTC');
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
 
356 356
 
357 357
 
358
-       /**
359
-        * Gets all the archive spotter information
360
-        *
361
-        * @return Array the spotter information
362
-        *
363
-        */
358
+	   /**
359
+	    * Gets all the archive spotter information
360
+	    *
361
+	    * @return Array the spotter information
362
+	    *
363
+	    */
364 364
 	public function getSpotterArchiveData($ident,$flightaware_id,$date)
365 365
 	{
366 366
 		$Spotter = new Spotter($this->db);
@@ -388,34 +388,34 @@  discard block
 block discarded – undo
388 388
 	}
389 389
 
390 390
 	/**
391
-        * Gets Minimal Live Spotter data
392
-        *
393
-        * @return Array the spotter information
394
-        *
395
-        */
396
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
397
-        {
398
-                global $globalDBdriver, $globalLiveInterval;
399
-                date_default_timezone_set('UTC');
400
-
401
-                $filter_query = '';
402
-                if (isset($filter['source']) && !empty($filter['source'])) {
403
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
404
-                }
405
-                // Use spotter_output also ?
406
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
407
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
408
-                }
409
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
410
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
411
-                }
412
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
413
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
414
-                }
391
+	 * Gets Minimal Live Spotter data
392
+	 *
393
+	 * @return Array the spotter information
394
+	 *
395
+	 */
396
+		public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
397
+		{
398
+				global $globalDBdriver, $globalLiveInterval;
399
+				date_default_timezone_set('UTC');
400
+
401
+				$filter_query = '';
402
+				if (isset($filter['source']) && !empty($filter['source'])) {
403
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
404
+				}
405
+				// Use spotter_output also ?
406
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
407
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
408
+				}
409
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
410
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
411
+				}
412
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
413
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
414
+				}
415 415
 
416
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
417
-                if ($globalDBdriver == 'mysql') {
418
-                        /*
416
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
417
+				if ($globalDBdriver == 'mysql') {
418
+						/*
419 419
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
420 420
                     		    FROM spotter_archive 
421 421
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -434,56 +434,56 @@  discard block
 block discarded – undo
434 434
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
435 435
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
436 436
                         	    '.$filter_query.' ORDER BY flightaware_id';
437
-                } else {
438
-                        //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
439
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
437
+				} else {
438
+						//$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
439
+						$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
440 440
                         	    FROM spotter_archive 
441 441
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
442 442
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
443 443
                         	    '.$filter_query.' ORDER BY flightaware_id';
444
-                }
445
-                //echo $query;
446
-                try {
447
-                        $sth = $this->db->prepare($query);
448
-                        $sth->execute();
449
-                } catch(PDOException $e) {
450
-                        echo $e->getMessage();
451
-                        die;
452
-                }
453
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
444
+				}
445
+				//echo $query;
446
+				try {
447
+						$sth = $this->db->prepare($query);
448
+						$sth->execute();
449
+				} catch(PDOException $e) {
450
+						echo $e->getMessage();
451
+						die;
452
+				}
453
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
454 454
 
455
-                return $spotter_array;
456
-        }
455
+				return $spotter_array;
456
+		}
457 457
 
458 458
 	/**
459
-        * Gets Minimal Live Spotter data
460
-        *
461
-        * @return Array the spotter information
462
-        *
463
-        */
464
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
465
-        {
466
-                global $globalDBdriver, $globalLiveInterval;
467
-                date_default_timezone_set('UTC');
468
-
469
-                $filter_query = '';
470
-                if (isset($filter['source']) && !empty($filter['source'])) {
471
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
472
-                }
473
-                // Should use spotter_output also ?
474
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
475
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
476
-                }
477
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
478
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
479
-                }
480
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
481
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
482
-                }
459
+	 * Gets Minimal Live Spotter data
460
+	 *
461
+	 * @return Array the spotter information
462
+	 *
463
+	 */
464
+		public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
465
+		{
466
+				global $globalDBdriver, $globalLiveInterval;
467
+				date_default_timezone_set('UTC');
468
+
469
+				$filter_query = '';
470
+				if (isset($filter['source']) && !empty($filter['source'])) {
471
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
472
+				}
473
+				// Should use spotter_output also ?
474
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
475
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
476
+				}
477
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
478
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
479
+				}
480
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
481
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
482
+				}
483 483
 
484
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
485
-                if ($globalDBdriver == 'mysql') {
486
-                        /*
484
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
485
+				if ($globalDBdriver == 'mysql') {
486
+						/*
487 487
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
488 488
                     		    FROM spotter_archive 
489 489
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -494,95 +494,95 @@  discard block
 block discarded – undo
494 494
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
495 495
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
496 496
 
497
-                } else {
498
-                        //$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
499
-                       /*
497
+				} else {
498
+						//$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
499
+					   /*
500 500
                         $query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
501 501
                         	    FROM spotter_archive_output 
502 502
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
503 503
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
504 504
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
505 505
                         */
506
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
506
+						$query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
507 507
                         	    FROM spotter_archive_output 
508 508
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
509 509
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
510 510
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
511 511
 //                        	    .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
512 512
                         	    
513
-                }
514
-                //echo $query;
515
-                try {
516
-                        $sth = $this->db->prepare($query);
517
-                        $sth->execute();
518
-                } catch(PDOException $e) {
519
-                        echo $e->getMessage();
520
-                        die;
521
-                }
522
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
513
+				}
514
+				//echo $query;
515
+				try {
516
+						$sth = $this->db->prepare($query);
517
+						$sth->execute();
518
+				} catch(PDOException $e) {
519
+						echo $e->getMessage();
520
+						die;
521
+				}
522
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
523 523
 
524
-                return $spotter_array;
525
-        }
524
+				return $spotter_array;
525
+		}
526 526
 
527 527
 	 /**
528
-        * Gets count Live Spotter data
529
-        *
530
-        * @return Array the spotter information
531
-        *
532
-        */
533
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
534
-        {
535
-                global $globalDBdriver, $globalLiveInterval;
536
-                date_default_timezone_set('UTC');
537
-
538
-                $filter_query = '';
539
-                if (isset($filter['source']) && !empty($filter['source'])) {
540
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
541
-                }
542
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
543
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
544
-                }
545
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
546
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
547
-                }
548
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
549
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
550
-                }
528
+	  * Gets count Live Spotter data
529
+	  *
530
+	  * @return Array the spotter information
531
+	  *
532
+	  */
533
+		public function getLiveSpotterCount($begindate,$enddate,$filter = array())
534
+		{
535
+				global $globalDBdriver, $globalLiveInterval;
536
+				date_default_timezone_set('UTC');
551 537
 
552
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
553
-                if ($globalDBdriver == 'mysql') {
538
+				$filter_query = '';
539
+				if (isset($filter['source']) && !empty($filter['source'])) {
540
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
541
+				}
542
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
543
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
544
+				}
545
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
546
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
547
+				}
548
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
549
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
550
+				}
551
+
552
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
553
+				if ($globalDBdriver == 'mysql') {
554 554
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb 
555 555
 			FROM spotter_archive l 
556 556
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
557
-                } else {
557
+				} else {
558 558
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
559
-                }
560
-                //echo $query;
561
-                try {
562
-                        $sth = $this->db->prepare($query);
563
-                        $sth->execute();
564
-                } catch(PDOException $e) {
565
-                        echo $e->getMessage();
566
-                        die;
567
-                }
559
+				}
560
+				//echo $query;
561
+				try {
562
+						$sth = $this->db->prepare($query);
563
+						$sth->execute();
564
+				} catch(PDOException $e) {
565
+						echo $e->getMessage();
566
+						die;
567
+				}
568 568
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
569 569
 		$sth->closeCursor();
570
-                return $result['nb'];
570
+				return $result['nb'];
571 571
 
572
-        }
572
+		}
573 573
 
574 574
 
575 575
 
576 576
 	// Spotter_Archive_output
577 577
 	
578
-    /**
579
-    * Gets all the spotter information
580
-    *
581
-    * @return Array the spotter information
582
-    *
583
-    */
584
-    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
585
-    {
578
+	/**
579
+	 * Gets all the spotter information
580
+	 *
581
+	 * @return Array the spotter information
582
+	 *
583
+	 */
584
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
585
+	{
586 586
 	global $globalTimezone, $globalDBdriver;
587 587
 	require_once(dirname(__FILE__).'/class.Translation.php');
588 588
 	$Translation = new Translation($this->db);
@@ -596,159 +596,159 @@  discard block
 block discarded – undo
596 596
 	$filter_query = $this->getFilter($filters);
597 597
 	if ($q != "")
598 598
 	{
599
-	    if (!is_string($q))
600
-	    {
599
+		if (!is_string($q))
600
+		{
601 601
 		return false;
602
-	    } else {
602
+		} else {
603 603
 	        
604 604
 		$q_array = explode(" ", $q);
605 605
 		
606 606
 		foreach ($q_array as $q_item){
607
-		    $additional_query .= " AND (";
608
-		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
609
-		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
610
-		    $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
611
-		    $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
612
-		    $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
613
-		    $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
614
-		    $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
615
-		    $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
616
-		    $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
617
-		    $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
618
-		    $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
619
-		    $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
620
-		    $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
621
-		    $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
622
-		    $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
623
-		    $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
624
-		    $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
625
-		    $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
626
-		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
627
-		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
628
-		    $translate = $Translation->ident2icao($q_item);
629
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
630
-		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
631
-		    $additional_query .= ")";
607
+			$additional_query .= " AND (";
608
+			$additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
609
+			$additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
610
+			$additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
611
+			$additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
612
+			$additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
613
+			$additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
614
+			$additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
615
+			$additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
616
+			$additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
617
+			$additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
618
+			$additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
619
+			$additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
620
+			$additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
621
+			$additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
622
+			$additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
623
+			$additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
624
+			$additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
625
+			$additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
626
+			$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
627
+			$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
628
+			$translate = $Translation->ident2icao($q_item);
629
+			if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
630
+			$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
631
+			$additional_query .= ")";
632
+		}
632 633
 		}
633
-	    }
634 634
 	}
635 635
 	
636 636
 	if ($registration != "")
637 637
 	{
638
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
639
-	    if (!is_string($registration))
640
-	    {
638
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
639
+		if (!is_string($registration))
640
+		{
641 641
 		return false;
642
-	    } else {
642
+		} else {
643 643
 		$additional_query .= " AND (spotter_archive_output.registration = '".$registration."')";
644
-	    }
644
+		}
645 645
 	}
646 646
 	
647 647
 	if ($aircraft_icao != "")
648 648
 	{
649
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
650
-	    if (!is_string($aircraft_icao))
651
-	    {
649
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
650
+		if (!is_string($aircraft_icao))
651
+		{
652 652
 		return false;
653
-	    } else {
653
+		} else {
654 654
 		$additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')";
655
-	    }
655
+		}
656 656
 	}
657 657
 	
658 658
 	if ($aircraft_manufacturer != "")
659 659
 	{
660
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
661
-	    if (!is_string($aircraft_manufacturer))
662
-	    {
660
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
661
+		if (!is_string($aircraft_manufacturer))
662
+		{
663 663
 		return false;
664
-	    } else {
664
+		} else {
665 665
 		$additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
666
-	    }
666
+		}
667 667
 	}
668 668
 	
669 669
 	if ($highlights == "true")
670 670
 	{
671
-	    if (!is_string($highlights))
672
-	    {
671
+		if (!is_string($highlights))
672
+		{
673 673
 		return false;
674
-	    } else {
674
+		} else {
675 675
 		$additional_query .= " AND (spotter_archive_output.highlight <> '')";
676
-	    }
676
+		}
677 677
 	}
678 678
 	
679 679
 	if ($airline_icao != "")
680 680
 	{
681
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
682
-	    if (!is_string($airline_icao))
683
-	    {
681
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
682
+		if (!is_string($airline_icao))
683
+		{
684 684
 		return false;
685
-	    } else {
685
+		} else {
686 686
 		$additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')";
687
-	    }
687
+		}
688 688
 	}
689 689
 	
690 690
 	if ($airline_country != "")
691 691
 	{
692
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
693
-	    if (!is_string($airline_country))
694
-	    {
692
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
693
+		if (!is_string($airline_country))
694
+		{
695 695
 		return false;
696
-	    } else {
696
+		} else {
697 697
 		$additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')";
698
-	    }
698
+		}
699 699
 	}
700 700
 	
701 701
 	if ($airline_type != "")
702 702
 	{
703
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
704
-	    if (!is_string($airline_type))
705
-	    {
703
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
704
+		if (!is_string($airline_type))
705
+		{
706 706
 		return false;
707
-	    } else {
707
+		} else {
708 708
 		if ($airline_type == "passenger")
709 709
 		{
710
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
710
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
711 711
 		}
712 712
 		if ($airline_type == "cargo")
713 713
 		{
714
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
714
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
715 715
 		}
716 716
 		if ($airline_type == "military")
717 717
 		{
718
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
718
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
719
+		}
719 720
 		}
720
-	    }
721 721
 	}
722 722
 	
723 723
 	if ($airport != "")
724 724
 	{
725
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
726
-	    if (!is_string($airport))
727
-	    {
725
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
726
+		if (!is_string($airport))
727
+		{
728 728
 		return false;
729
-	    } else {
729
+		} else {
730 730
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))";
731
-	    }
731
+		}
732 732
 	}
733 733
 	
734 734
 	if ($airport_country != "")
735 735
 	{
736
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
737
-	    if (!is_string($airport_country))
738
-	    {
736
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
737
+		if (!is_string($airport_country))
738
+		{
739 739
 		return false;
740
-	    } else {
740
+		} else {
741 741
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))";
742
-	    }
742
+		}
743 743
 	}
744 744
     
745 745
 	if ($callsign != "")
746 746
 	{
747
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
748
-	    if (!is_string($callsign))
749
-	    {
747
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
748
+		if (!is_string($callsign))
749
+		{
750 750
 		return false;
751
-	    } else {
751
+		} else {
752 752
 		$translate = $Translation->ident2icao($callsign);
753 753
 		if ($translate != $callsign) {
754 754
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
@@ -756,81 +756,81 @@  discard block
 block discarded – undo
756 756
 		} else {
757 757
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
758 758
 		}
759
-	    }
759
+		}
760 760
 	}
761 761
 
762 762
 	if ($owner != "")
763 763
 	{
764
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
765
-	    if (!is_string($owner))
766
-	    {
764
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
765
+		if (!is_string($owner))
766
+		{
767 767
 		return false;
768
-	    } else {
768
+		} else {
769 769
 		$additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')";
770
-	    }
770
+		}
771 771
 	}
772 772
 
773 773
 	if ($pilot_name != "")
774 774
 	{
775
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
776
-	    if (!is_string($pilot_name))
777
-	    {
775
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
776
+		if (!is_string($pilot_name))
777
+		{
778 778
 		return false;
779
-	    } else {
779
+		} else {
780 780
 		$additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')";
781
-	    }
781
+		}
782 782
 	}
783 783
 	
784 784
 	if ($pilot_id != "")
785 785
 	{
786
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
787
-	    if (!is_string($pilot_id))
788
-	    {
786
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
787
+		if (!is_string($pilot_id))
788
+		{
789 789
 		return false;
790
-	    } else {
790
+		} else {
791 791
 		$additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')";
792
-	    }
792
+		}
793 793
 	}
794 794
 	
795 795
 	if ($departure_airport_route != "")
796 796
 	{
797
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
798
-	    if (!is_string($departure_airport_route))
799
-	    {
797
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
798
+		if (!is_string($departure_airport_route))
799
+		{
800 800
 		return false;
801
-	    } else {
801
+		} else {
802 802
 		$additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')";
803
-	    }
803
+		}
804 804
 	}
805 805
 	
806 806
 	if ($arrival_airport_route != "")
807 807
 	{
808
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
809
-	    if (!is_string($arrival_airport_route))
810
-	    {
808
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
809
+		if (!is_string($arrival_airport_route))
810
+		{
811 811
 		return false;
812
-	    } else {
812
+		} else {
813 813
 		$additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
814
-	    }
814
+		}
815 815
 	}
816 816
 	
817 817
 	if ($altitude != "")
818 818
 	{
819
-	    $altitude_array = explode(",", $altitude);
819
+		$altitude_array = explode(",", $altitude);
820 820
 	    
821
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
822
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
821
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
822
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
823 823
 	    
824 824
 
825
-	    if ($altitude_array[1] != "")
826
-	    {                
825
+		if ($altitude_array[1] != "")
826
+		{                
827 827
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
828 828
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
829 829
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
830
-	    } else {
830
+		} else {
831 831
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
832 832
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
833
-	    }
833
+		}
834 834
 	}
835 835
 	
836 836
 	if ($date_posted != "")
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 		}
916 916
 	}
917 917
 
918
-    /**
919
-    * Gets all the spotter information based on the callsign
920
-    *
921
-    * @return Array the spotter information
922
-    *
923
-    */
924
-    public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
925
-    {
918
+	/**
919
+	 * Gets all the spotter information based on the callsign
920
+	 *
921
+	 * @return Array the spotter information
922
+	 *
923
+	 */
924
+	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
925
+	{
926 926
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
927 927
 	
928 928
 	date_default_timezone_set('UTC');
@@ -934,35 +934,35 @@  discard block
 block discarded – undo
934 934
 	
935 935
 	if ($ident != "")
936 936
 	{
937
-	    if (!is_string($ident))
938
-	    {
937
+		if (!is_string($ident))
938
+		{
939 939
 		return false;
940
-	    } else {
940
+		} else {
941 941
 		$additional_query = " AND (spotter_archive_output.ident = :ident)";
942 942
 		$query_values = array(':ident' => $ident);
943
-	    }
943
+		}
944 944
 	}
945 945
 	
946 946
 	if ($limit != "")
947 947
 	{
948
-	    $limit_array = explode(",", $limit);
948
+		$limit_array = explode(",", $limit);
949 949
 	    
950
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
951
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
950
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
951
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
952 952
 	    
953
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
954
-	    {
953
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
954
+		{
955 955
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
956 956
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
957
-	    }
957
+		}
958 958
 	}
959 959
 
960 960
 	if ($sort != "")
961 961
 	{
962
-	    $search_orderby_array = $Spotter->getOrderBy();
963
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
962
+		$search_orderby_array = $Spotter->getOrderBy();
963
+		$orderby_query = $search_orderby_array[$sort]['sql'];
964 964
 	} else {
965
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
965
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
966 966
 	}
967 967
 
968 968
 	$query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -970,17 +970,17 @@  discard block
 block discarded – undo
970 970
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
971 971
 
972 972
 	return $spotter_array;
973
-    }
973
+	}
974 974
 
975 975
 
976
-    /**
977
-    * Gets all the spotter information based on the owner
978
-    *
979
-    * @return Array the spotter information
980
-    *
981
-    */
982
-    public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
983
-    {
976
+	/**
977
+	 * Gets all the spotter information based on the owner
978
+	 *
979
+	 * @return Array the spotter information
980
+	 *
981
+	 */
982
+	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
983
+	{
984 984
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
985 985
 	
986 986
 	date_default_timezone_set('UTC');
@@ -993,35 +993,35 @@  discard block
 block discarded – undo
993 993
 	
994 994
 	if ($owner != "")
995 995
 	{
996
-	    if (!is_string($owner))
997
-	    {
996
+		if (!is_string($owner))
997
+		{
998 998
 		return false;
999
-	    } else {
999
+		} else {
1000 1000
 		$additional_query = " AND (spotter_archive_output.owner_name = :owner)";
1001 1001
 		$query_values = array(':owner' => $owner);
1002
-	    }
1002
+		}
1003 1003
 	}
1004 1004
 	
1005 1005
 	if ($limit != "")
1006 1006
 	{
1007
-	    $limit_array = explode(",", $limit);
1007
+		$limit_array = explode(",", $limit);
1008 1008
 	    
1009
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1010
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1009
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1010
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1011 1011
 	    
1012
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1013
-	    {
1012
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1013
+		{
1014 1014
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1015 1015
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1016
-	    }
1016
+		}
1017 1017
 	}
1018 1018
 
1019 1019
 	if ($sort != "")
1020 1020
 	{
1021
-	    $search_orderby_array = $Spotter->getOrderBy();
1022
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1021
+		$search_orderby_array = $Spotter->getOrderBy();
1022
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1023 1023
 	} else {
1024
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1024
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1025 1025
 	}
1026 1026
 
1027 1027
 	$query = $global_query.$filter_query." spotter_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1029,16 +1029,16 @@  discard block
 block discarded – undo
1029 1029
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1030 1030
 
1031 1031
 	return $spotter_array;
1032
-    }
1033
-
1034
-    /**
1035
-    * Gets all the spotter information based on the pilot
1036
-    *
1037
-    * @return Array the spotter information
1038
-    *
1039
-    */
1040
-    public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1041
-    {
1032
+	}
1033
+
1034
+	/**
1035
+	 * Gets all the spotter information based on the pilot
1036
+	 *
1037
+	 * @return Array the spotter information
1038
+	 *
1039
+	 */
1040
+	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1041
+	{
1042 1042
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
1043 1043
 	
1044 1044
 	date_default_timezone_set('UTC');
@@ -1057,24 +1057,24 @@  discard block
 block discarded – undo
1057 1057
 	
1058 1058
 	if ($limit != "")
1059 1059
 	{
1060
-	    $limit_array = explode(",", $limit);
1060
+		$limit_array = explode(",", $limit);
1061 1061
 	    
1062
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1063
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1062
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1063
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1064 1064
 	    
1065
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1066
-	    {
1065
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1066
+		{
1067 1067
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1068 1068
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1069
-	    }
1069
+		}
1070 1070
 	}
1071 1071
 
1072 1072
 	if ($sort != "")
1073 1073
 	{
1074
-	    $search_orderby_array = $Spotter->getOrderBy();
1075
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1074
+		$search_orderby_array = $Spotter->getOrderBy();
1075
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1076 1076
 	} else {
1077
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1077
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1078 1078
 	}
1079 1079
 
1080 1080
 	$query = $global_query.$filter_query." spotter_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1082,16 +1082,16 @@  discard block
 block discarded – undo
1082 1082
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1083 1083
 
1084 1084
 	return $spotter_array;
1085
-    }
1086
-
1087
-    /**
1088
-    * Gets all number of flight over countries
1089
-    *
1090
-    * @return Array the airline country list
1091
-    *
1092
-    */
1093
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1094
-    {
1085
+	}
1086
+
1087
+	/**
1088
+	 * Gets all number of flight over countries
1089
+	 *
1090
+	 * @return Array the airline country list
1091
+	 *
1092
+	 */
1093
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1094
+	{
1095 1095
 	global $globalDBdriver;
1096 1096
 	/*
1097 1097
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1102 1102
 		    FROM countries c, spotter_archive s
1103 1103
 		    WHERE c.iso2 = s.over_country ";
1104
-                if ($olderthanmonths > 0) {
1105
-            		if ($globalDBdriver == 'mysql') {
1104
+				if ($olderthanmonths > 0) {
1105
+					if ($globalDBdriver == 'mysql') {
1106 1106
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1107 1107
 			} else {
1108 1108
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1109 1109
 			}
1110 1110
 		}
1111
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1111
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1112 1112
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1113 1113
 	if ($limit) $query .= " LIMIT 0,10";
1114 1114
       
@@ -1121,23 +1121,23 @@  discard block
 block discarded – undo
1121 1121
         
1122 1122
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1123 1123
 	{
1124
-	    $temp_array['flight_count'] = $row['nb'];
1125
-	    $temp_array['flight_country'] = $row['name'];
1126
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1127
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1128
-	    $flight_array[] = $temp_array;
1124
+		$temp_array['flight_count'] = $row['nb'];
1125
+		$temp_array['flight_country'] = $row['name'];
1126
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1127
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1128
+		$flight_array[] = $temp_array;
1129 1129
 	}
1130 1130
 	return $flight_array;
1131
-    }
1132
-
1133
-    /**
1134
-    * Gets all number of flight over countries
1135
-    *
1136
-    * @return Array the airline country list
1137
-    *
1138
-    */
1139
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1140
-    {
1131
+	}
1132
+
1133
+	/**
1134
+	 * Gets all number of flight over countries
1135
+	 *
1136
+	 * @return Array the airline country list
1137
+	 *
1138
+	 */
1139
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1140
+	{
1141 1141
 	global $globalDBdriver;
1142 1142
 	/*
1143 1143
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1147,14 +1147,14 @@  discard block
 block discarded – undo
1147 1147
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1148 1148
 		    FROM countries c, spotter_archive s, spotter_output o
1149 1149
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.flightaware_id = s.flightaware_id ";
1150
-                if ($olderthanmonths > 0) {
1151
-            		if ($globalDBdriver == 'mysql') {
1150
+				if ($olderthanmonths > 0) {
1151
+					if ($globalDBdriver == 'mysql') {
1152 1152
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1153 1153
 			} else {
1154 1154
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1155 1155
 			}
1156 1156
 		}
1157
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1157
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1158 1158
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1159 1159
 	if ($limit) $query .= " LIMIT 0,10";
1160 1160
       
@@ -1167,24 +1167,24 @@  discard block
 block discarded – undo
1167 1167
         
1168 1168
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1169 1169
 	{
1170
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1171
-	    $temp_array['flight_count'] = $row['nb'];
1172
-	    $temp_array['flight_country'] = $row['name'];
1173
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1174
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1175
-	    $flight_array[] = $temp_array;
1170
+		$temp_array['airline_icao'] = $row['airline_icao'];
1171
+		$temp_array['flight_count'] = $row['nb'];
1172
+		$temp_array['flight_country'] = $row['name'];
1173
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1174
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1175
+		$flight_array[] = $temp_array;
1176 1176
 	}
1177 1177
 	return $flight_array;
1178
-    }
1179
-
1180
-    /**
1181
-    * Gets last spotter information based on a particular callsign
1182
-    *
1183
-    * @return Array the spotter information
1184
-    *
1185
-    */
1186
-    public function getDateArchiveSpotterDataById($id,$date)
1187
-    {
1178
+	}
1179
+
1180
+	/**
1181
+	 * Gets last spotter information based on a particular callsign
1182
+	 *
1183
+	 * @return Array the spotter information
1184
+	 *
1185
+	 */
1186
+	public function getDateArchiveSpotterDataById($id,$date)
1187
+	{
1188 1188
 	$Spotter = new Spotter($this->db);
1189 1189
 	date_default_timezone_set('UTC');
1190 1190
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1192,16 +1192,16 @@  discard block
 block discarded – undo
1192 1192
 	$date = date('c',$date);
1193 1193
 	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1194 1194
 	return $spotter_array;
1195
-    }
1196
-
1197
-    /**
1198
-    * Gets all the spotter information based on a particular callsign
1199
-    *
1200
-    * @return Array the spotter information
1201
-    *
1202
-    */
1203
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1204
-    {
1195
+	}
1196
+
1197
+	/**
1198
+	 * Gets all the spotter information based on a particular callsign
1199
+	 *
1200
+	 * @return Array the spotter information
1201
+	 *
1202
+	 */
1203
+	public function getDateArchiveSpotterDataByIdent($ident,$date)
1204
+	{
1205 1205
 	$Spotter = new Spotter($this->db);
1206 1206
 	date_default_timezone_set('UTC');
1207 1207
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1209,16 +1209,16 @@  discard block
 block discarded – undo
1209 1209
 	$date = date('c',$date);
1210 1210
 	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1211 1211
 	return $spotter_array;
1212
-    }
1213
-
1214
-    /**
1215
-    * Gets all the spotter information based on the airport
1216
-    *
1217
-    * @return Array the spotter information
1218
-    *
1219
-    */
1220
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1221
-    {
1212
+	}
1213
+
1214
+	/**
1215
+	 * Gets all the spotter information based on the airport
1216
+	 *
1217
+	 * @return Array the spotter information
1218
+	 *
1219
+	 */
1220
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1221
+	{
1222 1222
 	global $global_query;
1223 1223
 	$Spotter = new Spotter($this->db);
1224 1224
 	date_default_timezone_set('UTC');
@@ -1229,35 +1229,35 @@  discard block
 block discarded – undo
1229 1229
 	
1230 1230
 	if ($airport != "")
1231 1231
 	{
1232
-	    if (!is_string($airport))
1233
-	    {
1232
+		if (!is_string($airport))
1233
+		{
1234 1234
 		return false;
1235
-	    } else {
1235
+		} else {
1236 1236
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))";
1237 1237
 		$query_values = array(':airport' => $airport);
1238
-	    }
1238
+		}
1239 1239
 	}
1240 1240
 	
1241 1241
 	if ($limit != "")
1242 1242
 	{
1243
-	    $limit_array = explode(",", $limit);
1243
+		$limit_array = explode(",", $limit);
1244 1244
 	    
1245
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1246
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1245
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1246
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1247 1247
 	    
1248
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1249
-	    {
1248
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1249
+		{
1250 1250
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1251 1251
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1252
-	    }
1252
+		}
1253 1253
 	}
1254 1254
 	
1255 1255
 	if ($sort != "")
1256 1256
 	{
1257
-	    $search_orderby_array = $Spotter->getOrderBy();
1258
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1257
+		$search_orderby_array = $Spotter->getOrderBy();
1258
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1259 1259
 	} else {
1260
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1260
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1261 1261
 	}
1262 1262
 
1263 1263
 	$query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1265,6 +1265,6 @@  discard block
 block discarded – undo
1265 1265
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1266 1266
 
1267 1267
 	return $spotter_array;
1268
-    }
1268
+	}
1269 1269
 }
1270 1270
 ?>
1271 1271
\ No newline at end of file
Please login to merge, or discard this patch.
location-geojson.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,36 +14,36 @@
 block discarded – undo
14 14
 	{
15 15
 		$coords = explode(',',$_GET['coord']);
16 16
 		if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') 
17
-		    || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
17
+			|| (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
18 18
 			//$spotter_array = $Source->getAllLocationInfo();
19 19
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords));
20 20
 		}
21 21
 		if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') 
22
-		    || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
22
+			|| (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
23 23
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords));
24 24
 		}
25 25
 		if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') 
26
-		    || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
26
+			|| (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
27 27
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords));
28 28
 		}
29 29
 		
30 30
 		if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') 
31
-		    || (!isset($_COOKIE['show_Fire']) && (!isset($globalMapFire) || $globalMapFire === TRUE))) {
31
+			|| (!isset($_COOKIE['show_Fire']) && (!isset($globalMapFire) || $globalMapFire === TRUE))) {
32 32
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true));
33 33
 		}
34 34
 		$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType(''));
35 35
 	} else {
36 36
 		if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') 
37
-		    || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
37
+			|| (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
38 38
 			//$spotter_array = $Source->getAllLocationInfo();
39 39
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs'));
40 40
 		}
41 41
 		if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') 
42
-		    || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
42
+			|| (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
43 43
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx'));
44 44
 		}
45 45
 		if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') 
46
-		    || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
46
+			|| (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
47 47
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning'));
48 48
 		}
49 49
 		/*
Please login to merge, or discard this patch.
live-czml.php 1 patch
Indentation   +23 added lines, -23 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
 
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 			$image = "images/placeholder_thumb.png";
240 240
 		}
241 241
 
242
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
243
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
244
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
245
-                if ($prev_flightaware_id != $id) {
242
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
243
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
244
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
245
+				if ($prev_flightaware_id != $id) {
246 246
 			if ($prev_flightaware_id != '') {
247 247
 				if ($nblatlong == 1) {
248 248
 					$output .= ',"'.date("c").'", ';
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
302 302
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
303 303
 						} else $aircraft_shadow = '';
304
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
304
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
305 305
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] && isset($_COOKIE['IconColor'])) {
306 306
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
307 307
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
332 332
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
333 333
 						}
334
-    						$output .= '},';
334
+							$output .= '},';
335 335
 					} elseif ($aircraft_icao != '') {
336 336
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
337 337
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.