Completed
Push — master ( 3240cd...3b3f2b )
by Yannick
91:52 queued 65:41
created
js/map-satellite.2d.js.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 			}
554 554
                     }
555 555
 		    <?php
556
-            		} else {
557
-            	    ?>
556
+					} else {
557
+					?>
558 558
 		    if (map.getZoom() > 7) {
559 559
                 	var style = {
560 560
                     	    "color": "#1a3151",
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
                 	layer_satellite_data.addLayer(layer);
574 574
 		    }
575 575
 <?php
576
-            		}
576
+					}
577 577
 ?>
578 578
 				}
579 579
 			    }
Please login to merge, or discard this patch.
header.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30 30
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
31
+		return strpos($key,'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 	}
161 161
 ?>
162 162
 <?php 
163
-    if (isset($_POST['archive'])) {
163
+	if (isset($_POST['archive'])) {
164 164
 ?>
165 165
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
166 166
 <?php 
167
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
167
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
168 168
 ?>
169 169
 
170 170
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
171 171
 <?php    
172
-	    }
173
-    } else {
172
+		}
173
+	} else {
174 174
 ?>
175 175
 <?php
176 176
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 */
183 183
 ?>
184 184
 <?php 
185
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
185
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
186 186
 ?>
187 187
 <?php
188 188
 //		if (isset($globalBeta) && $globalBeta) {
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 <script src="<?php print $globalURL; ?>/js/map-satellite.2d.js.php?<?php print time(); ?>"></script>
214 214
 <?php
215 215
 		}
216
-	    }
216
+		}
217 217
 ?>
218 218
 <?php
219 219
 //	}
220 220
 ?>
221 221
 <?php
222
-    }
222
+	}
223 223
 }
224 224
 ?>
225 225
 <?php
@@ -397,61 +397,61 @@  discard block
 block discarded – undo
397 397
       <ul class="nav navbar-nav">
398 398
 
399 399
 <?php 
400
-    $sub = false;
401
-    if (
400
+	$sub = false;
401
+	if (
402 402
 	(
403
-	    (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
403
+		(!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
404 404
 	) || 
405 405
 	(
406
-	    isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
406
+		isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
407 407
 	) || 
408 408
 	(
409
-	    isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
409
+		isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
410 410
 	) || 
411 411
 	(
412
-	    isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
412
+		isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
413 413
 	)
414
-    ) {
414
+	) {
415 415
 	$sub = true;
416
-    }
416
+	}
417 417
 ?>
418 418
 <?php
419
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
419
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
420 420
 ?>
421 421
     <li class="dropdown">
422 422
 <?php
423
-    if ($sub) {
423
+	if ($sub) {
424 424
 ?>
425 425
       	<li class="dropdown">
426 426
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a>
427 427
 	<ul class="dropdown-menu multi-level">
428 428
       	<li class="dropdown-submenu">
429 429
 <?php
430
-    }
430
+	}
431 431
 ?>
432 432
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
433 433
           <ul class="dropdown-menu">
434 434
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
435 435
 <?php
436
-    if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
436
+	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
437 437
 ?>
438 438
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
439 439
 <?php
440
-    }
440
+	}
441 441
 ?>
442 442
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
443 443
 <?php
444
-    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
444
+	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
445 445
 ?>
446 446
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
447 447
 <?php
448
-    } 
449
-    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
448
+	} 
449
+	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
450 450
 
451 451
 ?>
452 452
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
453 453
 <?php
454
-    }
454
+	}
455 455
 ?>
456 456
 			<li><hr /></li>
457 457
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -459,43 +459,43 @@  discard block
 block discarded – undo
459 459
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
460 460
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
461 461
             <?php
462
-        	if ($globalACARS) {
463
-        	    if (isset($globalDemo) && $globalDemo) {
464
-    	    ?>
462
+			if ($globalACARS) {
463
+				if (isset($globalDemo) && $globalDemo) {
464
+			?>
465 465
             <li><hr /></li>
466 466
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
467 467
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
468 468
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
469 469
             <?php
470
-        	    } else {
471
-    	    ?>
470
+				} else {
471
+			?>
472 472
             <li><hr /></li>
473 473
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
474 474
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
475 475
             <?php
476
-        	    }
477
-        	}
478
-    	    ?>
476
+				}
477
+			}
478
+			?>
479 479
     	    <?php
480
-    	        if (isset($globalAccidents) && $globalAccidents) {
481
-    	    ?>
480
+				if (isset($globalAccidents) && $globalAccidents) {
481
+			?>
482 482
             <li><hr /></li>
483 483
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
484 484
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
485 485
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
486 486
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
487 487
             <?php
488
-        	}
489
-    	    ?>
488
+			}
489
+			?>
490 490
             <li><hr /></li>
491 491
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
492 492
             <?php
493 493
 		if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) {
494
-	    ?>
494
+		?>
495 495
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
496 496
 	    <?php
497 497
 		}
498
-	    ?>
498
+		?>
499 499
           </ul>
500 500
         </li>
501 501
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
     </ul>
523 523
 <?php
524 524
 	}
525
-    }
525
+	}
526 526
 ?>
527 527
 <?php
528
-    if (isset($globalMarine) && $globalMarine) {
528
+	if (isset($globalMarine) && $globalMarine) {
529 529
 ?>
530 530
     <li class="dropdown">
531 531
 <?php
532
-        if ($sub) {
532
+		if ($sub) {
533 533
 ?>
534 534
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a>
535 535
 	<ul class="dropdown-menu multi-level">
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
 	}
555 555
 ?>
556 556
 <?php
557
-    }
557
+	}
558 558
 ?>
559 559
 <?php
560
-    if (isset($globalTracker) && $globalTracker) {
560
+	if (isset($globalTracker) && $globalTracker) {
561 561
 ?>
562 562
     <li class="dropdown">
563 563
 <?php
564
-        if ($sub) {
564
+		if ($sub) {
565 565
 ?>
566 566
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
567 567
 	<ul class="dropdown-menu multi-level">
@@ -586,14 +586,14 @@  discard block
 block discarded – undo
586 586
 	}
587 587
 ?>
588 588
 <?php
589
-    }
589
+	}
590 590
 ?>
591 591
 <?php
592
-    if (isset($globalSatellite) && $globalSatellite) {
592
+	if (isset($globalSatellite) && $globalSatellite) {
593 593
 ?>
594 594
     <li class="dropdown">
595 595
 <?php
596
-        if ($sub) {
596
+		if ($sub) {
597 597
 ?>
598 598
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellite"); ?> <b class="caret"></b></a>
599 599
 	<ul class="dropdown-menu multi-level">
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	}
621 621
 ?>
622 622
 <?php
623
-    }
623
+	}
624 624
 ?>
625 625
 
626 626
         <li class="dropdown">
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
630 630
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
631 631
 <?php
632
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
632
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
633 633
 ?>
634 634
 		<li><hr /></li>
635 635
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
636 636
 <?php
637
-    }
637
+	}
638 638
 ?>
639 639
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
640 640
                 <li><hr /></li>
@@ -655,14 +655,14 @@  discard block
 block discarded – undo
655 655
   	    <form>
656 656
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
657 657
   		    <?php
658
-  		        $Language = new Language();
659
-  		        $alllang = $Language->getLanguages();
660
-  		        foreach ($alllang as $key => $lang) {
661
-  		            print '<option value="'.$key.'"';
662
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
663
-  		            print '>'.$lang[0].'</option>';
664
-  		        }
665
-  		    ?>
658
+  				$Language = new Language();
659
+  				$alllang = $Language->getLanguages();
660
+  				foreach ($alllang as $key => $lang) {
661
+  					print '<option value="'.$key.'"';
662
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
663
+  					print '>'.$lang[0].'</option>';
664
+  				}
665
+  			?>
666 666
   		</select>
667 667
   	    </form>
668 668
   	</div>
@@ -693,18 +693,18 @@  discard block
 block discarded – undo
693 693
 ?>
694 694
     <div class="top-header clear" role="main">
695 695
 <?php
696
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
696
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
697 697
 ?>
698 698
     <div id="archive-map"></div>
699 699
 <?php
700
-    }
700
+	}
701 701
 ?>
702 702
     </div>
703 703
 <?php
704 704
 }
705 705
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
706 706
 {
707
-    ?>
707
+	?>
708 708
     <div class="top-header clear" role="main">
709 709
         <div id="map"></div>
710 710
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -715,15 +715,15 @@  discard block
 block discarded – undo
715 715
         var zoom = 13;
716 716
 //create the map
717 717
 <?php
718
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
718
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
719 719
 ?>
720 720
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
721 721
 <?php
722
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
722
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
723 723
 ?>
724 724
   map = L.map('map', { zoomControl:true });
725 725
 <?php
726
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
726
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
727 727
 ?>
728 728
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
729 729
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -731,22 +731,22 @@  discard block
 block discarded – undo
731 731
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
732 732
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
733 733
 <?php
734
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
734
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
735 735
 ?>
736 736
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
737 737
 <?php
738
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
738
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
739 739
 ?>
740 740
   map = L.map('map', { zoomControl:true });
741 741
 <?php
742
-    }
742
+	}
743 743
 ?>
744 744
   //initialize the layer group for the aircrft markers
745 745
   var layer_data = L.layerGroup();
746 746
 
747 747
   //a few title layers
748 748
 <?php
749
-    if ($globalMapProvider == 'Mapbox') {
749
+	if ($globalMapProvider == 'Mapbox') {
750 750
 ?>
751 751
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
752 752
     maxZoom: 18,
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
     token : '<?php print $globalMapboxToken; ?>'
758 758
   }).addTo(map);
759 759
 <?php
760
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
760
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
761 761
 ?>
762 762
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
763 763
     maxZoom: 18,
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
767 767
   }).addTo(map);
768 768
 <?php
769
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
769
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
770 770
 ?>
771 771
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
772 772
     maxZoom: 18,
@@ -775,27 +775,27 @@  discard block
 block discarded – undo
775 775
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
776 776
   }).addTo(map);
777 777
 <?php
778
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
778
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
779 779
 ?>
780 780
     var googleLayer = new L.Google('ROADMAP');
781 781
     map.addLayer(googleLayer);
782 782
 <?php
783
-    } elseif ($globalMapProvider == 'Google-Satellite') {
783
+	} elseif ($globalMapProvider == 'Google-Satellite') {
784 784
 ?>
785 785
     var googleLayer = new L.Google('SATELLITE');
786 786
     map.addLayer(googleLayer);
787 787
 <?php
788
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
788
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
789 789
 ?>
790 790
     var googleLayer = new L.Google('HYBRID');
791 791
     map.addLayer(googleLayer);
792 792
 <?php
793
-    } elseif ($globalMapProvider == 'Google-Terrain') {
793
+	} elseif ($globalMapProvider == 'Google-Terrain') {
794 794
 ?>
795 795
     var googleLayer = new L.Google('Terrain');
796 796
     map.addLayer(googleLayer);
797 797
 <?php
798
-    } elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
798
+	} elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
799 799
 	$customid = $globalMapProvider;
800 800
 ?>
801 801
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
@@ -805,8 +805,8 @@  discard block
 block discarded – undo
805 805
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
806 806
     }).addTo(map);
807 807
 <?php
808
-    //} elseif ($globalMapProvider == 'OpenStreetMap') {
809
-    } else {
808
+	//} elseif ($globalMapProvider == 'OpenStreetMap') {
809
+	} else {
810 810
 ?>
811 811
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
812 812
     maxZoom: 18,
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
   }).addTo(map);
816 816
 
817 817
 <?php
818
-    }
818
+	}
819 819
 ?>
820 820
         </script>
821 821
     </div>
Please login to merge, or discard this patch.
install/install-action.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	if ($check_version == '0') {
85 85
 		
86 86
 		if ($globalDBdriver == 'mysql') {
87
-		    $error .= create_db::import_all_db('../db/');
87
+			$error .= create_db::import_all_db('../db/');
88 88
 		} elseif ($globalDBdriver == 'pgsql') {
89
-		    $error .= create_db::import_all_db('../db/pgsql/');
89
+			$error .= create_db::import_all_db('../db/pgsql/');
90 90
 		}
91 91
 		if ($error != '') {
92 92
 			$_SESSION['error'] = $error;
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 			$_SESSION['install'] = 'populate';
97 97
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
98 98
 		} else {
99
-		    $_SESSION['install'] = 'sources';
100
-		    $_SESSION['next'] = 'Insert data in source table';
99
+			$_SESSION['install'] = 'sources';
100
+			$_SESSION['next'] = 'Insert data in source table';
101 101
 		}
102 102
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
103 103
 		print json_encode($result);
@@ -149,21 +149,21 @@  discard block
 block discarded – undo
149 149
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
150 150
 	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
151 151
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
152
-	    $_SESSION['install'] = 'notam';
153
-	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
154
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
155
-	    print json_encode($result);
152
+		$_SESSION['install'] = 'notam';
153
+		$_SESSION['next'] = 'Populate NOTAM table with externals data';
154
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
155
+		print json_encode($result);
156 156
 	} elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
157
-	    $_SESSION['install'] = 'owner';
158
-	    $_SESSION['next'] = 'Populate owner table with externals data';
159
-	    unset($_SESSION['owner']);
160
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
161
-	    print json_encode($result);
157
+		$_SESSION['install'] = 'owner';
158
+		$_SESSION['next'] = 'Populate owner table with externals data';
159
+		unset($_SESSION['owner']);
160
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
161
+		print json_encode($result);
162 162
 	} else {
163
-	    $_SESSION['install'] = 'sources';
164
-	    $_SESSION['next'] = 'Insert data in source table';
165
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
166
-	    print json_encode($result);
163
+		$_SESSION['install'] = 'sources';
164
+		$_SESSION['next'] = 'Insert data in source table';
165
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
166
+		print json_encode($result);
167 167
 	}
168 168
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') {
169 169
 	if (!is_writable('tmp')) {
Please login to merge, or discard this patch.
require/class.Scheduler.php 1 patch
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 class Schedule {
10 10
 	protected $cookies = array();
11
-        public $db;
11
+		public $db;
12 12
 	public function __construct($dbc = null) {
13 13
 		$Connection = new Connection($dbc);
14 14
 		$this->db = $Connection->db();
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
 	}
17 17
 	
18 18
 	/**
19
-	* Add schedule data to database
20
-	* @param String $ident aircraft ident
21
-	* @param String $departure_airport_icao departure airport icao
22
-	* @param String $departure_airport_time departure airport time
23
-	* @param String $arrival_airport_icao arrival airport icao
24
-	* @param String $arrival_airport_time arrival airport time
19
+	 * Add schedule data to database
20
+	 * @param String $ident aircraft ident
21
+	 * @param String $departure_airport_icao departure airport icao
22
+	 * @param String $departure_airport_time departure airport time
23
+	 * @param String $arrival_airport_icao arrival airport icao
24
+	 * @param String $arrival_airport_time arrival airport time
25 25
 	/ @param String $source source of data
26
-	*/
26
+	 */
27 27
 	
28 28
 	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
29 29
 		date_default_timezone_set('UTC');
30 30
 		$date = date("Y-m-d H:i:s",time());
31
-	        //if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
32
-	        //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
33
-	        $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
34
-	        $query_values = array(':ident' => $ident);
31
+			//if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
32
+			//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
33
+			$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
34
+			$query_values = array(':ident' => $ident);
35 35
 		 try {
36 36
 			$sth = $this->db->prepare($query);
37 37
 			$sth->execute($query_values);
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 		if ($sth->fetchColumn() > 0) {
42 42
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
43
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
44
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
43
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
44
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
45 45
 			} elseif ($arrival_airport_time == '') {
46
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
47
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
46
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
47
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
48 48
 			} elseif ($departure_airport_time == '') {
49
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
50
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
49
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
50
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
51 51
 			} else {
52
-			    //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
53
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
54
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
52
+				//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
53
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
54
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
55 55
 			}
56 56
 			try {
57 57
 				$sth = $this->db->prepare($query);
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 			if ($sth->fetchColumn() == 0) {
63 63
 				//$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident';
64 64
 				if ($departure_airport_time == '' && $arrival_airport_time == '') {
65
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
66
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
65
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
66
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
67 67
 				} elseif ($arrival_airport_time == '') {
68
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
69
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
68
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
69
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
70 70
 				} elseif ($departure_airport_time == '') {
71
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
72
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
71
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
72
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
73 73
 				} else {
74
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
75
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
74
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
75
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
76 76
 				}
77 77
 				 try {
78 78
 					$sth = $this->db->prepare($query);
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 
107 107
 	public function getSchedule($ident) {
108
-	        $Translation = new Translation($this->db);
109
-	        $operator = $Translation->checkTranslation($ident,false);
110
-	        if ($ident != $operator) {
111
-	    		$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1";
112
-	    		$query_values = array(':ident' => $ident,'operator' => $operator);
113
-	    	} else {
114
-		        $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1";
115
-	    		$query_values = array(':ident' => $ident);
116
-	    	}
108
+			$Translation = new Translation($this->db);
109
+			$operator = $Translation->checkTranslation($ident,false);
110
+			if ($ident != $operator) {
111
+				$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1";
112
+				$query_values = array(':ident' => $ident,'operator' => $operator);
113
+			} else {
114
+				$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1";
115
+				$query_values = array(':ident' => $ident);
116
+			}
117 117
 		 try {
118 118
 			$sth = $this->db->prepare($query);
119 119
 			$sth->execute($query_values);
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 
130 130
 	public function checkSchedule($ident) {
131 131
 		global $globalDBdriver;
132
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
133
-	        if ($globalDBdriver == 'mysql') {
132
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
133
+			if ($globalDBdriver == 'mysql') {
134 134
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1";
135 135
 		} else {
136 136
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident 
137 137
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
138 138
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1";
139 139
 		}
140
-	        $query_values = array(':ident' => $ident);
140
+			$query_values = array(':ident' => $ident);
141 141
 		 try {
142 142
 			$sth = $this->db->prepare($query);
143 143
 			$sth->execute($query_values);
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	}
151 151
 
152 152
 	/**
153
-	* Get flight info from Air France
154
-	* @param String $callsign The callsign
155
-	* @param String $date date we want flight number info
156
-	* @param String $carrier IATA code
157
-	* @return Flight departure and arrival airports and time
158
-	*/
153
+	 * Get flight info from Air France
154
+	 * @param String $callsign The callsign
155
+	 * @param String $date date we want flight number info
156
+	 * @param String $carrier IATA code
157
+	 * @return Flight departure and arrival airports and time
158
+	 */
159 159
 	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
160 160
 		$Common = new Common();
161 161
 		$check_date = new Datetime($date);
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	}
192 192
 
193 193
 	/**
194
-	* Get flight info from EasyJet
195
-	* @param String $callsign The callsign
196
-	* @param String $date date we want flight number info
197
-	* @return Flight departure and arrival airports and time
198
-	*/
194
+	 * Get flight info from EasyJet
195
+	 * @param String $callsign The callsign
196
+	 * @param String $date date we want flight number info
197
+	 * @return Flight departure and arrival airports and time
198
+	 */
199 199
 	private function getEasyJet($callsign, $date = 'NOW') {
200 200
 		global $globalTimezone;
201 201
 		$Common = new Common();
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	}
220 220
 
221 221
 	/**
222
-	* Get flight info from Ryanair
223
-	* @param String $callsign The callsign
224
-	* @return Flight departure and arrival airports and time
225
-	*/
222
+	 * Get flight info from Ryanair
223
+	 * @param String $callsign The callsign
224
+	 * @return Flight departure and arrival airports and time
225
+	 */
226 226
 	private function getRyanair($callsign) {
227 227
 		$Common = new Common();
228 228
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	}
246 246
 
247 247
 	/**
248
-	* Get flight info from Swiss
249
-	* @param String $callsign The callsign
250
-	* @return Flight departure and arrival airports and time
251
-	*/
248
+	 * Get flight info from Swiss
249
+	 * @param String $callsign The callsign
250
+	 * @return Flight departure and arrival airports and time
251
+	 */
252 252
 	private function getSwiss($callsign) {
253 253
 		$Common = new Common();
254 254
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 	}
278 278
 	
279 279
 	/**
280
-	* Get flight info from British Airways API
281
-	* @param String $callsign The callsign
282
-	* @param String $date date we want flight number info
283
-	* @return Flight departure and arrival airports and time
284
-	*/
280
+	 * Get flight info from British Airways API
281
+	 * @param String $callsign The callsign
282
+	 * @param String $date date we want flight number info
283
+	 * @return Flight departure and arrival airports and time
284
+	 */
285 285
 	public function getBritishAirways($callsign, $date = 'NOW') {
286 286
 		global $globalBritishAirwaysKey;
287 287
 		$Common = new Common();
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 	}
306 306
 
307 307
 	/**
308
-	* Get flight info from Lutfhansa API
309
-	* @param String $callsign The callsign
310
-	* @param String $date date we want flight number info
311
-	* @return Flight departure and arrival airports and time
312
-	*/
308
+	 * Get flight info from Lutfhansa API
309
+	 * @param String $callsign The callsign
310
+	 * @param String $date date we want flight number info
311
+	 * @return Flight departure and arrival airports and time
312
+	 */
313 313
 	public function getLufthansa($callsign, $date = 'NOW') {
314 314
 		global $globalLufthansaKey;
315 315
 		$Common = new Common();
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	}
340 340
 
341 341
 	/**
342
-	* Get flight info from Transavia API
343
-	* @param String $callsign The callsign
344
-	* @param String $date date we want flight number info
345
-	* @return Flight departure and arrival airports and time
346
-	*/
342
+	 * Get flight info from Transavia API
343
+	 * @param String $callsign The callsign
344
+	 * @param String $date date we want flight number info
345
+	 * @return Flight departure and arrival airports and time
346
+	 */
347 347
 	public function getTransavia($callsign, $date = 'NOW') {
348 348
 		global $globalTransaviaKey;
349 349
 		$Common = new Common();
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
 	}
370 370
 
371 371
 	/**
372
-	* Get flight info from Tunisair
373
-	* @param String $callsign The callsign
374
-	* @return Flight departure and arrival airports and time
375
-	*/
372
+	 * Get flight info from Tunisair
373
+	 * @param String $callsign The callsign
374
+	 * @return Flight departure and arrival airports and time
375
+	 */
376 376
 	public function getTunisair($callsign) {
377 377
 		$Common = new Common();
378 378
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 	}
390 390
 
391 391
 	/**
392
-	* Get flight info from Vueling
393
-	* @param String $callsign The callsign
394
-	* @return Flight departure and arrival airports and time
395
-	*/
392
+	 * Get flight info from Vueling
393
+	 * @param String $callsign The callsign
394
+	 * @return Flight departure and arrival airports and time
395
+	 */
396 396
 	public function getVueling($callsign,$date = 'NOW') {
397 397
 		$Common = new Common();
398 398
 		$check_date = new Datetime($date);
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 	}
415 415
 
416 416
 	/**
417
-	* Get flight info from Iberia
418
-	* @param String $callsign The callsign
419
-	* @param String $date date we want flight number info
420
-	* @return Flight departure and arrival airports and time
421
-	*/
417
+	 * Get flight info from Iberia
418
+	 * @param String $callsign The callsign
419
+	 * @param String $date date we want flight number info
420
+	 * @return Flight departure and arrival airports and time
421
+	 */
422 422
 	public function getIberia($callsign, $date = 'NOW') {
423 423
 		$Common = new Common();
424 424
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 	}
449 449
 
450 450
 	/**
451
-	* Get flight info from Star Alliance
452
-	* @param String $callsign The callsign
453
-	* @param String $date date we want flight number info
454
-	* @return Flight departure and arrival airports and time
455
-	*/
451
+	 * Get flight info from Star Alliance
452
+	 * @param String $callsign The callsign
453
+	 * @param String $date date we want flight number info
454
+	 * @return Flight departure and arrival airports and time
455
+	 */
456 456
 
457 457
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
458 458
 		$Common = new Common();
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 
485 485
 
486 486
 	/**
487
-	* Get flight info from Alitalia
488
-	* @param String $callsign The callsign
489
-	* @param String $date date we want flight number info
490
-	* @return Flight departure and arrival airports and time
491
-	*/
487
+	 * Get flight info from Alitalia
488
+	 * @param String $callsign The callsign
489
+	 * @param String $date date we want flight number info
490
+	 * @return Flight departure and arrival airports and time
491
+	 */
492 492
 	private function getAlitalia($callsign, $date = 'NOW') {
493 493
 		$Common = new Common();
494 494
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 	}
508 508
 
509 509
 	/**
510
-	* Get flight info from Brussels airlines
511
-	* @param String $callsign The callsign
512
-	* @param String $date date we want flight number info
513
-	* @return Flight departure and arrival airports and time
514
-	*/
510
+	 * Get flight info from Brussels airlines
511
+	 * @param String $callsign The callsign
512
+	 * @param String $date date we want flight number info
513
+	 * @return Flight departure and arrival airports and time
514
+	 */
515 515
 	private function getBrussels($callsign, $date = 'NOW') {
516 516
 		$Common = new Common();
517 517
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -521,24 +521,24 @@  discard block
 block discarded – undo
521 521
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
522 522
 		$data = $Common->getData($url);
523 523
 		if ($data != '') {
524
-		    //echo $data;
525
-		    $parsed_json = json_decode($data,true);
526
-		    if (isset($parsed_json[0]['FromAirportCode'])) {
524
+			//echo $data;
525
+			$parsed_json = json_decode($data,true);
526
+			if (isset($parsed_json[0]['FromAirportCode'])) {
527 527
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
528 528
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
529 529
 			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
530 530
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
531 531
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
532
-		    }
532
+			}
533 533
 		}
534 534
 	}
535 535
 
536 536
 	/**
537
-	* Get flight info from FlightRadar24
538
-	* @param String $callsign The callsign
539
-	* @param String $date date we want flight number info
540
-	* @return Flight departure and arrival airports and time
541
-	*/
537
+	 * Get flight info from FlightRadar24
538
+	 * @param String $callsign The callsign
539
+	 * @param String $date date we want flight number info
540
+	 * @return Flight departure and arrival airports and time
541
+	 */
542 542
 /*
543 543
 	public function getFlightRadar24($callsign, $date = 'NOW') {
544 544
 		$Common = new Common();
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
 	}
568 568
   */
569 569
 	/**
570
-	* Get flight info from Lufthansa
571
-	* @param String $callsign The callsign
572
-	* @param String $date date we want flight number info
573
-	* @return Flight departure and arrival airports and time
574
-	*/
570
+	 * Get flight info from Lufthansa
571
+	 * @param String $callsign The callsign
572
+	 * @param String $date date we want flight number info
573
+	 * @return Flight departure and arrival airports and time
574
+	 */
575 575
 
576 576
 /*	private function getLufthansa($callsign, $date = 'NOW') {
577 577
 		$Common = new Common();
@@ -599,10 +599,10 @@  discard block
 block discarded – undo
599 599
 	}
600 600
   */
601 601
 	/**
602
-	* Get flight info from flytap
603
-	* @param String $callsign The callsign
604
-	* @return Flight departure and arrival airports and time
605
-	*/
602
+	 * Get flight info from flytap
603
+	 * @param String $callsign The callsign
604
+	 * @return Flight departure and arrival airports and time
605
+	 */
606 606
 	private function getFlyTap($callsign) {
607 607
 		$Common = new Common();
608 608
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -625,10 +625,10 @@  discard block
 block discarded – undo
625 625
 	}
626 626
 
627 627
 	/**
628
-	* Get flight info from flightmapper
629
-	* @param String $callsign The callsign
630
-	* @return Flight departure and arrival airports and time
631
-	*/
628
+	 * Get flight info from flightmapper
629
+	 * @param String $callsign The callsign
630
+	 * @return Flight departure and arrival airports and time
631
+	 */
632 632
 	public function getFlightMapper($callsign) {
633 633
 		$Common = new Common();
634 634
 		$airline_icao = '';
@@ -656,11 +656,11 @@  discard block
 block discarded – undo
656 656
 				$aarr = '';
657 657
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
658 658
 				if ($n == 7) {
659
-				    $departureTime = $dhour;
660
-				    $arrivalTime = $ahour;
661
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
662
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
663
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
659
+					$departureTime = $dhour;
660
+					$arrivalTime = $ahour;
661
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
662
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
663
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
664 664
 				}
665 665
 			}
666 666
 		}
@@ -668,10 +668,10 @@  discard block
 block discarded – undo
668 668
 	}
669 669
 
670 670
 	/**
671
-	* Get flight info from flightaware
672
-	* @param String $callsign The callsign
673
-	* @return Flight departure and arrival airports and time
674
-	*/
671
+	 * Get flight info from flightaware
672
+	 * @param String $callsign The callsign
673
+	 * @return Flight departure and arrival airports and time
674
+	 */
675 675
 	public function getFlightAware($callsign) {
676 676
 		$Common = new Common();
677 677
 		/*
@@ -704,10 +704,10 @@  discard block
 block discarded – undo
704 704
 	}
705 705
 
706 706
 	/**
707
-	* Get flight info from CostToTravel
708
-	* @param String $callsign The callsign
709
-	* @return Flight departure and arrival airports and time
710
-	*/
707
+	 * Get flight info from CostToTravel
708
+	 * @param String $callsign The callsign
709
+	 * @return Flight departure and arrival airports and time
710
+	 */
711 711
 	public function getCostToTravel($callsign) {
712 712
 		$Common = new Common();
713 713
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
 	}
730 730
 
731 731
 	/**
732
-	* Get flight info from Air Canada
733
-	* @param String $callsign The callsign
734
-	* @param String $date date we want flight number info
735
-	* @return Flight departure and arrival airports and time
736
-	*/
732
+	 * Get flight info from Air Canada
733
+	 * @param String $callsign The callsign
734
+	 * @param String $date date we want flight number info
735
+	 * @return Flight departure and arrival airports and time
736
+	 */
737 737
 	private function getAirCanada($callsign,$date = 'NOW') {
738 738
 		$Common = new Common();
739 739
 		if (class_exists("DomDocument") === FALSE) return array();
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	}
759 759
 
760 760
 	/**
761
-	* Get flight info from Vietnam Airlines
762
-	* @param String $callsign The callsign
763
-	* @param String $date date we want flight number info
764
-	* @return Flight departure and arrival airports and time
765
-	*/
761
+	 * Get flight info from Vietnam Airlines
762
+	 * @param String $callsign The callsign
763
+	 * @param String $date date we want flight number info
764
+	 * @return Flight departure and arrival airports and time
765
+	 */
766 766
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
767 767
 		$Common = new Common();
768 768
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -784,12 +784,12 @@  discard block
 block discarded – undo
784 784
 	}
785 785
 
786 786
 	/**
787
-	* Get flight info from Air Berlin
788
-	* @param String $callsign The callsign
789
-	* @param String $date date we want flight number info
790
-	* @param String $carrier airline code
791
-	* @return Flight departure and arrival airports and time
792
-	*/
787
+	 * Get flight info from Air Berlin
788
+	 * @param String $callsign The callsign
789
+	 * @param String $date date we want flight number info
790
+	 * @param String $carrier airline code
791
+	 * @return Flight departure and arrival airports and time
792
+	 */
793 793
 	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
794 794
 		$Common = new Common();
795 795
 		date_default_timezone_set('UTC');
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 			$table = $Common->table2array($data);
819 819
 			$flight = $table;
820 820
 			if (isset($flight[5][4])) {
821
-			    $arrivalTime = $flight[5][4];
822
-			    $arrivalAirport = $flight[5][3];
821
+				$arrivalTime = $flight[5][4];
822
+				$arrivalAirport = $flight[5][3];
823 823
 			} else {
824
-			    $arrivalTime = '';
825
-			    $arrivalAirport = '';
824
+				$arrivalTime = '';
825
+				$arrivalAirport = '';
826 826
 			}
827 827
 		} else return array();
828 828
 		$url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner';
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 					}
1091 1091
 			}
1092 1092
 		}
1093
-	        return array();
1093
+			return array();
1094 1094
 	}
1095 1095
 }
1096 1096
 
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Indentation   +201 added lines, -201 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();
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Gets all the spotter information based on the latest data entry
133
-	*
134
-	* @return Array the spotter information
135
-	*
136
-	*/
132
+	 * Gets all the spotter information based on the latest data entry
133
+	 *
134
+	 * @return Array the spotter information
135
+	 *
136
+	 */
137 137
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
138 138
 	{
139 139
 		global $globalDBdriver, $globalLiveInterval;
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 
178 178
 	/**
179
-	* Gets Minimal Live Spotter data
180
-	*
181
-	* @return Array the spotter information
182
-	*
183
-	*/
179
+	 * Gets Minimal Live Spotter data
180
+	 *
181
+	 * @return Array the spotter information
182
+	 *
183
+	 */
184 184
 	public function getMinLiveSpotterData($filter = array())
185 185
 	{
186 186
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	/**
220
-	* Gets Minimal Live Spotter data since xx seconds
221
-	*
222
-	* @return Array the spotter information
223
-	*
224
-	*/
220
+	 * Gets Minimal Live Spotter data since xx seconds
221
+	 *
222
+	 * @return Array the spotter information
223
+	 *
224
+	 */
225 225
 	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false)
226 226
 	{
227 227
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
 	}
303 303
 
304 304
 	/**
305
-	* Gets number of latest data entry
306
-	*
307
-	* @return String number of entry
308
-	*
309
-	*/
305
+	 * Gets number of latest data entry
306
+	 *
307
+	 * @return String number of entry
308
+	 *
309
+	 */
310 310
 	public function getLiveSpotterCount($filter = array())
311 311
 	{
312 312
 		global $globalDBdriver, $globalLiveInterval;
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 	/**
336
-	* Gets all the spotter information based on the latest data entry and coord
337
-	*
338
-	* @return Array the spotter information
339
-	*
340
-	*/
336
+	 * Gets all the spotter information based on the latest data entry and coord
337
+	 *
338
+	 * @return Array the spotter information
339
+	 *
340
+	 */
341 341
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
342 342
 	{
343 343
 		global $globalDBdriver, $globalLiveInterval;
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 	}
363 363
 
364 364
 	/**
365
-	* Gets all the spotter information based on the latest data entry and coord
366
-	*
367
-	* @return Array the spotter information
368
-	*
369
-	*/
365
+	 * Gets all the spotter information based on the latest data entry and coord
366
+	 *
367
+	 * @return Array the spotter information
368
+	 *
369
+	 */
370 370
 	public function getMinLiveSpotterDatabyCoord($coord, $filter = array())
371 371
 	{
372 372
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 	}
432 432
 
433 433
 	/**
434
-	* Gets all the spotter information based on a user's latitude and longitude
435
-	*
436
-	* @return Array the spotter information
437
-	*
438
-	*/
434
+	 * Gets all the spotter information based on a user's latitude and longitude
435
+	 *
436
+	 * @return Array the spotter information
437
+	 *
438
+	 */
439 439
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
440 440
 	{
441 441
 		$Spotter = new Spotter($this->db);
@@ -445,98 +445,98 @@  discard block
 block discarded – undo
445 445
 				return false;
446 446
 			}
447 447
 		}
448
-        if ($lng != '')
449
-                {
450
-                        if (!is_numeric($lng))
451
-                        {
452
-                                return false;
453
-                        }
454
-                }
455
-
456
-                if ($radius != '')
457
-                {
458
-                        if (!is_numeric($radius))
459
-                        {
460
-                                return false;
461
-                        }
462
-                }
448
+		if ($lng != '')
449
+				{
450
+						if (!is_numeric($lng))
451
+						{
452
+								return false;
453
+						}
454
+				}
455
+
456
+				if ($radius != '')
457
+				{
458
+						if (!is_numeric($radius))
459
+						{
460
+								return false;
461
+						}
462
+				}
463 463
 		$additional_query = '';
464
-        if ($interval != '')
465
-                {
466
-                        if (!is_string($interval))
467
-                        {
468
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
469
-			        return false;
470
-                        } else {
471
-                if ($interval == '1m')
472
-                {
473
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
474
-                } else if ($interval == '15m'){
475
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
476
-                } 
477
-            }
478
-                } else {
479
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
480
-        }
481
-
482
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
464
+		if ($interval != '')
465
+				{
466
+						if (!is_string($interval))
467
+						{
468
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
469
+					return false;
470
+						} else {
471
+				if ($interval == '1m')
472
+				{
473
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
474
+				} else if ($interval == '15m'){
475
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
476
+				} 
477
+			}
478
+				} else {
479
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
480
+		}
481
+
482
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
483 483
                    WHERE spotter_live.latitude <> '' 
484 484
                                    AND spotter_live.longitude <> '' 
485 485
                    ".$additional_query."
486 486
                    HAVING distance < :radius  
487 487
                                    ORDER BY distance";
488 488
 
489
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
489
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
490 490
 
491
-                return $spotter_array;
492
-        }
491
+				return $spotter_array;
492
+		}
493 493
 
494 494
     
495
-        /**
496
-	* Gets all the spotter information based on a particular callsign
497
-	*
498
-	* @return Array the spotter information
499
-	*
500
-	*/
495
+		/**
496
+		 * Gets all the spotter information based on a particular callsign
497
+		 *
498
+		 * @return Array the spotter information
499
+		 *
500
+		 */
501 501
 	public function getLastLiveSpotterDataByIdent($ident)
502 502
 	{
503 503
 		$Spotter = new Spotter($this->db);
504 504
 		date_default_timezone_set('UTC');
505 505
 
506 506
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
507
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
507
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
508 508
 
509 509
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
510 510
 
511 511
 		return $spotter_array;
512 512
 	}
513 513
 
514
-        /**
515
-	* Gets all the spotter information based on a particular callsign
516
-	*
517
-	* @return Array the spotter information
518
-	*
519
-	*/
514
+		/**
515
+		 * Gets all the spotter information based on a particular callsign
516
+		 *
517
+		 * @return Array the spotter information
518
+		 *
519
+		 */
520 520
 	public function getDateLiveSpotterDataByIdent($ident,$date)
521 521
 	{
522 522
 		$Spotter = new Spotter($this->db);
523 523
 		date_default_timezone_set('UTC');
524 524
 
525 525
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
526
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
526
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
527 527
 
528
-                $date = date('c',$date);
528
+				$date = date('c',$date);
529 529
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
530 530
 
531 531
 		return $spotter_array;
532 532
 	}
533 533
 
534
-        /**
535
-	* Gets last spotter information based on a particular callsign
536
-	*
537
-	* @return Array the spotter information
538
-	*
539
-	*/
534
+		/**
535
+		 * Gets last spotter information based on a particular callsign
536
+		 *
537
+		 * @return Array the spotter information
538
+		 *
539
+		 */
540 540
 	public function getLastLiveSpotterDataById($id)
541 541
 	{
542 542
 		$Spotter = new Spotter($this->db);
@@ -547,12 +547,12 @@  discard block
 block discarded – undo
547 547
 		return $spotter_array;
548 548
 	}
549 549
 
550
-        /**
551
-	* Gets last spotter information based on a particular callsign
552
-	*
553
-	* @return Array the spotter information
554
-	*
555
-	*/
550
+		/**
551
+		 * Gets last spotter information based on a particular callsign
552
+		 *
553
+		 * @return Array the spotter information
554
+		 *
555
+		 */
556 556
 	public function getDateLiveSpotterDataById($id,$date)
557 557
 	{
558 558
 		$Spotter = new Spotter($this->db);
@@ -565,21 +565,21 @@  discard block
 block discarded – undo
565 565
 		return $spotter_array;
566 566
 	}
567 567
 
568
-        /**
569
-	* Gets altitude information based on a particular callsign
570
-	*
571
-	* @return Array the spotter information
572
-	*
573
-	*/
568
+		/**
569
+		 * Gets altitude information based on a particular callsign
570
+		 *
571
+		 * @return Array the spotter information
572
+		 *
573
+		 */
574 574
 	public function getAltitudeLiveSpotterDataByIdent($ident)
575 575
 	{
576 576
 
577 577
 		date_default_timezone_set('UTC');
578 578
 
579 579
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
580
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
580
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
581 581
 
582
-    		try {
582
+			try {
583 583
 			
584 584
 			$sth = $this->db->prepare($query);
585 585
 			$sth->execute(array(':ident' => $ident));
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 		return $spotter_array;
593 593
 	}
594 594
 
595
-        /**
596
-	* Gets all the spotter information based on a particular id
597
-	*
598
-	* @return Array the spotter information
599
-	*
600
-	*/
595
+		/**
596
+		 * Gets all the spotter information based on a particular id
597
+		 *
598
+		 * @return Array the spotter information
599
+		 *
600
+		 */
601 601
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
602 602
 	{
603 603
 		global $globalDBdriver, $globalLiveInterval;
@@ -625,18 +625,18 @@  discard block
 block discarded – undo
625 625
 		return $spotter_array;
626 626
 	}
627 627
 
628
-        /**
629
-	* Gets all the spotter information based on a particular ident
630
-	*
631
-	* @return Array the spotter information
632
-	*
633
-	*/
628
+		/**
629
+		 * Gets all the spotter information based on a particular ident
630
+		 *
631
+		 * @return Array the spotter information
632
+		 *
633
+		 */
634 634
 	public function getAllLiveSpotterDataByIdent($ident)
635 635
 	{
636 636
 		date_default_timezone_set('UTC');
637 637
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
638 638
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
639
-    		try {
639
+			try {
640 640
 			
641 641
 			$sth = $this->db->prepare($query);
642 642
 			$sth->execute(array(':ident' => $ident));
@@ -650,23 +650,23 @@  discard block
 block discarded – undo
650 650
 
651 651
 
652 652
 	/**
653
-	* Deletes all info in the table
654
-	*
655
-	* @return String success or false
656
-	*
657
-	*/
653
+	 * Deletes all info in the table
654
+	 *
655
+	 * @return String success or false
656
+	 *
657
+	 */
658 658
 	public function deleteLiveSpotterData()
659 659
 	{
660 660
 		global $globalDBdriver;
661 661
 		if ($globalDBdriver == 'mysql') {
662 662
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
663 663
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
664
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
664
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
665 665
 		} else {
666 666
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
667 667
 		}
668 668
         
669
-    		try {
669
+			try {
670 670
 			
671 671
 			$sth = $this->db->prepare($query);
672 672
 			$sth->execute();
@@ -678,18 +678,18 @@  discard block
 block discarded – undo
678 678
 	}
679 679
 
680 680
 	/**
681
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
682
-	*
683
-	* @return String success or false
684
-	*
685
-	*/
681
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
682
+	 *
683
+	 * @return String success or false
684
+	 *
685
+	 */
686 686
 	public function deleteLiveSpotterDataNotUpdated()
687 687
 	{
688 688
 		global $globalDBdriver, $globalDebug;
689 689
 		if ($globalDBdriver == 'mysql') {
690 690
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
691
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
692
-    			try {
691
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
692
+				try {
693 693
 				
694 694
 				$sth = $this->db->prepare($query);
695 695
 				$sth->execute();
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
 				return "error";
698 698
 			}
699 699
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
700
-                        $i = 0;
701
-                        $j =0;
700
+						$i = 0;
701
+						$j =0;
702 702
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
703 703
 			foreach($all as $row)
704 704
 			{
@@ -706,20 +706,20 @@  discard block
 block discarded – undo
706 706
 				$j++;
707 707
 				if ($j == 30) {
708 708
 					if ($globalDebug) echo ".";
709
-				    	try {
709
+						try {
710 710
 						
711 711
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
712 712
 						$sth->execute();
713 713
 					} catch(PDOException $e) {
714 714
 						return "error";
715 715
 					}
716
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
717
-                                	$j = 0;
716
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
717
+									$j = 0;
718 718
 				}
719 719
 				$query_delete .= "'".$row['flightaware_id']."',";
720 720
 			}
721 721
 			if ($i > 0) {
722
-    				try {
722
+					try {
723 723
 					
724 724
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
725 725
 					$sth->execute();
@@ -730,9 +730,9 @@  discard block
 block discarded – undo
730 730
 			return "success";
731 731
 		} elseif ($globalDBdriver == 'pgsql') {
732 732
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
733
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
734
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
735
-    			try {
733
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
734
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
735
+				try {
736 736
 				
737 737
 				$sth = $this->db->prepare($query);
738 738
 				$sth->execute();
@@ -776,17 +776,17 @@  discard block
 block discarded – undo
776 776
 	}
777 777
 
778 778
 	/**
779
-	* Deletes all info in the table for an ident
780
-	*
781
-	* @return String success or false
782
-	*
783
-	*/
779
+	 * Deletes all info in the table for an ident
780
+	 *
781
+	 * @return String success or false
782
+	 *
783
+	 */
784 784
 	public function deleteLiveSpotterDataByIdent($ident)
785 785
 	{
786 786
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
787 787
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
788 788
         
789
-    		try {
789
+			try {
790 790
 			
791 791
 			$sth = $this->db->prepare($query);
792 792
 			$sth->execute(array(':ident' => $ident));
@@ -798,17 +798,17 @@  discard block
 block discarded – undo
798 798
 	}
799 799
 
800 800
 	/**
801
-	* Deletes all info in the table for an id
802
-	*
803
-	* @return String success or false
804
-	*
805
-	*/
801
+	 * Deletes all info in the table for an id
802
+	 *
803
+	 * @return String success or false
804
+	 *
805
+	 */
806 806
 	public function deleteLiveSpotterDataById($id)
807 807
 	{
808 808
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
809 809
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
810 810
         
811
-    		try {
811
+			try {
812 812
 			
813 813
 			$sth = $this->db->prepare($query);
814 814
 			$sth->execute(array(':id' => $id));
@@ -821,11 +821,11 @@  discard block
 block discarded – undo
821 821
 
822 822
 
823 823
 	/**
824
-	* Gets the aircraft ident within the last hour
825
-	*
826
-	* @return String the ident
827
-	*
828
-	*/
824
+	 * Gets the aircraft ident within the last hour
825
+	 *
826
+	 * @return String the ident
827
+	 *
828
+	 */
829 829
 	public function getIdentFromLastHour($ident)
830 830
 	{
831 831
 		global $globalDBdriver, $globalTimezone;
@@ -851,14 +851,14 @@  discard block
 block discarded – undo
851 851
 			$ident_result = $row['ident'];
852 852
 		}
853 853
 		return $ident_result;
854
-        }
854
+		}
855 855
 
856 856
 	/**
857
-	* Check recent aircraft
858
-	*
859
-	* @return String the ident
860
-	*
861
-	*/
857
+	 * Check recent aircraft
858
+	 *
859
+	 * @return String the ident
860
+	 *
861
+	 */
862 862
 	public function checkIdentRecent($ident)
863 863
 	{
864 864
 		global $globalDBdriver, $globalTimezone;
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
 			$ident_result = $row['flightaware_id'];
885 885
 		}
886 886
 		return $ident_result;
887
-        }
887
+		}
888 888
 
889 889
 	/**
890
-	* Check recent aircraft by id
891
-	*
892
-	* @return String the ident
893
-	*
894
-	*/
890
+	 * Check recent aircraft by id
891
+	 *
892
+	 * @return String the ident
893
+	 *
894
+	 */
895 895
 	public function checkIdRecent($id)
896 896
 	{
897 897
 		global $globalDBdriver, $globalTimezone;
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
 			$ident_result = $row['flightaware_id'];
918 918
 		}
919 919
 		return $ident_result;
920
-        }
920
+		}
921 921
 
922 922
 	/**
923
-	* Check recent aircraft by ModeS
924
-	*
925
-	* @return String the ModeS
926
-	*
927
-	*/
923
+	 * Check recent aircraft by ModeS
924
+	 *
925
+	 * @return String the ModeS
926
+	 *
927
+	 */
928 928
 	public function checkModeSRecent($modes)
929 929
 	{
930 930
 		global $globalDBdriver, $globalTimezone;
@@ -951,19 +951,19 @@  discard block
 block discarded – undo
951 951
 			$ident_result = $row['flightaware_id'];
952 952
 		}
953 953
 		return $ident_result;
954
-        }
954
+		}
955 955
 
956 956
 	/**
957
-	* Adds a new spotter data
958
-	*
959
-	* @param String $flightaware_id the ID from flightaware
960
-	* @param String $ident the flight ident
961
-	* @param String $aircraft_icao the aircraft type
962
-	* @param String $departure_airport_icao the departure airport
963
-	* @param String $arrival_airport_icao the arrival airport
964
-	* @return String success or false
965
-	*
966
-	*/
957
+	 * Adds a new spotter data
958
+	 *
959
+	 * @param String $flightaware_id the ID from flightaware
960
+	 * @param String $ident the flight ident
961
+	 * @param String $aircraft_icao the aircraft type
962
+	 * @param String $departure_airport_icao the departure airport
963
+	 * @param String $arrival_airport_icao the arrival airport
964
+	 * @return String success or false
965
+	 *
966
+	 */
967 967
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
968 968
 	{
969 969
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1106,10 +1106,10 @@  discard block
 block discarded – undo
1106 1106
 		$arrival_airport_country = '';
1107 1107
 		
1108 1108
             	
1109
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1110
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1111
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1112
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1109
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1110
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1111
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1112
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1113 1113
 		
1114 1114
 		$query = '';
1115 1115
 		if ($globalArchive) {
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 			return "error : ".$e->getMessage();
1131 1131
 		}
1132 1132
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1133
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1134
-		    $SpotterArchive = new SpotterArchive($this->db);
1135
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1136
-		    if ($globalDebug) echo $result.')';
1133
+			if ($globalDebug) echo '(Add to SBS archive : ';
1134
+			$SpotterArchive = new SpotterArchive($this->db);
1135
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1136
+			if ($globalDebug) echo $result.')';
1137 1137
 		} elseif ($globalDebug && $putinarchive !== true) {
1138 1138
 			echo '(Not adding to archive)';
1139 1139
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,21 +209,21 @@  discard block
 block discarded – undo
209 209
 			var entityid = entity.id;
210 210
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
211 211
 			<?php 
212
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
212
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
213 213
 			?>
214 214
 			if (lastupdateentity != lastupdate) {
215 215
 				viewer.dataSources.get(dsn).entities.remove(entity);
216 216
 				czmlds.entities.removeById(entityid);
217 217
 			}
218 218
 			<?php
219
-			    } else {
219
+				} else {
220 220
 			?>
221 221
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
222 222
 				viewer.dataSources.get(dsn).entities.remove(entity);
223 223
 				czmlds.entities.removeById(entityid);
224 224
 			}
225 225
 			<?php
226
-			    }
226
+				}
227 227
 			?>
228 228
 		}
229 229
 	}
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
 	update_airportsLayer();
630 630
 }
631 631
 <?php
632
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
632
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
633 633
 ?>
634 634
 update_atcLayer();
635 635
 setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
636 636
 <?php
637
-    }
637
+	}
638 638
 ?>
639 639
 
640 640
 function iconColor(color) {
Please login to merge, or discard this patch.
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.