Completed
Push — master ( 35ee00...39c0a3 )
by Yannick
28:16
created
require/class.Tracker.php 4 patches
Doc Comments   +3 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	/**
17 17
 	* Get SQL query part for filter used
18 18
 	* @param Array $filter the filter
19
-	* @return Array the SQL part
19
+	* @return string the SQL part
20 20
 	*/
21 21
 	
22 22
 	public function getFilter($filter = array(),$where = false,$and = false) {
@@ -487,9 +487,6 @@  discard block
 block discarded – undo
487 487
 	/**
488 488
 	* Update ident tracker data
489 489
 	*
490
-	* @param String $flightaware_id the ID from flightaware
491
-	* @param String $ident the flight ident
492
-	* @return String success or false
493 490
 	*
494 491
 	*/	
495 492
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
@@ -511,10 +508,6 @@  discard block
 block discarded – undo
511 508
 	/**
512 509
 	* Update latest tracker data
513 510
 	*
514
-	* @param String $flightaware_id the ID from flightaware
515
-	* @param String $ident the flight ident
516
-	* @param String $arrival_airport_icao the arrival airport
517
-	* @return String success or false
518 511
 	*
519 512
 	*/	
520 513
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
@@ -536,29 +529,6 @@  discard block
 block discarded – undo
536 529
 	/**
537 530
 	* Adds a new tracker data
538 531
 	*
539
-	* @param String $flightaware_id the ID from flightaware
540
-	* @param String $ident the flight ident
541
-	* @param String $aircraft_icao the aircraft type
542
-	* @param String $departure_airport_icao the departure airport
543
-	* @param String $arrival_airport_icao the arrival airport
544
-	* @param String $latitude latitude of flight
545
-	* @param String $longitude latitude of flight
546
-	* @param String $waypoints waypoints of flight
547
-	* @param String $altitude altitude of flight
548
-	* @param String $heading heading of flight
549
-	* @param String $groundspeed speed of flight
550
-	* @param String $date date of flight
551
-	* @param String $departure_airport_time departure time of flight
552
-	* @param String $arrival_airport_time arrival time of flight
553
-	* @param String $squawk squawk code of flight
554
-	* @param String $route_stop route stop of flight
555
-	* @param String $highlight highlight or not
556
-	* @param String $ModeS ModesS code of flight
557
-	* @param String $registration registration code of flight
558
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
559
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
560
-	* @param String $verticalrate vertival rate of flight
561
-	* @return String success or false
562 532
 	*/
563 533
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
564 534
 	{
@@ -1132,6 +1102,7 @@  discard block
 block discarded – undo
1132 1102
 	/**
1133 1103
 	* Counts all hours
1134 1104
 	*
1105
+	* @param string $orderby
1135 1106
 	* @return Array the hour list
1136 1107
 	*
1137 1108
 	*/
@@ -1483,7 +1454,7 @@  discard block
 block discarded – undo
1483 1454
 	/**
1484 1455
 	* Parses the direction degrees to working
1485 1456
 	*
1486
-	* @param Float $direction the direction in degrees
1457
+	* @param integer $direction the direction in degrees
1487 1458
 	* @return Array the direction information
1488 1459
 	*
1489 1460
 	*/
Please login to merge, or discard this patch.
Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
 	}
15 15
 
16 16
 	/**
17
-	* Get SQL query part for filter used
18
-	* @param Array $filter the filter
19
-	* @return Array the SQL part
20
-	*/
17
+	 * Get SQL query part for filter used
18
+	 * @param Array $filter the filter
19
+	 * @return Array the SQL part
20
+	 */
21 21
 	
22 22
 	public function getFilter($filter = array(),$where = false,$and = false) {
23 23
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 	}
82 82
 
83 83
 	/**
84
-	* Executes the SQL statements to get the tracker information
85
-	*
86
-	* @param String $query the SQL query
87
-	* @param Array $params parameter of the query
88
-	* @param String $limitQuery the limit query
89
-	* @return Array the tracker information
90
-	*
91
-	*/
84
+	 * Executes the SQL statements to get the tracker information
85
+	 *
86
+	 * @param String $query the SQL query
87
+	 * @param Array $params parameter of the query
88
+	 * @param String $limitQuery the limit query
89
+	 * @return Array the tracker information
90
+	 *
91
+	 */
92 92
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
93 93
 	{
94 94
 		date_default_timezone_set('UTC');
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 	
202 202
 	
203 203
 	/**
204
-	* Gets all the tracker information based on the latest data entry
205
-	*
206
-	* @return Array the tracker information
207
-	*
208
-	*/
204
+	 * Gets all the tracker information based on the latest data entry
205
+	 *
206
+	 * @return Array the tracker information
207
+	 *
208
+	 */
209 209
 	public function getLatestTrackerData($limit = '', $sort = '', $filter = array())
210 210
 	{
211 211
 		global $global_query;
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 	}
264 264
 
265 265
 	/**
266
-	* Gets all the tracker information based on the callsign
267
-	*
268
-	* @return Array the tracker information
269
-	*
270
-	*/
266
+	 * Gets all the tracker information based on the callsign
267
+	 *
268
+	 * @return Array the tracker information
269
+	 *
270
+	 */
271 271
 	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
272 272
 	{
273 273
 		global $global_query;
@@ -378,12 +378,12 @@  discard block
 block discarded – undo
378 378
 
379 379
 
380 380
 	/**
381
-	* Gets all source name
382
-	*
383
-	* @param String type format of source
384
-	* @return Array list of source name
385
-	*
386
-	*/
381
+	 * Gets all source name
382
+	 *
383
+	 * @param String type format of source
384
+	 * @return Array list of source name
385
+	 *
386
+	 */
387 387
 	public function getAllSourceName($type = '',$filters = array())
388 388
 	{
389 389
 		$filter_query = $this->getFilter($filters,true,true);
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 
414 414
 
415 415
 	/**
416
-	* Gets a list of all idents/callsigns
417
-	*
418
-	* @return Array list of ident/callsign names
419
-	*
420
-	*/
416
+	 * Gets a list of all idents/callsigns
417
+	 *
418
+	 * @return Array list of ident/callsign names
419
+	 *
420
+	 */
421 421
 	public function getAllIdents($filters = array())
422 422
 	{
423 423
 		$filter_query = $this->getFilter($filters,true,true);
@@ -485,18 +485,18 @@  discard block
 block discarded – undo
485 485
 	
486 486
 	
487 487
 	/**
488
-	* Update ident tracker data
489
-	*
490
-	* @param String $flightaware_id the ID from flightaware
491
-	* @param String $ident the flight ident
492
-	* @return String success or false
493
-	*
494
-	*/	
488
+	 * Update ident tracker data
489
+	 *
490
+	 * @param String $flightaware_id the ID from flightaware
491
+	 * @param String $ident the flight ident
492
+	 * @return String success or false
493
+	 *
494
+	 */	
495 495
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
496 496
 	{
497 497
 
498 498
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
499
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
500 500
 
501 501
 		try {
502 502
 			$sth = $this->db->prepare($query);
@@ -509,18 +509,18 @@  discard block
 block discarded – undo
509 509
 
510 510
 	}
511 511
 	/**
512
-	* Update latest tracker data
513
-	*
514
-	* @param String $flightaware_id the ID from flightaware
515
-	* @param String $ident the flight ident
516
-	* @param String $arrival_airport_icao the arrival airport
517
-	* @return String success or false
518
-	*
519
-	*/	
512
+	 * Update latest tracker data
513
+	 *
514
+	 * @param String $flightaware_id the ID from flightaware
515
+	 * @param String $ident the flight ident
516
+	 * @param String $arrival_airport_icao the arrival airport
517
+	 * @return String success or false
518
+	 *
519
+	 */	
520 520
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
521 521
 	{
522 522
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
523
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523
+				$query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
524 524
 
525 525
 		try {
526 526
 			$sth = $this->db->prepare($query);
@@ -534,32 +534,32 @@  discard block
 block discarded – undo
534 534
 	}
535 535
 
536 536
 	/**
537
-	* Adds a new tracker data
538
-	*
539
-	* @param String $flightaware_id the ID from flightaware
540
-	* @param String $ident the flight ident
541
-	* @param String $aircraft_icao the aircraft type
542
-	* @param String $departure_airport_icao the departure airport
543
-	* @param String $arrival_airport_icao the arrival airport
544
-	* @param String $latitude latitude of flight
545
-	* @param String $longitude latitude of flight
546
-	* @param String $waypoints waypoints of flight
547
-	* @param String $altitude altitude of flight
548
-	* @param String $heading heading of flight
549
-	* @param String $groundspeed speed of flight
550
-	* @param String $date date of flight
551
-	* @param String $departure_airport_time departure time of flight
552
-	* @param String $arrival_airport_time arrival time of flight
553
-	* @param String $squawk squawk code of flight
554
-	* @param String $route_stop route stop of flight
555
-	* @param String $highlight highlight or not
556
-	* @param String $ModeS ModesS code of flight
557
-	* @param String $registration registration code of flight
558
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
559
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
560
-	* @param String $verticalrate vertival rate of flight
561
-	* @return String success or false
562
-	*/
537
+	 * Adds a new tracker data
538
+	 *
539
+	 * @param String $flightaware_id the ID from flightaware
540
+	 * @param String $ident the flight ident
541
+	 * @param String $aircraft_icao the aircraft type
542
+	 * @param String $departure_airport_icao the departure airport
543
+	 * @param String $arrival_airport_icao the arrival airport
544
+	 * @param String $latitude latitude of flight
545
+	 * @param String $longitude latitude of flight
546
+	 * @param String $waypoints waypoints of flight
547
+	 * @param String $altitude altitude of flight
548
+	 * @param String $heading heading of flight
549
+	 * @param String $groundspeed speed of flight
550
+	 * @param String $date date of flight
551
+	 * @param String $departure_airport_time departure time of flight
552
+	 * @param String $arrival_airport_time arrival time of flight
553
+	 * @param String $squawk squawk code of flight
554
+	 * @param String $route_stop route stop of flight
555
+	 * @param String $highlight highlight or not
556
+	 * @param String $ModeS ModesS code of flight
557
+	 * @param String $registration registration code of flight
558
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
559
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
560
+	 * @param String $verticalrate vertival rate of flight
561
+	 * @return String success or false
562
+	 */
563 563
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
564 564
 	{
565 565
 		global $globalURL;
@@ -644,16 +644,16 @@  discard block
 block discarded – undo
644 644
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
645 645
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
646 646
 	
647
-                if ($latitude == '' && $longitude == '') {
648
-            		$latitude = 0;
649
-            		$longitude = 0;
650
-            	}
651
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
653
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
647
+				if ($latitude == '' && $longitude == '') {
648
+					$latitude = 0;
649
+					$longitude = 0;
650
+				}
651
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
653
+				$query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
654 654
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
655 655
 
656
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
657 657
 
658 658
 		try {
659 659
 		        
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 			$sth->execute($query_values);
662 662
 			$this->db = null;
663 663
 		} catch (PDOException $e) {
664
-		    return "error : ".$e->getMessage();
664
+			return "error : ".$e->getMessage();
665 665
 		}
666 666
 		
667 667
 		return "success";
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
 	
671 671
   
672 672
 	/**
673
-	* Gets the aircraft ident within the last hour
674
-	*
675
-	* @return String the ident
676
-	*
677
-	*/
673
+	 * Gets the aircraft ident within the last hour
674
+	 *
675
+	 * @return String the ident
676
+	 *
677
+	 */
678 678
 	public function getIdentFromLastHour($ident)
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
@@ -690,11 +690,11 @@  discard block
 block discarded – undo
690 690
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
691 691
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
692 692
 			$query_data = array(':ident' => $ident);
693
-    		}
693
+			}
694 694
 		
695 695
 		$sth = $this->db->prepare($query);
696 696
 		$sth->execute($query_data);
697
-    		$ident_result='';
697
+			$ident_result='';
698 698
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
699 699
 		{
700 700
 			$ident_result = $row['ident'];
@@ -705,11 +705,11 @@  discard block
 block discarded – undo
705 705
 	
706 706
 	
707 707
 	/**
708
-	* Gets the aircraft data from the last 20 seconds
709
-	*
710
-	* @return Array the tracker data
711
-	*
712
-	*/
708
+	 * Gets the aircraft data from the last 20 seconds
709
+	 *
710
+	 * @return Array the tracker data
711
+	 *
712
+	 */
713 713
 	public function getRealTimeData($q = '')
714 714
 	{
715 715
 		global $globalDBdriver;
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
 	}
744 744
 
745 745
 	/**
746
-	* Gets all number of flight over countries
747
-	*
748
-	* @return Array the airline country list
749
-	*
750
-	*/
746
+	 * Gets all number of flight over countries
747
+	 *
748
+	 * @return Array the airline country list
749
+	 *
750
+	 */
751 751
 	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
752 752
 	{
753 753
 		global $globalDBdriver, $globalArchive;
@@ -817,11 +817,11 @@  discard block
 block discarded – undo
817 817
 	}
818 818
 	
819 819
 	/**
820
-	* Gets all callsigns that have flown over
821
-	*
822
-	* @return Array the callsign list
823
-	*
824
-	*/
820
+	 * Gets all callsigns that have flown over
821
+	 *
822
+	 * @return Array the callsign list
823
+	 *
824
+	 */
825 825
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
826 826
 	{
827 827
 		global $globalDBdriver;
@@ -888,11 +888,11 @@  discard block
 block discarded – undo
888 888
 
889 889
 
890 890
 	/**
891
-	* Counts all dates
892
-	*
893
-	* @return Array the date list
894
-	*
895
-	*/
891
+	 * Counts all dates
892
+	 *
893
+	 * @return Array the date list
894
+	 *
895
+	 */
896 896
 	public function countAllDates($filters = array())
897 897
 	{
898 898
 		global $globalTimezone, $globalDBdriver;
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
 	
939 939
 	
940 940
 	/**
941
-	* Counts all dates during the last 7 days
942
-	*
943
-	* @return Array the date list
944
-	*
945
-	*/
941
+	 * Counts all dates during the last 7 days
942
+	 *
943
+	 * @return Array the date list
944
+	 *
945
+	 */
946 946
 	public function countAllDatesLast7Days($filters = array())
947 947
 	{
948 948
 		global $globalTimezone, $globalDBdriver;
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 			$query .= " GROUP BY date_name 
965 965
 								ORDER BY date_name ASC";
966 966
 			$query_data = array(':offset' => $offset);
967
-    		}
967
+			}
968 968
 		
969 969
 		$sth = $this->db->prepare($query);
970 970
 		$sth->execute($query_data);
@@ -984,11 +984,11 @@  discard block
 block discarded – undo
984 984
 	}
985 985
 
986 986
 	/**
987
-	* Counts all dates during the last month
988
-	*
989
-	* @return Array the date list
990
-	*
991
-	*/
987
+	 * Counts all dates during the last month
988
+	 *
989
+	 * @return Array the date list
990
+	 *
991
+	 */
992 992
 	public function countAllDatesLastMonth($filters = array())
993 993
 	{
994 994
 		global $globalTimezone, $globalDBdriver;
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 			$query .= " GROUP BY date_name 
1011 1011
 								ORDER BY date_name ASC";
1012 1012
 			$query_data = array(':offset' => $offset);
1013
-    		}
1013
+			}
1014 1014
 		
1015 1015
 		$sth = $this->db->prepare($query);
1016 1016
 		$sth->execute($query_data);
@@ -1032,11 +1032,11 @@  discard block
 block discarded – undo
1032 1032
 
1033 1033
 
1034 1034
 	/**
1035
-	* Counts all month
1036
-	*
1037
-	* @return Array the month list
1038
-	*
1039
-	*/
1035
+	 * Counts all month
1036
+	 *
1037
+	 * @return Array the month list
1038
+	 *
1039
+	 */
1040 1040
 	public function countAllMonths($filters = array())
1041 1041
 	{
1042 1042
 		global $globalTimezone, $globalDBdriver;
@@ -1081,11 +1081,11 @@  discard block
 block discarded – undo
1081 1081
 	
1082 1082
 
1083 1083
 	/**
1084
-	* Counts all dates during the last year
1085
-	*
1086
-	* @return Array the date list
1087
-	*
1088
-	*/
1084
+	 * Counts all dates during the last year
1085
+	 *
1086
+	 * @return Array the date list
1087
+	 *
1088
+	 */
1089 1089
 	public function countAllMonthsLastYear($filters)
1090 1090
 	{
1091 1091
 		global $globalTimezone, $globalDBdriver;
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 			$query .= " GROUP BY year_name, month_name
1108 1108
 								ORDER BY year_name, month_name ASC";
1109 1109
 			$query_data = array(':offset' => $offset);
1110
-    		}
1110
+			}
1111 1111
 		
1112 1112
 		$sth = $this->db->prepare($query);
1113 1113
 		$sth->execute($query_data);
@@ -1130,11 +1130,11 @@  discard block
 block discarded – undo
1130 1130
 	
1131 1131
 	
1132 1132
 	/**
1133
-	* Counts all hours
1134
-	*
1135
-	* @return Array the hour list
1136
-	*
1137
-	*/
1133
+	 * Counts all hours
1134
+	 *
1135
+	 * @return Array the hour list
1136
+	 *
1137
+	 */
1138 1138
 	public function countAllHours($orderby,$filters = array())
1139 1139
 	{
1140 1140
 		global $globalTimezone, $globalDBdriver;
@@ -1197,11 +1197,11 @@  discard block
 block discarded – undo
1197 1197
 	
1198 1198
 	
1199 1199
 	/**
1200
-	* Counts all hours by date
1201
-	*
1202
-	* @return Array the hour list
1203
-	*
1204
-	*/
1200
+	 * Counts all hours by date
1201
+	 *
1202
+	 * @return Array the hour list
1203
+	 *
1204
+	 */
1205 1205
 	public function countAllHoursByDate($date, $filters = array())
1206 1206
 	{
1207 1207
 		global $globalTimezone, $globalDBdriver;
@@ -1245,11 +1245,11 @@  discard block
 block discarded – undo
1245 1245
 	
1246 1246
 	
1247 1247
 	/**
1248
-	* Counts all hours by a ident/callsign
1249
-	*
1250
-	* @return Array the hour list
1251
-	*
1252
-	*/
1248
+	 * Counts all hours by a ident/callsign
1249
+	 *
1250
+	 * @return Array the hour list
1251
+	 *
1252
+	 */
1253 1253
 	public function countAllHoursByIdent($ident, $filters = array())
1254 1254
 	{
1255 1255
 		global $globalTimezone, $globalDBdriver;
@@ -1294,11 +1294,11 @@  discard block
 block discarded – undo
1294 1294
 	
1295 1295
 	
1296 1296
 	/**
1297
-	* Counts all trackers that have flown over
1298
-	*
1299
-	* @return Integer the number of trackers
1300
-	*
1301
-	*/
1297
+	 * Counts all trackers that have flown over
1298
+	 *
1299
+	 * @return Integer the number of trackers
1300
+	 *
1301
+	 */
1302 1302
 	public function countOverallTracker($filters = array(),$year = '',$month = '')
1303 1303
 	{
1304 1304
 		global $globalDBdriver;
@@ -1333,11 +1333,11 @@  discard block
 block discarded – undo
1333 1333
 	}
1334 1334
 	
1335 1335
 	/**
1336
-	* Counts all trackers type that have flown over
1337
-	*
1338
-	* @return Integer the number of flights
1339
-	*
1340
-	*/
1336
+	 * Counts all trackers type that have flown over
1337
+	 *
1338
+	 * @return Integer the number of flights
1339
+	 *
1340
+	 */
1341 1341
 	public function countOverallTrackerTypes($filters = array(),$year = '',$month = '')
1342 1342
 	{
1343 1343
 		global $globalDBdriver;
@@ -1372,11 +1372,11 @@  discard block
 block discarded – undo
1372 1372
 	
1373 1373
   
1374 1374
 	/**
1375
-	* Counts all hours of today
1376
-	*
1377
-	* @return Array the hour list
1378
-	*
1379
-	*/
1375
+	 * Counts all hours of today
1376
+	 *
1377
+	 * @return Array the hour list
1378
+	 *
1379
+	 */
1380 1380
 	public function countAllHoursFromToday($filters = array())
1381 1381
 	{
1382 1382
 		global $globalTimezone, $globalDBdriver;
@@ -1416,12 +1416,12 @@  discard block
 block discarded – undo
1416 1416
 	}
1417 1417
     
1418 1418
     
1419
-     /**
1420
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1421
-	*
1422
-	* @return Integer the Barrie Spotter ID
1419
+	 /**
1420
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1421
+	  *
1422
+	  * @return Integer the Barrie Spotter ID
1423 1423
 q	*
1424
-	*/
1424
+	  */
1425 1425
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1426 1426
 	{
1427 1427
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1442,13 +1442,13 @@  discard block
 block discarded – undo
1442 1442
   
1443 1443
  
1444 1444
 	/**
1445
-	* Parses a date string
1446
-	*
1447
-	* @param String $dateString the date string
1448
-	* @param String $timezone the timezone of a user
1449
-	* @return Array the time information
1450
-	*
1451
-	*/
1445
+	 * Parses a date string
1446
+	 *
1447
+	 * @param String $dateString the date string
1448
+	 * @param String $timezone the timezone of a user
1449
+	 * @return Array the time information
1450
+	 *
1451
+	 */
1452 1452
 	public function parseDateString($dateString, $timezone = '')
1453 1453
 	{
1454 1454
 		$time_array = array();
@@ -1481,12 +1481,12 @@  discard block
 block discarded – undo
1481 1481
 	}
1482 1482
 	
1483 1483
 	/**
1484
-	* Parses the direction degrees to working
1485
-	*
1486
-	* @param Float $direction the direction in degrees
1487
-	* @return Array the direction information
1488
-	*
1489
-	*/
1484
+	 * Parses the direction degrees to working
1485
+	 *
1486
+	 * @param Float $direction the direction in degrees
1487
+	 * @return Array the direction information
1488
+	 *
1489
+	 */
1490 1490
 	public function parseDirection($direction = 0)
1491 1491
 	{
1492 1492
 		if ($direction == '') $direction = 0;
@@ -1565,12 +1565,12 @@  discard block
 block discarded – undo
1565 1565
 	
1566 1566
 	
1567 1567
 	/**
1568
-	* Gets Country from latitude/longitude
1569
-	*
1570
-	* @param Float $latitude latitute of the flight
1571
-	* @param Float $longitude longitute of the flight
1572
-	* @return String the countrie
1573
-	*/
1568
+	 * Gets Country from latitude/longitude
1569
+	 *
1570
+	 * @param Float $latitude latitute of the flight
1571
+	 * @param Float $longitude longitute of the flight
1572
+	 * @return String the countrie
1573
+	 */
1574 1574
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1575 1575
 	{
1576 1576
 		global $globalDBdriver, $globalDebug;
@@ -1607,11 +1607,11 @@  discard block
 block discarded – undo
1607 1607
 	}
1608 1608
 
1609 1609
 	/**
1610
-	* Gets Country from iso2
1611
-	*
1612
-	* @param String $iso2 ISO2 country code
1613
-	* @return String the countrie
1614
-	*/
1610
+	 * Gets Country from iso2
1611
+	 *
1612
+	 * @param String $iso2 ISO2 country code
1613
+	 * @return String the countrie
1614
+	 */
1615 1615
 	public function getCountryFromISO2($iso2)
1616 1616
 	{
1617 1617
 		global $globalDBdriver, $globalDebug;
@@ -1639,11 +1639,11 @@  discard block
 block discarded – undo
1639 1639
 	}
1640 1640
 
1641 1641
 	/**
1642
-	* Gets all vessels types that have flown over
1643
-	*
1644
-	* @return Array the vessel type list
1645
-	*
1646
-	*/
1642
+	 * Gets all vessels types that have flown over
1643
+	 *
1644
+	 * @return Array the vessel type list
1645
+	 *
1646
+	 */
1647 1647
 	public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1648 1648
 	{
1649 1649
 		global $globalDBdriver;
@@ -1708,11 +1708,11 @@  discard block
 block discarded – undo
1708 1708
 	}
1709 1709
 
1710 1710
 	/**
1711
-	* Gets all the tracker information
1712
-	*
1713
-	* @return Array the tracker information
1714
-	*
1715
-	*/
1711
+	 * Gets all the tracker information
1712
+	 *
1713
+	 * @return Array the tracker information
1714
+	 *
1715
+	 */
1716 1716
 	public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1717 1717
 	{
1718 1718
 		global $globalTimezone, $globalDBdriver;
@@ -1817,12 +1817,12 @@  discard block
 block discarded – undo
1817 1817
 	}
1818 1818
 
1819 1819
 	/**
1820
-	* Gets the short url from bit.ly
1821
-	*
1822
-	* @param String $url the full url
1823
-	* @return String the bit.ly url
1824
-	*
1825
-	*/
1820
+	 * Gets the short url from bit.ly
1821
+	 *
1822
+	 * @param String $url the full url
1823
+	 * @return String the bit.ly url
1824
+	 *
1825
+	 */
1826 1826
 	public function getBitlyURL($url)
1827 1827
 	{
1828 1828
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
Braces   +172 added lines, -61 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 	public function __construct($dbc = null) {
11 11
 		$Connection = new Connection($dbc);
12 12
 		$this->db = $Connection->db();
13
-		if ($this->db === null) die('Error: No DB connection. (Tracker)');
13
+		if ($this->db === null) {
14
+			die('Error: No DB connection. (Tracker)');
15
+		}
14 16
 	}
15 17
 
16 18
 	/**
@@ -32,7 +34,9 @@  discard block
 block discarded – undo
32 34
 		if (isset($filter[0]['source'])) {
33 35
 			$filters = array_merge($filters,$filter);
34 36
 		}
35
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
37
+		if (is_array($globalFilter)) {
38
+			$filter = array_merge($filter,$globalFilter);
39
+		}
36 40
 		$filter_query_join = '';
37 41
 		$filter_query_where = '';
38 42
 		foreach($filters as $flt) {
@@ -71,8 +75,11 @@  discard block
 block discarded – undo
71 75
 				$filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
72 76
 			}
73 77
 		}
74
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
78
+		if ($filter_query_where == '' && $where) {
79
+			$filter_query_where = ' WHERE';
80
+		} elseif ($filter_query_where != '' && $and) {
81
+			$filter_query_where .= ' AND';
82
+		}
76 83
 		if ($filter_query_where != '') {
77 84
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
78 85
 		}
@@ -126,26 +133,43 @@  discard block
 block discarded – undo
126 133
 				$temp_array['tracker_id'] = $row['tracker_archive_id'];
127 134
 			} elseif (isset($row['tracker_archive_output_id'])) {
128 135
 				$temp_array['tracker_id'] = $row['tracker_archive_output_id'];
129
-			*/} 
130
-			elseif (isset($row['trackerid'])) {
136
+			*/} elseif (isset($row['trackerid'])) {
131 137
 				$temp_array['trackerid'] = $row['trackerid'];
132 138
 			} else {
133 139
 				$temp_array['trackerid'] = '';
134 140
 			}
135
-			if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid'];
136
-			if (isset($row['type'])) $temp_array['type'] = $row['type'];
137
-			if (isset($row['comment'])) $temp_array['comment'] = $row['comment'];
141
+			if (isset($row['famtrackid'])) {
142
+				$temp_array['famtrackid'] = $row['famtrackid'];
143
+			}
144
+			if (isset($row['type'])) {
145
+				$temp_array['type'] = $row['type'];
146
+			}
147
+			if (isset($row['comment'])) {
148
+				$temp_array['comment'] = $row['comment'];
149
+			}
138 150
 			$temp_array['ident'] = $row['ident'];
139
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
140
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
141
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
142
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
151
+			if (isset($row['latitude'])) {
152
+				$temp_array['latitude'] = $row['latitude'];
153
+			}
154
+			if (isset($row['longitude'])) {
155
+				$temp_array['longitude'] = $row['longitude'];
156
+			}
157
+			if (isset($row['format_source'])) {
158
+				$temp_array['format_source'] = $row['format_source'];
159
+			}
160
+			if (isset($row['altitude'])) {
161
+				$temp_array['altitude'] = $row['altitude'];
162
+			}
143 163
 			if (isset($row['heading'])) {
144 164
 				$temp_array['heading'] = $row['heading'];
145 165
 				$heading_direction = $this->parseDirection($row['heading']);
146
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
166
+				if (isset($heading_direction[0]['direction_fullname'])) {
167
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
168
+				}
169
+			}
170
+			if (isset($row['ground_speed'])) {
171
+				$temp_array['ground_speed'] = $row['ground_speed'];
147 172
 			}
148
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
149 173
 			
150 174
 			if (isset($row['date'])) {
151 175
 				$dateArray = $this->parseDateString($row['date']);
@@ -188,13 +212,21 @@  discard block
 block discarded – undo
188 212
 			}
189 213
 			
190 214
 			$fromsource = NULL;
191
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
192
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
193
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
215
+			if (isset($row['source_name']) && $row['source_name'] != '') {
216
+				$temp_array['source_name'] = $row['source_name'];
217
+			}
218
+			if (isset($row['over_country']) && $row['over_country'] != '') {
219
+				$temp_array['over_country'] = $row['over_country'];
220
+			}
221
+			if (isset($row['distance']) && $row['distance'] != '') {
222
+				$temp_array['distance'] = $row['distance'];
223
+			}
194 224
 			$temp_array['query_number_rows'] = $num_rows;
195 225
 			$tracker_array[] = $temp_array;
196 226
 		}
197
-		if ($num_rows == 0) return array();
227
+		if ($num_rows == 0) {
228
+			return array();
229
+		}
198 230
 		$tracker_array[0]['query_number_rows'] = $num_rows;
199 231
 		return $tracker_array;
200 232
 	}	
@@ -225,8 +257,12 @@  discard block
 block discarded – undo
225 257
 			{
226 258
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
227 259
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
228
-			} else $limit_query = "";
229
-		} else $limit_query = "";
260
+			} else {
261
+				$limit_query = "";
262
+			}
263
+		} else {
264
+			$limit_query = "";
265
+		}
230 266
 		
231 267
 		if ($sort != "")
232 268
 		{
@@ -254,7 +290,9 @@  discard block
 block discarded – undo
254 290
 		global $global_query;
255 291
 		
256 292
 		date_default_timezone_set('UTC');
257
-		if ($id == '') return array();
293
+		if ($id == '') {
294
+			return array();
295
+		}
258 296
 		$additional_query = "tracker_output.famtrackid = :id";
259 297
 		$query_values = array(':id' => $id);
260 298
 		$query  = $global_query." WHERE ".$additional_query." ";
@@ -397,8 +435,11 @@  discard block
 block discarded – undo
397 435
 		$query .= " ORDER BY tracker_output.source_name ASC";
398 436
 
399 437
 		$sth = $this->db->prepare($query);
400
-		if (!empty($query_values)) $sth->execute($query_values);
401
-		else $sth->execute();
438
+		if (!empty($query_values)) {
439
+			$sth->execute($query_values);
440
+		} else {
441
+			$sth->execute();
442
+		}
402 443
 
403 444
 		$source_array = array();
404 445
 		$temp_array = array();
@@ -453,7 +494,9 @@  discard block
 block discarded – undo
453 494
 			date_default_timezone_set($globalTimezone);
454 495
 			$datetime = new DateTime();
455 496
 			$offset = $datetime->format('P');
456
-		} else $offset = '+00:00';
497
+		} else {
498
+			$offset = '+00:00';
499
+		}
457 500
 
458 501
 		if ($globalDBdriver == 'mysql') {
459 502
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
@@ -609,7 +652,9 @@  discard block
 block discarded – undo
609 652
 			{
610 653
 				return false;
611 654
 			}
612
-		} else $altitude = 0;
655
+		} else {
656
+			$altitude = 0;
657
+		}
613 658
 		
614 659
 		if ($heading != "")
615 660
 		{
@@ -648,8 +693,12 @@  discard block
 block discarded – undo
648 693
             		$latitude = 0;
649 694
             		$longitude = 0;
650 695
             	}
651
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
696
+                if ($heading == '' || $Common->isInteger($heading) === false) {
697
+                	$heading = 0;
698
+                }
699
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
700
+                	$groundspeed = 0;
701
+                }
653 702
                 $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
654 703
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
655 704
 
@@ -753,7 +802,9 @@  discard block
 block discarded – undo
753 802
 		global $globalDBdriver, $globalArchive;
754 803
 		//$filter_query = $this->getFilter($filters,true,true);
755 804
 		$Connection= new Connection($this->db);
756
-		if (!$Connection->tableExists('countries')) return array();
805
+		if (!$Connection->tableExists('countries')) {
806
+			return array();
807
+		}
757 808
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
758 809
 			require_once('class.TrackerLive.php');
759 810
 			$TrackerLive = new TrackerLive($this->db);
@@ -796,7 +847,9 @@  discard block
 block discarded – undo
796 847
 			$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT famtrackid,over_country FROM tracker_archive".$filter_query.") l ON c.iso2 = l.over_country ";
797 848
 		}
798 849
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
799
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
850
+		if ($limit) {
851
+			$query .= " LIMIT 10 OFFSET 0";
852
+		}
800 853
       
801 854
 		
802 855
 		$sth = $this->db->prepare($query);
@@ -829,12 +882,18 @@  discard block
 block discarded – undo
829 882
 		$query  = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
830 883
                     FROM tracker_output".$filter_query." tracker_output.ident <> ''";
831 884
 		 if ($olderthanmonths > 0) {
832
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
833
-			else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
885
+			if ($globalDBdriver == 'mysql') {
886
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
887
+			} else {
888
+				$query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
889
+			}
834 890
 		}
835 891
 		if ($sincedate != '') {
836
-			if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'";
837
-			else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
892
+			if ($globalDBdriver == 'mysql') {
893
+				$query .= " AND tracker_output.date > '".$sincedate."'";
894
+			} else {
895
+				$query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
896
+			}
838 897
 		}
839 898
 		$query_values = array();
840 899
 		if ($year != '') {
@@ -865,7 +924,9 @@  discard block
 block discarded – undo
865 924
 			}
866 925
 		}
867 926
 		$query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC";
868
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
927
+		if ($limit) {
928
+			$query .= " LIMIT 10 OFFSET 0";
929
+		}
869 930
       		
870 931
 		$sth = $this->db->prepare($query);
871 932
 		$sth->execute($query_values);
@@ -900,7 +961,9 @@  discard block
 block discarded – undo
900 961
 			date_default_timezone_set($globalTimezone);
901 962
 			$datetime = new DateTime();
902 963
 			$offset = $datetime->format('P');
903
-		} else $offset = '+00:00';
964
+		} else {
965
+			$offset = '+00:00';
966
+		}
904 967
 
905 968
 		if ($globalDBdriver == 'mysql') {
906 969
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -950,7 +1013,9 @@  discard block
 block discarded – undo
950 1013
 			date_default_timezone_set($globalTimezone);
951 1014
 			$datetime = new DateTime();
952 1015
 			$offset = $datetime->format('P');
953
-		} else $offset = '+00:00';
1016
+		} else {
1017
+			$offset = '+00:00';
1018
+		}
954 1019
 		$filter_query = $this->getFilter($filters,true,true);
955 1020
 		if ($globalDBdriver == 'mysql') {
956 1021
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -996,7 +1061,9 @@  discard block
 block discarded – undo
996 1061
 			date_default_timezone_set($globalTimezone);
997 1062
 			$datetime = new DateTime();
998 1063
 			$offset = $datetime->format('P');
999
-		} else $offset = '+00:00';
1064
+		} else {
1065
+			$offset = '+00:00';
1066
+		}
1000 1067
 		$filter_query = $this->getFilter($filters,true,true);
1001 1068
 		if ($globalDBdriver == 'mysql') {
1002 1069
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1044,7 +1111,9 @@  discard block
 block discarded – undo
1044 1111
 			date_default_timezone_set($globalTimezone);
1045 1112
 			$datetime = new DateTime();
1046 1113
 			$offset = $datetime->format('P');
1047
-		} else $offset = '+00:00';
1114
+		} else {
1115
+			$offset = '+00:00';
1116
+		}
1048 1117
 
1049 1118
 		if ($globalDBdriver == 'mysql') {
1050 1119
 			$query  = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -1093,7 +1162,9 @@  discard block
 block discarded – undo
1093 1162
 			date_default_timezone_set($globalTimezone);
1094 1163
 			$datetime = new DateTime();
1095 1164
 			$offset = $datetime->format('P');
1096
-		} else $offset = '+00:00';
1165
+		} else {
1166
+			$offset = '+00:00';
1167
+		}
1097 1168
 		$filter_query = $this->getFilter($filters,true,true);
1098 1169
 		if ($globalDBdriver == 'mysql') {
1099 1170
 			$query  = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -1142,7 +1213,9 @@  discard block
 block discarded – undo
1142 1213
 			date_default_timezone_set($globalTimezone);
1143 1214
 			$datetime = new DateTime();
1144 1215
 			$offset = $datetime->format('P');
1145
-		} else $offset = '+00:00';
1216
+		} else {
1217
+			$offset = '+00:00';
1218
+		}
1146 1219
 
1147 1220
 		$orderby_sql = '';
1148 1221
 		if ($orderby == "hour")
@@ -1211,7 +1284,9 @@  discard block
 block discarded – undo
1211 1284
 			date_default_timezone_set($globalTimezone);
1212 1285
 			$datetime = new DateTime($date);
1213 1286
 			$offset = $datetime->format('P');
1214
-		} else $offset = '+00:00';
1287
+		} else {
1288
+			$offset = '+00:00';
1289
+		}
1215 1290
 
1216 1291
 		if ($globalDBdriver == 'mysql') {
1217 1292
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1259,7 +1334,9 @@  discard block
 block discarded – undo
1259 1334
 			date_default_timezone_set($globalTimezone);
1260 1335
 			$datetime = new DateTime();
1261 1336
 			$offset = $datetime->format('P');
1262
-		} else $offset = '+00:00';
1337
+		} else {
1338
+			$offset = '+00:00';
1339
+		}
1263 1340
 
1264 1341
 		if ($globalDBdriver == 'mysql') {
1265 1342
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1324,8 +1401,11 @@  discard block
 block discarded – undo
1324 1401
 				$query_values = array_merge($query_values,array(':month' => $month));
1325 1402
 			}
1326 1403
 		}
1327
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1328
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1404
+		if (empty($query_values)) {
1405
+			$queryi .= $this->getFilter($filters);
1406
+		} else {
1407
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1408
+		}
1329 1409
 		
1330 1410
 		$sth = $this->db->prepare($queryi);
1331 1411
 		$sth->execute($query_values);
@@ -1362,8 +1442,11 @@  discard block
 block discarded – undo
1362 1442
 				$query_values = array_merge($query_values,array(':month' => $month));
1363 1443
 			}
1364 1444
 		}
1365
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1366
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1445
+		if (empty($query_values)) {
1446
+			$queryi .= $this->getFilter($filters);
1447
+		} else {
1448
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1449
+		}
1367 1450
 		
1368 1451
 		$sth = $this->db->prepare($queryi);
1369 1452
 		$sth->execute($query_values);
@@ -1385,7 +1468,9 @@  discard block
 block discarded – undo
1385 1468
 			date_default_timezone_set($globalTimezone);
1386 1469
 			$datetime = new DateTime();
1387 1470
 			$offset = $datetime->format('P');
1388
-		} else $offset = '+00:00';
1471
+		} else {
1472
+			$offset = '+00:00';
1473
+		}
1389 1474
 
1390 1475
 		if ($globalDBdriver == 'mysql') {
1391 1476
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1489,7 +1574,9 @@  discard block
 block discarded – undo
1489 1574
 	*/
1490 1575
 	public function parseDirection($direction = 0)
1491 1576
 	{
1492
-		if ($direction == '') $direction = 0;
1577
+		if ($direction == '') {
1578
+			$direction = 0;
1579
+		}
1493 1580
 		$direction_array = array();
1494 1581
 		$temp_array = array();
1495 1582
 
@@ -1578,7 +1665,9 @@  discard block
 block discarded – undo
1578 1665
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1579 1666
 	
1580 1667
 		$Connection = new Connection($this->db);
1581
-		if (!$Connection->tableExists('countries')) return '';
1668
+		if (!$Connection->tableExists('countries')) {
1669
+			return '';
1670
+		}
1582 1671
 	
1583 1672
 		try {
1584 1673
 			/*
@@ -1598,9 +1687,13 @@  discard block
 block discarded – undo
1598 1687
 			$sth->closeCursor();
1599 1688
 			if (count($row) > 0) {
1600 1689
 				return $row;
1601
-			} else return '';
1690
+			} else {
1691
+				return '';
1692
+			}
1602 1693
 		} catch (PDOException $e) {
1603
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1694
+			if (isset($globalDebug) && $globalDebug) {
1695
+				echo 'Error : '.$e->getMessage()."\n";
1696
+			}
1604 1697
 			return '';
1605 1698
 		}
1606 1699
 	
@@ -1618,7 +1711,9 @@  discard block
 block discarded – undo
1618 1711
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1619 1712
 	
1620 1713
 		$Connection = new Connection($this->db);
1621
-		if (!$Connection->tableExists('countries')) return '';
1714
+		if (!$Connection->tableExists('countries')) {
1715
+			return '';
1716
+		}
1622 1717
 	
1623 1718
 		try {
1624 1719
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -1630,9 +1725,13 @@  discard block
 block discarded – undo
1630 1725
 			$sth->closeCursor();
1631 1726
 			if (count($row) > 0) {
1632 1727
 				return $row;
1633
-			} else return '';
1728
+			} else {
1729
+				return '';
1730
+			}
1634 1731
 		} catch (PDOException $e) {
1635
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1732
+			if (isset($globalDebug) && $globalDebug) {
1733
+				echo 'Error : '.$e->getMessage()."\n";
1734
+			}
1636 1735
 			return '';
1637 1736
 		}
1638 1737
 	
@@ -1693,7 +1792,9 @@  discard block
 block discarded – undo
1693 1792
 			}
1694 1793
 		}
1695 1794
 		$query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC";
1696
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
1795
+		if ($limit) {
1796
+			$query .= " LIMIT 10 OFFSET 0";
1797
+		}
1697 1798
 		$sth = $this->db->prepare($query);
1698 1799
 		$sth->execute($query_values);
1699 1800
 		$tracker_array = array();
@@ -1730,7 +1831,9 @@  discard block
 block discarded – undo
1730 1831
 				foreach ($q_array as $q_item){
1731 1832
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
1732 1833
 					$additional_query .= " AND (";
1733
-					if (is_int($q_item)) $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR ";
1834
+					if (is_int($q_item)) {
1835
+						$additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR ";
1836
+					}
1734 1837
 					$additional_query .= "(tracker_output.ident like '%".$q_item."%') OR ";
1735 1838
 					$additional_query .= ")";
1736 1839
 				}
@@ -1756,7 +1859,9 @@  discard block
 block discarded – undo
1756 1859
 				date_default_timezone_set($globalTimezone);
1757 1860
 				$datetime = new DateTime();
1758 1861
 				$offset = $datetime->format('P');
1759
-			} else $offset = '+00:00';
1862
+			} else {
1863
+				$offset = '+00:00';
1864
+			}
1760 1865
 			if ($date_array[1] != "")
1761 1866
 			{
1762 1867
 				$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
@@ -1783,8 +1888,12 @@  discard block
 block discarded – undo
1783 1888
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1784 1889
 			{
1785 1890
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1786
-			} else $limit_query = "";
1787
-		} else $limit_query = "";
1891
+			} else {
1892
+				$limit_query = "";
1893
+			}
1894
+		} else {
1895
+			$limit_query = "";
1896
+		}
1788 1897
 		if ($sort != "")
1789 1898
 		{
1790 1899
 			$search_orderby_array = $this->getOrderBy();
@@ -1827,7 +1936,9 @@  discard block
 block discarded – undo
1827 1936
 	{
1828 1937
 		global $globalBitlyAccessToken;
1829 1938
 		
1830
-		if ($globalBitlyAccessToken == '') return $url;
1939
+		if ($globalBitlyAccessToken == '') {
1940
+			return $url;
1941
+		}
1831 1942
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
1832 1943
 		$ch = curl_init();
1833 1944
 		curl_setopt($ch, CURLOPT_HEADER, 0);
Please login to merge, or discard this patch.
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT tracker_output.* FROM tracker_output";
6 6
 
7
-class Tracker{
7
+class Tracker {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -19,33 +19,33 @@  discard block
 block discarded – undo
19 19
 	* @return Array the SQL part
20 20
 	*/
21 21
 	
22
-	public function getFilter($filter = array(),$where = false,$and = false) {
22
+	public function getFilter($filter = array(), $where = false, $and = false) {
23 23
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
24 24
 		$filters = array();
25 25
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
26 26
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
27 27
 				$filters = $globalStatsFilters[$globalFilterName];
28 28
 			} else {
29
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
29
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
30 30
 			}
31 31
 		}
32 32
 		if (isset($filter[0]['source'])) {
33
-			$filters = array_merge($filters,$filter);
33
+			$filters = array_merge($filters, $filter);
34 34
 		}
35
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
36 36
 		$filter_query_join = '';
37 37
 		$filter_query_where = '';
38
-		foreach($filters as $flt) {
38
+		foreach ($filters as $flt) {
39 39
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
40 40
 				if (isset($flt['source'])) {
41
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
41
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
42 42
 				} else {
43
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
43
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
44 44
 				}
45 45
 			}
46 46
 		}
47 47
 		if (isset($filter['source']) && !empty($filter['source'])) {
48
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
48
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
49 49
 		}
50 50
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
51 51
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75 75
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
76 76
 		if ($filter_query_where != '') {
77
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
77
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
78 78
 		}
79 79
 		$filter_query = $filter_query_join.$filter_query_where;
80 80
 		return $filter_query;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	* @return Array the tracker information
90 90
 	*
91 91
 	*/
92
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
93 93
 	{
94 94
 		date_default_timezone_set('UTC');
95 95
 		if (!is_string($query))
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 			$sth = $this->db->prepare($query.$limitQuery);
110 110
 			$sth->execute($params);
111 111
 		} catch (PDOException $e) {
112
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
112
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
113 113
 			exit();
114 114
 		}
115 115
 		
116 116
 		$num_rows = 0;
117 117
 		$tracker_array = array();
118
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
118
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
119 119
 		{
120 120
 			$num_rows++;
121 121
 			$temp_array = array();
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 				{
172 172
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
173 173
 				} else {
174
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
174
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
175 175
 				}
176 176
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
177
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
178
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
177
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
178
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
179 179
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
180 180
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
181 181
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
182 182
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
183
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
184
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
183
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
184
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
185 185
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
186 186
 					}
187 187
 				}
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 		{
219 219
 			$limit_array = explode(",", $limit);
220 220
 			
221
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
222
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
221
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
222
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
223 223
 			
224 224
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
225 225
 			{
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 			$orderby_query = " ORDER BY tracker_output.date DESC";
237 237
 		}
238 238
 
239
-		$query  = $global_query.$filter_query." ".$orderby_query;
239
+		$query = $global_query.$filter_query." ".$orderby_query;
240 240
 
241
-		$tracker_array = $this->getDataFromDB($query, array(),$limit_query,true);
241
+		$tracker_array = $this->getDataFromDB($query, array(), $limit_query, true);
242 242
 
243 243
 		return $tracker_array;
244 244
 	}
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		if ($id == '') return array();
258 258
 		$additional_query = "tracker_output.famtrackid = :id";
259 259
 		$query_values = array(':id' => $id);
260
-		$query  = $global_query." WHERE ".$additional_query." ";
261
-		$tracker_array = $this->getDataFromDB($query,$query_values);
260
+		$query = $global_query." WHERE ".$additional_query." ";
261
+		$tracker_array = $this->getDataFromDB($query, $query_values);
262 262
 		return $tracker_array;
263 263
 	}
264 264
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 		$query_values = array();
278 278
 		$limit_query = '';
279 279
 		$additional_query = '';
280
-		$filter_query = $this->getFilter($filter,true,true);
280
+		$filter_query = $this->getFilter($filter, true, true);
281 281
 		if ($ident != "")
282 282
 		{
283 283
 			if (!is_string($ident))
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 		{
294 294
 			$limit_array = explode(",", $limit);
295 295
 			
296
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
297
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
296
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
297
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
298 298
 			
299 299
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
300 300
 			{
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		return $tracker_array;
319 319
 	}
320 320
 	
321
-	public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array())
321
+	public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array())
322 322
 	{
323 323
 		global $global_query, $globalTimezone, $globalDBdriver;
324 324
 		
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		$limit_query = '';
327 327
 		$additional_query = '';
328 328
 
329
-		$filter_query = $this->getFilter($filter,true,true);
329
+		$filter_query = $this->getFilter($filter, true, true);
330 330
 		
331 331
 		if ($date != "")
332 332
 		{
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 		{
353 353
 			$limit_array = explode(",", $limit);
354 354
 			
355
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
356
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
355
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
356
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
357 357
 			
358 358
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
359 359
 			{
@@ -384,11 +384,11 @@  discard block
 block discarded – undo
384 384
 	* @return Array list of source name
385 385
 	*
386 386
 	*/
387
-	public function getAllSourceName($type = '',$filters = array())
387
+	public function getAllSourceName($type = '', $filters = array())
388 388
 	{
389
-		$filter_query = $this->getFilter($filters,true,true);
389
+		$filter_query = $this->getFilter($filters, true, true);
390 390
 		$query_values = array();
391
-		$query  = "SELECT DISTINCT tracker_output.source_name 
391
+		$query = "SELECT DISTINCT tracker_output.source_name 
392 392
 				FROM tracker_output".$filter_query." tracker_output.source_name <> ''";
393 393
 		if ($type != '') {
394 394
 			$query_values = array(':type' => $type);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		$source_array = array();
404 404
 		$temp_array = array();
405 405
 		
406
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
406
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
407 407
 		{
408 408
 			$temp_array['source_name'] = $row['source_name'];
409 409
 			$source_array[] = $temp_array;
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	*/
421 421
 	public function getAllIdents($filters = array())
422 422
 	{
423
-		$filter_query = $this->getFilter($filters,true,true);
424
-		$query  = "SELECT DISTINCT tracker_output.ident
423
+		$filter_query = $this->getFilter($filters, true, true);
424
+		$query = "SELECT DISTINCT tracker_output.ident
425 425
 								FROM tracker_output".$filter_query." tracker_output.ident <> '' 
426 426
 								ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0";
427 427
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$ident_array = array();
432 432
 		$temp_array = array();
433 433
 		
434
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
434
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
435 435
 		{
436 436
 			$temp_array['ident'] = $row['ident'];
437 437
 			$ident_array[] = $temp_array;
@@ -456,12 +456,12 @@  discard block
 block discarded – undo
456 456
 		} else $offset = '+00:00';
457 457
 
458 458
 		if ($globalDBdriver == 'mysql') {
459
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
459
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
460 460
 								FROM tracker_output
461 461
 								WHERE tracker_output.date <> '' 
462 462
 								ORDER BY tracker_output.date ASC LIMIT 0,100";
463 463
 		} else {
464
-			$query  = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
464
+			$query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
465 465
 								FROM tracker_output
466 466
 								WHERE tracker_output.date <> '' 
467 467
 								ORDER BY tracker_output.date ASC LIMIT 0,100";
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 		$date_array = array();
474 474
 		$temp_array = array();
475 475
 		
476
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
476
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
477 477
 		{
478 478
 			$temp_array['date'] = $row['date'];
479 479
 
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 	* @return String success or false
493 493
 	*
494 494
 	*/	
495
-	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
495
+	public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL)
496 496
 	{
497 497
 
498 498
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
499
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499
+                $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident);
500 500
 
501 501
 		try {
502 502
 			$sth = $this->db->prepare($query);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
521 521
 	{
522 522
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
523
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523
+                $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident);
524 524
 
525 525
 		try {
526 526
 			$sth = $this->db->prepare($query);
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	* @param String $verticalrate vertival rate of flight
561 561
 	* @return String success or false
562 562
 	*/
563
-	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563
+	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '')
564 564
 	{
565 565
 		global $globalURL;
566 566
 		
@@ -628,21 +628,21 @@  discard block
 block discarded – undo
628 628
 		}
629 629
 
630 630
     
631
-		if ($date == "" || strtotime($date) < time()-20*60)
631
+		if ($date == "" || strtotime($date) < time() - 20*60)
632 632
 		{
633 633
 			$date = date("Y-m-d H:i:s", time());
634 634
 		}
635 635
 
636
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
637
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
638
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
639
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
640
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
641
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
642
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
643
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
644
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
645
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
636
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
637
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
638
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
639
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
640
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
641
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
642
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
643
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
644
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
645
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
646 646
 	
647 647
                 if ($latitude == '' && $longitude == '') {
648 648
             		$latitude = 0;
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
             	}
651 651
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652 652
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
653
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653
+                $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
654 654
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
655 655
 
656
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656
+                $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type);
657 657
 
658 658
 		try {
659 659
 		        
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
681 681
 		if ($globalDBdriver == 'mysql') {
682
-			$query  = "SELECT tracker_output.ident FROM tracker_output 
682
+			$query = "SELECT tracker_output.ident FROM tracker_output 
683 683
 								WHERE tracker_output.ident = :ident 
684 684
 								AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
685 685
 								AND tracker_output.date < UTC_TIMESTAMP()";
686 686
 			$query_data = array(':ident' => $ident);
687 687
 		} else {
688
-			$query  = "SELECT tracker_output.ident FROM tracker_output 
688
+			$query = "SELECT tracker_output.ident FROM tracker_output 
689 689
 								WHERE tracker_output.ident = :ident 
690 690
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
691 691
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
 		
695 695
 		$sth = $this->db->prepare($query);
696 696
 		$sth->execute($query_data);
697
-    		$ident_result='';
698
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
697
+    		$ident_result = '';
698
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
699 699
 		{
700 700
 			$ident_result = $row['ident'];
701 701
 		}
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
 				return false;
722 722
 			} else {
723 723
 				$q_array = explode(" ", $q);
724
-				foreach ($q_array as $q_item){
725
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
724
+				foreach ($q_array as $q_item) {
725
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
726 726
 					$additional_query .= " AND (";
727 727
 					$additional_query .= "(tracker_output.ident like '%".$q_item."%')";
728 728
 					$additional_query .= ")";
@@ -730,11 +730,11 @@  discard block
 block discarded – undo
730 730
 			}
731 731
 		}
732 732
 		if ($globalDBdriver == 'mysql') {
733
-			$query  = "SELECT tracker_output.* FROM tracker_output 
733
+			$query = "SELECT tracker_output.* FROM tracker_output 
734 734
 				WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
735 735
 				AND tracker_output.date < UTC_TIMESTAMP()";
736 736
 		} else {
737
-			$query  = "SELECT tracker_output.* FROM tracker_output 
737
+			$query = "SELECT tracker_output.* FROM tracker_output 
738 738
 				WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
739 739
 				AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
740 740
 		}
@@ -748,16 +748,16 @@  discard block
 block discarded – undo
748 748
 	* @return Array the airline country list
749 749
 	*
750 750
 	*/
751
-	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
751
+	public function countAllTrackerOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
752 752
 	{
753 753
 		global $globalDBdriver, $globalArchive;
754 754
 		//$filter_query = $this->getFilter($filters,true,true);
755
-		$Connection= new Connection($this->db);
755
+		$Connection = new Connection($this->db);
756 756
 		if (!$Connection->tableExists('countries')) return array();
757 757
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
758 758
 			require_once('class.TrackerLive.php');
759 759
 			$TrackerLive = new TrackerLive($this->db);
760
-			$filter_query = $TrackerLive->getFilter($filters,true,true);
760
+			$filter_query = $TrackerLive->getFilter($filters, true, true);
761 761
 			$filter_query .= " over_country IS NOT NULL AND over_country <> ''";
762 762
 			if ($olderthanmonths > 0) {
763 763
 				if ($globalDBdriver == 'mysql') {
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 		} else {
778 778
 			require_once('class.TrackerArchive.php');
779 779
 			$TrackerArchive = new TrackerArchive($this->db);
780
-			$filter_query = $TrackerArchive->getFilter($filters,true,true);
780
+			$filter_query = $TrackerArchive->getFilter($filters, true, true);
781 781
 			$filter_query .= " over_country IS NOT NULL AND over_country <> ''";
782 782
 			if ($olderthanmonths > 0) {
783 783
 				if ($globalDBdriver == 'mysql') {
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		$flight_array = array();
806 806
 		$temp_array = array();
807 807
         
808
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
808
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
809 809
 		{
810 810
 			$temp_array['tracker_count'] = $row['nb'];
811 811
 			$temp_array['tracker_country'] = $row['name'];
@@ -822,11 +822,11 @@  discard block
 block discarded – undo
822 822
 	* @return Array the callsign list
823 823
 	*
824 824
 	*/
825
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
825
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
826 826
 	{
827 827
 		global $globalDBdriver;
828
-		$filter_query = $this->getFilter($filters,true,true);
829
-		$query  = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
828
+		$filter_query = $this->getFilter($filters, true, true);
829
+		$query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
830 830
                     FROM tracker_output".$filter_query." tracker_output.ident <> ''";
831 831
 		 if ($olderthanmonths > 0) {
832 832
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -840,28 +840,28 @@  discard block
 block discarded – undo
840 840
 		if ($year != '') {
841 841
 			if ($globalDBdriver == 'mysql') {
842 842
 				$query .= " AND YEAR(tracker_output.date) = :year";
843
-				$query_values = array_merge($query_values,array(':year' => $year));
843
+				$query_values = array_merge($query_values, array(':year' => $year));
844 844
 			} else {
845 845
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
846
-				$query_values = array_merge($query_values,array(':year' => $year));
846
+				$query_values = array_merge($query_values, array(':year' => $year));
847 847
 			}
848 848
 		}
849 849
 		if ($month != '') {
850 850
 			if ($globalDBdriver == 'mysql') {
851 851
 				$query .= " AND MONTH(tracker_output.date) = :month";
852
-				$query_values = array_merge($query_values,array(':month' => $month));
852
+				$query_values = array_merge($query_values, array(':month' => $month));
853 853
 			} else {
854 854
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
855
-				$query_values = array_merge($query_values,array(':month' => $month));
855
+				$query_values = array_merge($query_values, array(':month' => $month));
856 856
 			}
857 857
 		}
858 858
 		if ($day != '') {
859 859
 			if ($globalDBdriver == 'mysql') {
860 860
 				$query .= " AND DAY(tracker_output.date) = :day";
861
-				$query_values = array_merge($query_values,array(':day' => $day));
861
+				$query_values = array_merge($query_values, array(':day' => $day));
862 862
 			} else {
863 863
 				$query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day";
864
-				$query_values = array_merge($query_values,array(':day' => $day));
864
+				$query_values = array_merge($query_values, array(':day' => $day));
865 865
 			}
866 866
 		}
867 867
 		$query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC";
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 		$callsign_array = array();
874 874
 		$temp_array = array();
875 875
         
876
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
876
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
877 877
 		{
878 878
 			$temp_array['callsign_icao'] = $row['ident'];
879 879
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 		$date_array = array();
926 926
 		$temp_array = array();
927 927
         
928
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
928
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
929 929
 		{
930 930
 			$temp_array['date_name'] = $row['date_name'];
931 931
 			$temp_array['date_count'] = $row['date_count'];
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 			$datetime = new DateTime();
952 952
 			$offset = $datetime->format('P');
953 953
 		} else $offset = '+00:00';
954
-		$filter_query = $this->getFilter($filters,true,true);
954
+		$filter_query = $this->getFilter($filters, true, true);
955 955
 		if ($globalDBdriver == 'mysql') {
956 956
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
957 957
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 		$date_array = array();
973 973
 		$temp_array = array();
974 974
         
975
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
975
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
976 976
 		{
977 977
 			$temp_array['date_name'] = $row['date_name'];
978 978
 			$temp_array['date_count'] = $row['date_count'];
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 			$datetime = new DateTime();
998 998
 			$offset = $datetime->format('P');
999 999
 		} else $offset = '+00:00';
1000
-		$filter_query = $this->getFilter($filters,true,true);
1000
+		$filter_query = $this->getFilter($filters, true, true);
1001 1001
 		if ($globalDBdriver == 'mysql') {
1002 1002
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
1003 1003
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 		$date_array = array();
1019 1019
 		$temp_array = array();
1020 1020
         
1021
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1021
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1022 1022
 		{
1023 1023
 			$temp_array['date_name'] = $row['date_name'];
1024 1024
 			$temp_array['date_count'] = $row['date_count'];
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
 		$date_array = array();
1066 1066
 		$temp_array = array();
1067 1067
         
1068
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1068
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1069 1069
 		{
1070 1070
 			$temp_array['month_name'] = $row['month_name'];
1071 1071
 			$temp_array['year_name'] = $row['year_name'];
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 			$datetime = new DateTime();
1095 1095
 			$offset = $datetime->format('P');
1096 1096
 		} else $offset = '+00:00';
1097
-		$filter_query = $this->getFilter($filters,true,true);
1097
+		$filter_query = $this->getFilter($filters, true, true);
1098 1098
 		if ($globalDBdriver == 'mysql') {
1099 1099
 			$query  = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
1100 1100
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 		$date_array = array();
1116 1116
 		$temp_array = array();
1117 1117
         
1118
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1118
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1119 1119
 		{
1120 1120
 			$temp_array['year_name'] = $row['year_name'];
1121 1121
 			$temp_array['month_name'] = $row['month_name'];
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 	* @return Array the hour list
1136 1136
 	*
1137 1137
 	*/
1138
-	public function countAllHours($orderby,$filters = array())
1138
+	public function countAllHours($orderby, $filters = array())
1139 1139
 	{
1140 1140
 		global $globalTimezone, $globalDBdriver;
1141 1141
 		if ($globalTimezone != '') {
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 		$hour_array = array();
1184 1184
 		$temp_array = array();
1185 1185
         
1186
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1186
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1187 1187
 		{
1188 1188
 			$temp_array['hour_name'] = $row['hour_name'];
1189 1189
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1205,8 +1205,8 @@  discard block
 block discarded – undo
1205 1205
 	public function countAllHoursByDate($date, $filters = array())
1206 1206
 	{
1207 1207
 		global $globalTimezone, $globalDBdriver;
1208
-		$filter_query = $this->getFilter($filters,true,true);
1209
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
1208
+		$filter_query = $this->getFilter($filters, true, true);
1209
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
1210 1210
 		if ($globalTimezone != '') {
1211 1211
 			date_default_timezone_set($globalTimezone);
1212 1212
 			$datetime = new DateTime($date);
@@ -1214,12 +1214,12 @@  discard block
 block discarded – undo
1214 1214
 		} else $offset = '+00:00';
1215 1215
 
1216 1216
 		if ($globalDBdriver == 'mysql') {
1217
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1217
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1218 1218
 								FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date
1219 1219
 								GROUP BY hour_name 
1220 1220
 								ORDER BY hour_name ASC";
1221 1221
 		} else {
1222
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1222
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1223 1223
 								FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
1224 1224
 								GROUP BY hour_name 
1225 1225
 								ORDER BY hour_name ASC";
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		$hour_array = array();
1232 1232
 		$temp_array = array();
1233 1233
         
1234
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1234
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1235 1235
 		{
1236 1236
 			$temp_array['hour_name'] = $row['hour_name'];
1237 1237
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1253,8 +1253,8 @@  discard block
 block discarded – undo
1253 1253
 	public function countAllHoursByIdent($ident, $filters = array())
1254 1254
 	{
1255 1255
 		global $globalTimezone, $globalDBdriver;
1256
-		$filter_query = $this->getFilter($filters,true,true);
1257
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1256
+		$filter_query = $this->getFilter($filters, true, true);
1257
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1258 1258
 		if ($globalTimezone != '') {
1259 1259
 			date_default_timezone_set($globalTimezone);
1260 1260
 			$datetime = new DateTime();
@@ -1262,12 +1262,12 @@  discard block
 block discarded – undo
1262 1262
 		} else $offset = '+00:00';
1263 1263
 
1264 1264
 		if ($globalDBdriver == 'mysql') {
1265
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1265
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1266 1266
 								FROM tracker_output".$filter_query." tracker_output.ident = :ident 
1267 1267
 								GROUP BY hour_name 
1268 1268
 								ORDER BY hour_name ASC";
1269 1269
 		} else {
1270
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1270
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1271 1271
 								FROM tracker_output".$filter_query." tracker_output.ident = :ident 
1272 1272
 								GROUP BY hour_name 
1273 1273
 								ORDER BY hour_name ASC";
@@ -1275,12 +1275,12 @@  discard block
 block discarded – undo
1275 1275
       
1276 1276
 		
1277 1277
 		$sth = $this->db->prepare($query);
1278
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
1278
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
1279 1279
       
1280 1280
 		$hour_array = array();
1281 1281
 		$temp_array = array();
1282 1282
         
1283
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1283
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1284 1284
 		{
1285 1285
 			$temp_array['hour_name'] = $row['hour_name'];
1286 1286
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1299,33 +1299,33 @@  discard block
 block discarded – undo
1299 1299
 	* @return Integer the number of trackers
1300 1300
 	*
1301 1301
 	*/
1302
-	public function countOverallTracker($filters = array(),$year = '',$month = '')
1302
+	public function countOverallTracker($filters = array(), $year = '', $month = '')
1303 1303
 	{
1304 1304
 		global $globalDBdriver;
1305 1305
 		//$queryi  = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output";
1306
-		$queryi  = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output";
1306
+		$queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output";
1307 1307
 		$query_values = array();
1308 1308
 		$query = '';
1309 1309
 		if ($year != '') {
1310 1310
 			if ($globalDBdriver == 'mysql') {
1311 1311
 				$query .= " AND YEAR(tracker_output.date) = :year";
1312
-				$query_values = array_merge($query_values,array(':year' => $year));
1312
+				$query_values = array_merge($query_values, array(':year' => $year));
1313 1313
 			} else {
1314 1314
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1315
-				$query_values = array_merge($query_values,array(':year' => $year));
1315
+				$query_values = array_merge($query_values, array(':year' => $year));
1316 1316
 			}
1317 1317
 		}
1318 1318
 		if ($month != '') {
1319 1319
 			if ($globalDBdriver == 'mysql') {
1320 1320
 				$query .= " AND MONTH(tracker_output.date) = :month";
1321
-				$query_values = array_merge($query_values,array(':month' => $month));
1321
+				$query_values = array_merge($query_values, array(':month' => $month));
1322 1322
 			} else {
1323 1323
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1324
-				$query_values = array_merge($query_values,array(':month' => $month));
1324
+				$query_values = array_merge($query_values, array(':month' => $month));
1325 1325
 			}
1326 1326
 		}
1327 1327
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1328
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1328
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1329 1329
 		
1330 1330
 		$sth = $this->db->prepare($queryi);
1331 1331
 		$sth->execute($query_values);
@@ -1338,32 +1338,32 @@  discard block
 block discarded – undo
1338 1338
 	* @return Integer the number of flights
1339 1339
 	*
1340 1340
 	*/
1341
-	public function countOverallTrackerTypes($filters = array(),$year = '',$month = '')
1341
+	public function countOverallTrackerTypes($filters = array(), $year = '', $month = '')
1342 1342
 	{
1343 1343
 		global $globalDBdriver;
1344
-		$queryi  = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output";
1344
+		$queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output";
1345 1345
 		$query_values = array();
1346 1346
 		$query = '';
1347 1347
 		if ($year != '') {
1348 1348
 			if ($globalDBdriver == 'mysql') {
1349 1349
 				$query .= " AND YEAR(tracker_output.date) = :year";
1350
-				$query_values = array_merge($query_values,array(':year' => $year));
1350
+				$query_values = array_merge($query_values, array(':year' => $year));
1351 1351
 			} else {
1352 1352
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1353
-				$query_values = array_merge($query_values,array(':year' => $year));
1353
+				$query_values = array_merge($query_values, array(':year' => $year));
1354 1354
 			}
1355 1355
 		}
1356 1356
 		if ($month != '') {
1357 1357
 			if ($globalDBdriver == 'mysql') {
1358 1358
 				$query .= " AND MONTH(tracker_output.date) = :month";
1359
-				$query_values = array_merge($query_values,array(':month' => $month));
1359
+				$query_values = array_merge($query_values, array(':month' => $month));
1360 1360
 			} else {
1361 1361
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1362
-				$query_values = array_merge($query_values,array(':month' => $month));
1362
+				$query_values = array_merge($query_values, array(':month' => $month));
1363 1363
 			}
1364 1364
 		}
1365 1365
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1366
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1366
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1367 1367
 		
1368 1368
 		$sth = $this->db->prepare($queryi);
1369 1369
 		$sth->execute($query_values);
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 	public function countAllHoursFromToday($filters = array())
1381 1381
 	{
1382 1382
 		global $globalTimezone, $globalDBdriver;
1383
-		$filter_query = $this->getFilter($filters,true,true);
1383
+		$filter_query = $this->getFilter($filters, true, true);
1384 1384
 		if ($globalTimezone != '') {
1385 1385
 			date_default_timezone_set($globalTimezone);
1386 1386
 			$datetime = new DateTime();
@@ -1388,12 +1388,12 @@  discard block
 block discarded – undo
1388 1388
 		} else $offset = '+00:00';
1389 1389
 
1390 1390
 		if ($globalDBdriver == 'mysql') {
1391
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1391
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1392 1392
 								FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE()
1393 1393
 								GROUP BY hour_name 
1394 1394
 								ORDER BY hour_name ASC";
1395 1395
 		} else {
1396
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1396
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1397 1397
 								FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
1398 1398
 								GROUP BY hour_name 
1399 1399
 								ORDER BY hour_name ASC";
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 		$hour_array = array();
1406 1406
 		$temp_array = array();
1407 1407
         
1408
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1408
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1409 1409
 		{
1410 1410
 			$temp_array['hour_name'] = $row['hour_name'];
1411 1411
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1424,9 +1424,9 @@  discard block
 block discarded – undo
1424 1424
 	*/
1425 1425
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1426 1426
 	{
1427
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
1427
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
1428 1428
 
1429
-		$query  = "SELECT tracker_output.tracker_id
1429
+		$query = "SELECT tracker_output.tracker_id
1430 1430
 				FROM tracker_output 
1431 1431
 				WHERE tracker_output.famtrackid = '".$famtrackid."'";
1432 1432
         
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
 		$sth = $this->db->prepare($query);
1435 1435
 		$sth->execute();
1436 1436
 
1437
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1437
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1438 1438
 		{
1439 1439
 			return $row['tracker_id'];
1440 1440
 		}
@@ -1459,23 +1459,23 @@  discard block
 block discarded – undo
1459 1459
 		}
1460 1460
 		
1461 1461
 		$current_date = date("Y-m-d H:i:s");
1462
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
1462
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
1463 1463
 		
1464 1464
 		$diff = abs(strtotime($current_date) - strtotime($date));
1465 1465
 
1466
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
1466
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
1467 1467
 		$years = $time_array['years'];
1468 1468
 		
1469
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
1469
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
1470 1470
 		$months = $time_array['months'];
1471 1471
 		
1472
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
1472
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
1473 1473
 		$days = $time_array['days'];
1474
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
1474
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
1475 1475
 		$hours = $time_array['hours'];
1476
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
1476
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
1477 1477
 		$minutes = $time_array['minutes'];
1478
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1478
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1479 1479
 		
1480 1480
 		return $time_array;
1481 1481
 	}
@@ -1498,63 +1498,63 @@  discard block
 block discarded – undo
1498 1498
 			$temp_array['direction_degree'] = $direction;
1499 1499
 			$temp_array['direction_shortname'] = "N";
1500 1500
 			$temp_array['direction_fullname'] = "North";
1501
-		} elseif ($direction >= 22.5 && $direction < 45){
1501
+		} elseif ($direction >= 22.5 && $direction < 45) {
1502 1502
 			$temp_array['direction_degree'] = $direction;
1503 1503
 			$temp_array['direction_shortname'] = "NNE";
1504 1504
 			$temp_array['direction_fullname'] = "North-Northeast";
1505
-		} elseif ($direction >= 45 && $direction < 67.5){
1505
+		} elseif ($direction >= 45 && $direction < 67.5) {
1506 1506
 			$temp_array['direction_degree'] = $direction;
1507 1507
 			$temp_array['direction_shortname'] = "NE";
1508 1508
 			$temp_array['direction_fullname'] = "Northeast";
1509
-		} elseif ($direction >= 67.5 && $direction < 90){
1509
+		} elseif ($direction >= 67.5 && $direction < 90) {
1510 1510
 			$temp_array['direction_degree'] = $direction;
1511 1511
 			$temp_array['direction_shortname'] = "ENE";
1512 1512
 			$temp_array['direction_fullname'] = "East-Northeast";
1513
-		} elseif ($direction >= 90 && $direction < 112.5){
1513
+		} elseif ($direction >= 90 && $direction < 112.5) {
1514 1514
 			$temp_array['direction_degree'] = $direction;
1515 1515
 			$temp_array['direction_shortname'] = "E";
1516 1516
 			$temp_array['direction_fullname'] = "East";
1517
-		} elseif ($direction >= 112.5 && $direction < 135){
1517
+		} elseif ($direction >= 112.5 && $direction < 135) {
1518 1518
 			$temp_array['direction_degree'] = $direction;
1519 1519
 			$temp_array['direction_shortname'] = "ESE";
1520 1520
 			$temp_array['direction_fullname'] = "East-Southeast";
1521
-		} elseif ($direction >= 135 && $direction < 157.5){
1521
+		} elseif ($direction >= 135 && $direction < 157.5) {
1522 1522
 			$temp_array['direction_degree'] = $direction;
1523 1523
 			$temp_array['direction_shortname'] = "SE";
1524 1524
 			$temp_array['direction_fullname'] = "Southeast";
1525
-		} elseif ($direction >= 157.5 && $direction < 180){
1525
+		} elseif ($direction >= 157.5 && $direction < 180) {
1526 1526
 			$temp_array['direction_degree'] = $direction;
1527 1527
 			$temp_array['direction_shortname'] = "SSE";
1528 1528
 			$temp_array['direction_fullname'] = "South-Southeast";
1529
-		} elseif ($direction >= 180 && $direction < 202.5){
1529
+		} elseif ($direction >= 180 && $direction < 202.5) {
1530 1530
 			$temp_array['direction_degree'] = $direction;
1531 1531
 			$temp_array['direction_shortname'] = "S";
1532 1532
 			$temp_array['direction_fullname'] = "South";
1533
-		} elseif ($direction >= 202.5 && $direction < 225){
1533
+		} elseif ($direction >= 202.5 && $direction < 225) {
1534 1534
 			$temp_array['direction_degree'] = $direction;
1535 1535
 			$temp_array['direction_shortname'] = "SSW";
1536 1536
 			$temp_array['direction_fullname'] = "South-Southwest";
1537
-		} elseif ($direction >= 225 && $direction < 247.5){
1537
+		} elseif ($direction >= 225 && $direction < 247.5) {
1538 1538
 			$temp_array['direction_degree'] = $direction;
1539 1539
 			$temp_array['direction_shortname'] = "SW";
1540 1540
 			$temp_array['direction_fullname'] = "Southwest";
1541
-		} elseif ($direction >= 247.5 && $direction < 270){
1541
+		} elseif ($direction >= 247.5 && $direction < 270) {
1542 1542
 			$temp_array['direction_degree'] = $direction;
1543 1543
 			$temp_array['direction_shortname'] = "WSW";
1544 1544
 			$temp_array['direction_fullname'] = "West-Southwest";
1545
-		} elseif ($direction >= 270 && $direction < 292.5){
1545
+		} elseif ($direction >= 270 && $direction < 292.5) {
1546 1546
 			$temp_array['direction_degree'] = $direction;
1547 1547
 			$temp_array['direction_shortname'] = "W";
1548 1548
 			$temp_array['direction_fullname'] = "West";
1549
-		} elseif ($direction >= 292.5 && $direction < 315){
1549
+		} elseif ($direction >= 292.5 && $direction < 315) {
1550 1550
 			$temp_array['direction_degree'] = $direction;
1551 1551
 			$temp_array['direction_shortname'] = "WNW";
1552 1552
 			$temp_array['direction_fullname'] = "West-Northwest";
1553
-		} elseif ($direction >= 315 && $direction < 337.5){
1553
+		} elseif ($direction >= 315 && $direction < 337.5) {
1554 1554
 			$temp_array['direction_degree'] = $direction;
1555 1555
 			$temp_array['direction_shortname'] = "NW";
1556 1556
 			$temp_array['direction_fullname'] = "Northwest";
1557
-		} elseif ($direction >= 337.5 && $direction < 360){
1557
+		} elseif ($direction >= 337.5 && $direction < 360) {
1558 1558
 			$temp_array['direction_degree'] = $direction;
1559 1559
 			$temp_array['direction_shortname'] = "NNW";
1560 1560
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -1571,11 +1571,11 @@  discard block
 block discarded – undo
1571 1571
 	* @param Float $longitude longitute of the flight
1572 1572
 	* @return String the countrie
1573 1573
 	*/
1574
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1574
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
1575 1575
 	{
1576 1576
 		global $globalDBdriver, $globalDebug;
1577
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1578
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1577
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1578
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1579 1579
 	
1580 1580
 		$Connection = new Connection($this->db);
1581 1581
 		if (!$Connection->tableExists('countries')) return '';
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 	public function getCountryFromISO2($iso2)
1616 1616
 	{
1617 1617
 		global $globalDBdriver, $globalDebug;
1618
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1618
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
1619 1619
 	
1620 1620
 		$Connection = new Connection($this->db);
1621 1621
 		if (!$Connection->tableExists('countries')) return '';
@@ -1644,11 +1644,11 @@  discard block
 block discarded – undo
1644 1644
 	* @return Array the vessel type list
1645 1645
 	*
1646 1646
 	*/
1647
-	public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1647
+	public function countAllTrackerTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
1648 1648
 	{
1649 1649
 		global $globalDBdriver;
1650
-		$filter_query = $this->getFilter($filters,true,true);
1651
-		$query  = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count 
1650
+		$filter_query = $this->getFilter($filters, true, true);
1651
+		$query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count 
1652 1652
 		    FROM tracker_output ".$filter_query." tracker_output.type  <> ''";
1653 1653
 		if ($olderthanmonths > 0) {
1654 1654
 			if ($globalDBdriver == 'mysql') {
@@ -1668,28 +1668,28 @@  discard block
 block discarded – undo
1668 1668
 		if ($year != '') {
1669 1669
 			if ($globalDBdriver == 'mysql') {
1670 1670
 				$query .= " AND YEAR(tracker_output.date) = :year";
1671
-				$query_values = array_merge($query_values,array(':year' => $year));
1671
+				$query_values = array_merge($query_values, array(':year' => $year));
1672 1672
 			} else {
1673 1673
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1674
-				$query_values = array_merge($query_values,array(':year' => $year));
1674
+				$query_values = array_merge($query_values, array(':year' => $year));
1675 1675
 			}
1676 1676
 		}
1677 1677
 		if ($month != '') {
1678 1678
 			if ($globalDBdriver == 'mysql') {
1679 1679
 				$query .= " AND MONTH(tracker_output.date) = :month";
1680
-				$query_values = array_merge($query_values,array(':month' => $month));
1680
+				$query_values = array_merge($query_values, array(':month' => $month));
1681 1681
 			} else {
1682 1682
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1683
-				$query_values = array_merge($query_values,array(':month' => $month));
1683
+				$query_values = array_merge($query_values, array(':month' => $month));
1684 1684
 			}
1685 1685
 		}
1686 1686
 		if ($day != '') {
1687 1687
 			if ($globalDBdriver == 'mysql') {
1688 1688
 				$query .= " AND DAY(tracker_output.date) = :day";
1689
-				$query_values = array_merge($query_values,array(':day' => $day));
1689
+				$query_values = array_merge($query_values, array(':day' => $day));
1690 1690
 			} else {
1691 1691
 				$query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day";
1692
-				$query_values = array_merge($query_values,array(':day' => $day));
1692
+				$query_values = array_merge($query_values, array(':day' => $day));
1693 1693
 			}
1694 1694
 		}
1695 1695
 		$query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC";
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 		$sth->execute($query_values);
1699 1699
 		$tracker_array = array();
1700 1700
 		$temp_array = array();
1701
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1701
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1702 1702
 		{
1703 1703
 			$temp_array['tracker_type'] = $row['tracker_type'];
1704 1704
 			$temp_array['tracker_type_count'] = $row['tracker_type_count'];
@@ -1713,13 +1713,13 @@  discard block
 block discarded – undo
1713 1713
 	* @return Array the tracker information
1714 1714
 	*
1715 1715
 	*/
1716
-	public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1716
+	public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
1717 1717
 	{
1718 1718
 		global $globalTimezone, $globalDBdriver;
1719 1719
 		date_default_timezone_set('UTC');
1720 1720
 		$query_values = array();
1721 1721
 		$additional_query = '';
1722
-		$filter_query = $this->getFilter($filters,true,true);
1722
+		$filter_query = $this->getFilter($filters, true, true);
1723 1723
 		if ($q != "")
1724 1724
 		{
1725 1725
 			if (!is_string($q))
@@ -1727,8 +1727,8 @@  discard block
 block discarded – undo
1727 1727
 				return false;
1728 1728
 			} else {
1729 1729
 				$q_array = explode(" ", $q);
1730
-				foreach ($q_array as $q_item){
1731
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
1730
+				foreach ($q_array as $q_item) {
1731
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
1732 1732
 					$additional_query .= " AND (";
1733 1733
 					if (is_int($q_item)) $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR ";
1734 1734
 					$additional_query .= "(tracker_output.ident like '%".$q_item."%') OR ";
@@ -1738,20 +1738,20 @@  discard block
 block discarded – undo
1738 1738
 		}
1739 1739
 		if ($callsign != "")
1740 1740
 		{
1741
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
1741
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
1742 1742
 			if (!is_string($callsign))
1743 1743
 			{
1744 1744
 				return false;
1745 1745
 			} else {
1746 1746
 				$additional_query .= " AND tracker_output.ident = :callsign";
1747
-				$query_values = array_merge($query_values,array(':callsign' => $callsign));
1747
+				$query_values = array_merge($query_values, array(':callsign' => $callsign));
1748 1748
 			}
1749 1749
 		}
1750 1750
 		if ($date_posted != "")
1751 1751
 		{
1752 1752
 			$date_array = explode(",", $date_posted);
1753
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
1754
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
1753
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
1754
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
1755 1755
 			if ($globalTimezone != '') {
1756 1756
 				date_default_timezone_set($globalTimezone);
1757 1757
 				$datetime = new DateTime();
@@ -1778,8 +1778,8 @@  discard block
 block discarded – undo
1778 1778
 		if ($limit != "")
1779 1779
 		{
1780 1780
 			$limit_array = explode(",", $limit);
1781
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1782
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1781
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1782
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1783 1783
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1784 1784
 			{
1785 1785
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
@@ -1797,22 +1797,22 @@  discard block
 block discarded – undo
1797 1797
 			}
1798 1798
 		}
1799 1799
 		if ($origLat != "" && $origLon != "" && $dist != "") {
1800
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
1800
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
1801 1801
 			if ($globalDBdriver == 'mysql') {
1802
-				$query="SELECT tracker_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - tracker_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(tracker_archive.latitude*pi()/180)*POWER(SIN(($origLon-tracker_archive.longitude)*pi()/180/2),2))) as distance 
1802
+				$query = "SELECT tracker_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - tracker_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(tracker_archive.latitude*pi()/180)*POWER(SIN(($origLon-tracker_archive.longitude)*pi()/180/2),2))) as distance 
1803 1803
 				    FROM tracker_archive,tracker_output".$filter_query." tracker_output.famtrackid = tracker_archive.famtrackid AND tracker_output.ident <> '' ".$additional_query."AND tracker_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and tracker_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
1804 1804
 				    AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - tracker_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(tracker_archive.latitude*pi()/180)*POWER(SIN(($origLon-tracker_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
1805 1805
 			} else {
1806
-				$query="SELECT tracker_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(tracker_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(tracker_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance 
1806
+				$query = "SELECT tracker_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(tracker_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(tracker_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance 
1807 1807
 				    FROM tracker_archive,tracker_output".$filter_query." tracker_output.famtrackid = tracker_archive.famtrackid AND tracker_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
1808 1808
 				    AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(tracker_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(tracker_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
1809 1809
 			}
1810 1810
 		} else {
1811
-			$query  = "SELECT tracker_output.* FROM tracker_output".$filter_query." tracker_output.ident <> '' 
1811
+			$query = "SELECT tracker_output.* FROM tracker_output".$filter_query." tracker_output.ident <> '' 
1812 1812
 			    ".$additional_query."
1813 1813
 			    ".$orderby_query;
1814 1814
 		}
1815
-		$tracker_array = $this->getDataFromDB($query, $query_values,$limit_query);
1815
+		$tracker_array = $this->getDataFromDB($query, $query_values, $limit_query);
1816 1816
 		return $tracker_array;
1817 1817
 	}
1818 1818
 
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
 		curl_close($ch);
1838 1838
 		$bitly_data = json_decode($bitly_data);
1839 1839
 		$bitly_url = '';
1840
-		if ($bitly_data->status_txt = "OK"){
1840
+		if ($bitly_data->status_txt = "OK") {
1841 1841
 			$bitly_url = $bitly_data->data->url;
1842 1842
 		}
1843 1843
 		return $bitly_url;
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
 
1846 1846
 	public function getOrderBy()
1847 1847
 	{
1848
-		$orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY tracker_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY tracker_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
1848
+		$orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY tracker_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY tracker_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
1849 1849
 		
1850 1850
 		return $orderby;
1851 1851
 		
Please login to merge, or discard this patch.
search.php 3 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -91,28 +91,28 @@
 block discarded – undo
91 91
 $limit_previous_2 = $limit_end - $absolute_difference;
92 92
 
93 93
 if (
94
-    (isset($_GET['q']) && $_GET['q'] != '') || 
95
-    (isset($_GET['registration']) && $_GET['registration'] != '') || 
96
-    (isset($_GET['aircraft']) && $_GET['aircraft'] != '') ||
97
-    (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') ||
98
-    (isset($_GET['highlights']) && $_GET['highlights'] != '') ||
99
-    (isset($_GET['airline']) && $_GET['airline'] != '') ||
100
-    (isset($_GET['airline_country']) && $_GET['airline_country'] != '') ||
101
-    (isset($_GET['airline_type']) && $_GET['airline_type'] != '') ||
102
-    (isset($_GET['airport']) && $_GET['airport'] != '') ||
103
-    (isset($_GET['airport_country']) && $_GET['airport_country'] != '') ||
104
-    (isset($_GET['callsign']) && $_GET['callsign'] != '') ||
105
-    (isset($_GET['owner']) && $_GET['owner'] != '') ||
106
-    (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') ||
107
-    (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') ||
108
-    (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') ||
109
-    (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') ||
110
-    (isset($_GET['mmsi']) && $_GET['mmsi'] != '') ||
111
-    (isset($_GET['imo']) && $_GET['imo'] != '') ||
112
-    ((isset($_GET['origlat']) && $_GET['origlat'] != '') &&
113
-    (isset($_GET['origlon']) && $_GET['origlon'] != '') &&
114
-    (isset($_GET['dist']) && $_GET['dist'] != ''))
115
-    ){  
94
+	(isset($_GET['q']) && $_GET['q'] != '') || 
95
+	(isset($_GET['registration']) && $_GET['registration'] != '') || 
96
+	(isset($_GET['aircraft']) && $_GET['aircraft'] != '') ||
97
+	(isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') ||
98
+	(isset($_GET['highlights']) && $_GET['highlights'] != '') ||
99
+	(isset($_GET['airline']) && $_GET['airline'] != '') ||
100
+	(isset($_GET['airline_country']) && $_GET['airline_country'] != '') ||
101
+	(isset($_GET['airline_type']) && $_GET['airline_type'] != '') ||
102
+	(isset($_GET['airport']) && $_GET['airport'] != '') ||
103
+	(isset($_GET['airport_country']) && $_GET['airport_country'] != '') ||
104
+	(isset($_GET['callsign']) && $_GET['callsign'] != '') ||
105
+	(isset($_GET['owner']) && $_GET['owner'] != '') ||
106
+	(isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') ||
107
+	(isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') ||
108
+	(isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') ||
109
+	(isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') ||
110
+	(isset($_GET['mmsi']) && $_GET['mmsi'] != '') ||
111
+	(isset($_GET['imo']) && $_GET['imo'] != '') ||
112
+	((isset($_GET['origlat']) && $_GET['origlat'] != '') &&
113
+	(isset($_GET['origlon']) && $_GET['origlon'] != '') &&
114
+	(isset($_GET['dist']) && $_GET['dist'] != ''))
115
+	){  
116 116
 	$q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING);
117 117
 	$registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING);
118 118
 	$aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
 $sql_date = '';
27 27
 if (isset($_GET['start_date'])) {
28 28
 	//for the date manipulation into the query
29
-	if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
29
+	if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
30 30
 		if (strtotime($_GET['start_date']) !== false && strtotime($_GET['end_date']) !== false) {
31 31
 			//$start_date = $_GET['start_date']." 00:00:00";
32
-			$start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00";
32
+			$start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00";
33 33
 			//$end_date = $_GET['end_date']." 00:00:00";
34
-			$end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
34
+			$end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00";
35 35
 			$sql_date = $start_date.",".$end_date;
36 36
 		}
37
-	} else if($_GET['start_date'] != ""){
37
+	} else if ($_GET['start_date'] != "") {
38 38
 		if (strtotime($_GET['start_date']) !== false) {
39 39
 			//$start_date = $_GET['start_date']." 00:00:00";
40
-			$start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00";
40
+			$start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00";
41 41
 			$sql_date = $start_date;
42 42
 		}
43
-	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
43
+	} else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
44 44
 		if (strtotime($_GET['end_date']) !== false) {
45 45
 			//$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00";
46
-			$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
46
+			$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00";
47 47
 			$sql_date = $end_date;
48 48
 		}
49 49
 	} else $sql_date = '';
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 if (isset($_GET['highest_altitude'])) {
53 53
 	//for altitude manipulation
54
-	if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
55
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
56
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT);
54
+	if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
55
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
56
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT);
57 57
 		$sql_altitude = $start_altitude.",".$end_altitude;
58
-	} else if($_GET['highest_altitude'] != ""){
59
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
58
+	} else if ($_GET['highest_altitude'] != "") {
59
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
60 60
 		$sql_altitude = $end_altitude;
61
-	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
62
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
61
+	} else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
62
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000";
63 63
 		$sql_altitude = $start_altitude;
64 64
 	} else $sql_altitude = '';
65 65
 } else $sql_altitude = '';
66 66
 
67 67
 //calculuation for the pagination
68
-if(!isset($_GET['limit']))
68
+if (!isset($_GET['limit']))
69 69
 {
70 70
 	if (!isset($_GET['number_results']))
71 71
 	{
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 		$limit_end = 25;
74 74
 		$absolute_difference = 25;
75 75
 	} else {
76
-		if ($_GET['number_results'] > 1000){
76
+		if ($_GET['number_results'] > 1000) {
77 77
 			$_GET['number_results'] = 1000;
78 78
 		}
79 79
 		$limit_start = 0;
80
-		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
81
-		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
80
+		$limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
81
+		$absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
82 82
 	}
83
-}  else {
83
+} else {
84 84
 	$limit_explode = explode(",", $_GET['limit']);
85
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
86
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
85
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
86
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
87 87
 }
88 88
 $absolute_difference = abs($limit_start - $limit_end);
89 89
 $limit_next = $limit_end + $absolute_difference;
@@ -112,31 +112,31 @@  discard block
 block discarded – undo
112 112
     ((isset($_GET['origlat']) && $_GET['origlat'] != '') &&
113 113
     (isset($_GET['origlon']) && $_GET['origlon'] != '') &&
114 114
     (isset($_GET['dist']) && $_GET['dist'] != ''))
115
-    ){  
116
-	$q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING);
117
-	$registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING);
118
-	$aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING);
119
-	$manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING);
120
-	$highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING);
121
-	$airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING);
122
-	$airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING);
123
-	$airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING);
124
-	$airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING);
125
-	$airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING);
126
-	$callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING);
127
-	$owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING);
128
-	$pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING);
129
-	$pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING);
130
-	$mmsi = filter_input(INPUT_GET, 'mmsi',FILTER_SANITIZE_NUMBER_INT);
131
-	$imo = filter_input(INPUT_GET, 'imo',FILTER_SANITIZE_NUMBER_INT);
132
-	$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING);
133
-	$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING);
134
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
135
-	$archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT);
136
-	$origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_NUMBER_FLOAT);
137
-	$origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT);
138
-	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
139
-	$number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
115
+    ) {  
116
+	$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
117
+	$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
118
+	$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
119
+	$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
120
+	$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
121
+	$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
122
+	$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
123
+	$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
124
+	$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
125
+	$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
126
+	$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
127
+	$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
128
+	$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
129
+	$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
130
+	$mmsi = filter_input(INPUT_GET, 'mmsi', FILTER_SANITIZE_NUMBER_INT);
131
+	$imo = filter_input(INPUT_GET, 'imo', FILTER_SANITIZE_NUMBER_INT);
132
+	$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
133
+	$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
134
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
135
+	$archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT);
136
+	$origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_NUMBER_FLOAT);
137
+	$origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_NUMBER_FLOAT);
138
+	$dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT);
139
+	$number_results = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
140 140
 	if ($dist != '') {
141 141
 		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
142 142
 		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	if ($archive == 1) {
146 146
 		if ($type == 'aircraft') {
147 147
 			$SpotterArchive = new SpotterArchive();
148
-			$spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
148
+			$spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
149 149
 		}
150 150
 	} else {
151 151
 		if ($type == 'aircraft') {
152
-			$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
152
+			$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
153 153
 		} elseif ($type == 'tracker') {
154
-			$spotter_array = $Tracker->searchTrackerData($q,$callsign,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
154
+			$spotter_array = $Tracker->searchTrackerData($q, $callsign, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
155 155
 		} elseif ($type == 'marine') {
156
-			$spotter_array = $Marine->searchMarineData($q,$callsign,$mmsi,$imo,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
156
+			$spotter_array = $Marine->searchMarineData($q, $callsign, $mmsi, $imo, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
157 157
 		}
158 158
 	}
159 159
 	 
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
 	//remove 3D=true parameter
190 190
 	$no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']);
191 191
 	$kmlURL = str_replace("http://", "kml://", $globalURL);
192
-	if (!isset($_GET['3D'])){
192
+	if (!isset($_GET['3D'])) {
193 193
 		print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>';
194 194
 	} else {
195 195
 		print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>';
196 196
 	}
197
-	if (isset($_GET['3D'])){
197
+	if (isset($_GET['3D'])) {
198 198
 		print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>';
199 199
 	} else {
200 200
 		print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>';
@@ -215,32 +215,32 @@  discard block
 block discarded – undo
215 215
 		print '<div class="column">';
216 216
 		print '<div class="info">';
217 217
 		print '<h1>'._("Search Results for").' ';
218
-		if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; }
219
-		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
220
-		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
221
-		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
222
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
223
-		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
224
-		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
225
-		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
226
-		if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; }
227
-		if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; }
228
-		if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; }
229
-		if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; }
230
-		if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; }
231
-		if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; }
232
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; }
233
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; }
234
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; }
235
-		if (isset($_GET['mmsi']) && $_GET['mmsi'] != ""){ print _("MMSI:").' <span>'.$mmsi.'</span> '; }
236
-		if (isset($_GET['imo']) && $_GET['imo'] != ""){ print _("IMO:").' <span>'.$imo.'</span> '; }
237
-		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; }
238
-		if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; }
239
-		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; }
240
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; }
241
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; }
242
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; }
243
-		if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; }
218
+		if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; }
219
+		if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
220
+		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
221
+		if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; }
222
+		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; }
223
+		if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; }
224
+		if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; }
225
+		if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; }
226
+		if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; }
227
+		if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; }
228
+		if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; }
229
+		if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; }
230
+		if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; }
231
+		if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; }
232
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; }
233
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; }
234
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; }
235
+		if (isset($_GET['mmsi']) && $_GET['mmsi'] != "") { print _("MMSI:").' <span>'.$mmsi.'</span> '; }
236
+		if (isset($_GET['imo']) && $_GET['imo'] != "") { print _("IMO:").' <span>'.$imo.'</span> '; }
237
+		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; }
238
+		if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; }
239
+		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; }
240
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; }
241
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; }
242
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; }
243
+		if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; }
244 244
 		print '</h1>';
245 245
 		print '</div>';
246 246
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 					    </select>
375 375
 					</div>
376 376
 				</div>
377
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
377
+				<script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
378 378
 				<div class="form-group">
379 379
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
380 380
 						<div class="col-sm-10">
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 							</select>
384 384
 						</div>
385 385
 				</div>
386
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
386
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
387 387
 				<div class="form-group">
388 388
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
389 389
 					<div class="col-sm-10">
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 					</div>
407 407
 				</div>
408 408
 <?php
409
-	}else {
409
+	} else {
410 410
 ?>
411 411
 				<div class="form-group">
412 412
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 ?>
420 420
 				<div class="form-group">
421 421
 					<div class="col-sm-offset-2 col-sm-10">
422
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
423
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
422
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
423
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
424 424
 					</div>
425 425
 				</div>
426 426
 			</fieldset>
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 						</select>
435 435
 					</div>
436 436
 				</div>
437
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
437
+				<script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script>
438 438
 				<div class="form-group">
439 439
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
440 440
 					<div class="col-sm-10">
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 						</select>
444 444
 					</div>
445 445
 				</div>
446
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
446
+				<script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script>
447 447
 				<div class="form-group">
448 448
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
449 449
 					<div class="col-sm-10">
@@ -452,10 +452,10 @@  discard block
 block discarded – undo
452 452
 				</div>
453 453
 				<div class="form-group">
454 454
 					<div class="col-sm-offset-2 col-sm-10">
455
-						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
456
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
457
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
458
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
455
+						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
456
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
457
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
458
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
459 459
 					</div>
460 460
 				</div>
461 461
 			</fieldset>
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 						</select>
470 470
 					</div>
471 471
 				</div>
472
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
472
+				<script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
473 473
 				<div class="form-group">
474 474
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
475 475
 					<div class="col-sm-10">
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 						</select>
479 479
 					</div>
480 480
 				</div>
481
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
481
+				<script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script>
482 482
 			</fieldset>
483 483
 			<fieldset>
484 484
 				<legend><?php echo _("Route"); ?></legend>
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 						</select>
491 491
 					</div>
492 492
 				</div>
493
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
493
+				<script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
494 494
 				<div class="form-group">
495 495
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
496 496
 					<div class="col-sm-10">
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 						</select>
500 500
 					</div>
501 501
 				</div>
502
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
502
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
503 503
 			</fieldset>
504 504
 			<fieldset>
505 505
 				<legend>Altitude</legend>
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
 							<option></option>
511 511
 <?php
512 512
 $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000);
513
-foreach($altitude_array as $altitude)
513
+foreach ($altitude_array as $altitude)
514 514
 {
515
-	if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude)
515
+	if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude)
516 516
 	{
517 517
 		print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>';
518 518
 	} else {
@@ -530,9 +530,9 @@  discard block
 block discarded – undo
530 530
 							<option></option>
531 531
 <?php
532 532
 	$altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000);
533
-	foreach($altitude_array as $altitude)
533
+	foreach ($altitude_array as $altitude)
534 534
 	{
535
-		if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude)
535
+		if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude)
536 536
 		{
537 537
 			print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>';
538 538
 		} else {
@@ -655,10 +655,10 @@  discard block
 block discarded – undo
655 655
 				<div class="col-sm-10">
656 656
 					<select class="form-control" name="number_results">
657 657
 <?php
658
-$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500,  600, 700, 800, 900, 1000);
659
-foreach($number_results_array as $number)
658
+$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000);
659
+foreach ($number_results_array as $number)
660 660
 {
661
-	if(isset($_GET['number_results']) && $_GET['number_results'] == $number)
661
+	if (isset($_GET['number_results']) && $_GET['number_results'] == $number)
662 662
 	{
663 663
 		print '<option value="'.$number.'" selected="selected">'.$number.'</option>';
664 664
 	} else {
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		<fieldset>
678 678
 			<div class="form-group">
679 679
 				<div class="col-sm-offset-2 col-sm-10">
680
-					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label>
680
+					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label>
681 681
 					<p class="help-block">Disabled in demo</p>
682 682
 				</div>
683 683
 			</div>
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		<fieldset>
689 689
 			<div class="form-group">
690 690
 				<div class="col-sm-offset-2 col-sm-10">
691
-					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label>
691
+					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label>
692 692
 				</div>
693 693
 			</div>
694 694
 		</fieldset>
Please login to merge, or discard this patch.
Braces   +142 added lines, -39 removed lines patch added patch discarded remove patch
@@ -46,8 +46,10 @@  discard block
 block discarded – undo
46 46
 			$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
47 47
 			$sql_date = $end_date;
48 48
 		}
49
-	} else $sql_date = '';
50
-}
49
+	} else {
50
+		$sql_date = '';
51
+	}
52
+	}
51 53
 
52 54
 if (isset($_GET['highest_altitude'])) {
53 55
 	//for altitude manipulation
@@ -61,8 +63,12 @@  discard block
 block discarded – undo
61 63
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
62 64
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
63 65
 		$sql_altitude = $start_altitude;
64
-	} else $sql_altitude = '';
65
-} else $sql_altitude = '';
66
+	} else {
67
+		$sql_altitude = '';
68
+	}
69
+	} else {
70
+	$sql_altitude = '';
71
+}
66 72
 
67 73
 //calculuation for the pagination
68 74
 if(!isset($_GET['limit']))
@@ -80,7 +86,7 @@  discard block
 block discarded – undo
80 86
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
81 87
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
82 88
 	}
83
-}  else {
89
+} else {
84 90
 	$limit_explode = explode(",", $_GET['limit']);
85 91
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
86 92
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -138,10 +144,15 @@  discard block
 block discarded – undo
138 144
 	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
139 145
 	$number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
140 146
 	if ($dist != '') {
141
-		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
142
-		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
147
+		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') {
148
+			$dist = $dist*1.60934;
149
+		} elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') {
150
+			$dist = $dist*1.852;
151
+		}
152
+	}
153
+	if (!isset($sql_date)) {
154
+		$sql_date = '';
143 155
 	}
144
-	if (!isset($sql_date)) $sql_date = '';
145 156
 	if ($archive == 1) {
146 157
 		if ($type == 'aircraft') {
147 158
 			$SpotterArchive = new SpotterArchive();
@@ -219,7 +230,10 @@  discard block
 block discarded – undo
219 230
 		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
220 231
 		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
221 232
 		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
222
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
233
+		if (isset($_GET['highlights'])) {
234
+			if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> ';
235
+		}
236
+		}
223 237
 		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
224 238
 		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
225 239
 		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
@@ -355,7 +369,10 @@  discard block
 block discarded – undo
355 369
 			<div class="form-group">
356 370
 				<label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label>
357 371
 				<div class="col-sm-10">
358
-					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
372
+					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) {
373
+	print $q;
374
+}
375
+?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
359 376
 				</div>
360 377
 			</div>
361 378
 		</fieldset>
@@ -374,7 +391,10 @@  discard block
 block discarded – undo
374 391
 					    </select>
375 392
 					</div>
376 393
 				</div>
377
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
394
+				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) {
395
+	print $manufacturer;
396
+}
397
+?>')</script>
378 398
 				<div class="form-group">
379 399
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
380 400
 						<div class="col-sm-10">
@@ -383,11 +403,17 @@  discard block
 block discarded – undo
383 403
 							</select>
384 404
 						</div>
385 405
 				</div>
386
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
406
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) {
407
+	print $aircraft_icao;
408
+}
409
+?>');</script>
387 410
 				<div class="form-group">
388 411
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
389 412
 					<div class="col-sm-10">
390
-						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
413
+						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) {
414
+	print $registration;
415
+}
416
+?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
391 417
 					</div>
392 418
 				</div>
393 419
 <?php
@@ -396,22 +422,31 @@  discard block
 block discarded – undo
396 422
 				<div class="form-group">
397 423
 					<label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> 
398 424
 					<div class="col-sm-10">
399
-						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
425
+						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) {
426
+	print $pilot_id;
427
+}
428
+?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
400 429
 					</div>
401 430
 				</div>
402 431
 				<div class="form-group">
403 432
 					<label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> 
404 433
 					<div class="col-sm-10">
405
-						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
434
+						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) {
435
+	print $pilot_name;
436
+}
437
+?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
406 438
 					</div>
407 439
 				</div>
408 440
 <?php
409
-	}else {
441
+	} else {
410 442
 ?>
411 443
 				<div class="form-group">
412 444
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
413 445
 					<div class="col-sm-10">
414
-						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
446
+						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) {
447
+	print $owner;
448
+}
449
+?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
415 450
 					</div>
416 451
 				</div>
417 452
 <?php
@@ -419,8 +454,14 @@  discard block
 block discarded – undo
419 454
 ?>
420 455
 				<div class="form-group">
421 456
 					<div class="col-sm-offset-2 col-sm-10">
422
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
423
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
457
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
458
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
459
+}
460
+} ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
461
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
462
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
463
+}
464
+} ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
424 465
 					</div>
425 466
 				</div>
426 467
 			</fieldset>
@@ -434,7 +475,10 @@  discard block
 block discarded – undo
434 475
 						</select>
435 476
 					</div>
436 477
 				</div>
437
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
478
+				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) {
479
+	print $airline;
480
+}
481
+?>');</script>
438 482
 				<div class="form-group">
439 483
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
440 484
 					<div class="col-sm-10">
@@ -443,19 +487,34 @@  discard block
 block discarded – undo
443 487
 						</select>
444 488
 					</div>
445 489
 				</div>
446
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
490
+				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) {
491
+	print $airline_country;
492
+}
493
+?>');</script>
447 494
 				<div class="form-group">
448 495
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
449 496
 					<div class="col-sm-10">
450
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
497
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
498
+	print $callsign;
499
+}
500
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
451 501
 					</div>
452 502
 				</div>
453 503
 				<div class="form-group">
454 504
 					<div class="col-sm-offset-2 col-sm-10">
455 505
 						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
456
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
457
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
458
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
506
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) {
507
+	if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"';
508
+}
509
+} ?>> <?php echo _("Only Passenger airlines"); ?></label>
510
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) {
511
+	if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"';
512
+}
513
+} ?>> <?php echo _("Only Cargo airlines"); ?></label>
514
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) {
515
+	if ( $_GET['airline_type'] == "military"){ print 'checked="checked"';
516
+}
517
+} ?>> <?php echo _("Only Military airlines"); ?></label>
459 518
 					</div>
460 519
 				</div>
461 520
 			</fieldset>
@@ -469,7 +528,10 @@  discard block
 block discarded – undo
469 528
 						</select>
470 529
 					</div>
471 530
 				</div>
472
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
531
+				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) {
532
+	print $airport_icao;
533
+}
534
+?>');</script>
473 535
 				<div class="form-group">
474 536
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
475 537
 					<div class="col-sm-10">
@@ -478,7 +540,10 @@  discard block
 block discarded – undo
478 540
 						</select>
479 541
 					</div>
480 542
 				</div>
481
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
543
+				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) {
544
+	print $airport_country;
545
+}
546
+?>');</script>
482 547
 			</fieldset>
483 548
 			<fieldset>
484 549
 				<legend><?php echo _("Route"); ?></legend>
@@ -490,7 +555,10 @@  discard block
 block discarded – undo
490 555
 						</select>
491 556
 					</div>
492 557
 				</div>
493
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
558
+				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) {
559
+	print $departure_airport_route;
560
+}
561
+?>');</script>
494 562
 				<div class="form-group">
495 563
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
496 564
 					<div class="col-sm-10">
@@ -499,7 +567,10 @@  discard block
 block discarded – undo
499 567
 						</select>
500 568
 					</div>
501 569
 				</div>
502
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
570
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) {
571
+	print $arrival_airport_route;
572
+}
573
+?>');</script>
503 574
 			</fieldset>
504 575
 			<fieldset>
505 576
 				<legend>Altitude</legend>
@@ -549,19 +620,33 @@  discard block
 block discarded – undo
549 620
 				<div class="form-group">
550 621
 					<label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label>
551 622
 					<div class="col-sm-10">
552
-						<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" />
623
+						<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) {
624
+	print $origlat;
625
+}
626
+?>" />
553 627
 					</div>
554 628
 				</div>
555 629
 				<div class="form-group">
556 630
 					<label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label>
557 631
 					<div class="col-sm-10">
558
-						<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" />
632
+						<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) {
633
+	print $origlon;
634
+}
635
+?>" />
559 636
 					</div>
560 637
 				</div>
561 638
 				<div class="form-group">
562
-					<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label>
639
+					<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) {
640
+	print $globalDistanceUnit;
641
+} else {
642
+	print 'km';
643
+}
644
+print ')'; ?></label>
563 645
 					<div class="col-sm-10">
564
-						<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" />
646
+						<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) {
647
+	print $distance;
648
+}
649
+?>" />
565 650
 					</div>
566 651
 				</div>
567 652
 			</fieldset>
@@ -572,7 +657,10 @@  discard block
 block discarded – undo
572 657
 				<div class="form-group">
573 658
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
574 659
 					<div class="col-sm-10">
575
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
660
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
661
+	print $callsign;
662
+}
663
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
576 664
 					</div>
577 665
 				</div>
578 666
 			</fieldset>
@@ -583,7 +671,10 @@  discard block
 block discarded – undo
583 671
 				<div class="form-group">
584 672
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
585 673
 					<div class="col-sm-10">
586
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
674
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
675
+	print $callsign;
676
+}
677
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
587 678
 					</div>
588 679
 				</div>
589 680
 			</fieldset>
@@ -591,7 +682,10 @@  discard block
 block discarded – undo
591 682
 				<div class="form-group">
592 683
 					<label class="control-label col-sm-2"><?php echo _("MMSI"); ?></label> 
593 684
 					<div class="col-sm-10">
594
-						<input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) print $mmsi; ?>" size="8" placeholder="<?php echo _("MMSI"); ?>" />
685
+						<input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) {
686
+	print $mmsi;
687
+}
688
+?>" size="8" placeholder="<?php echo _("MMSI"); ?>" />
595 689
 					</div>
596 690
 				</div>
597 691
 			</fieldset>
@@ -599,7 +693,10 @@  discard block
 block discarded – undo
599 693
 				<div class="form-group">
600 694
 					<label class="control-label col-sm-2"><?php echo _("IMO"); ?></label> 
601 695
 					<div class="col-sm-10">
602
-						<input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) print $imo; ?>" size="8" placeholder="<?php echo _("IMO"); ?>" />
696
+						<input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) {
697
+	print $imo;
698
+}
699
+?>" size="8" placeholder="<?php echo _("IMO"); ?>" />
603 700
 					</div>
604 701
 				</div>
605 702
 			</fieldset>
@@ -612,7 +709,10 @@  discard block
 block discarded – undo
612 709
 					<label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label>
613 710
 					<div class="col-sm-10">
614 711
 						<div class='input-group date' id='datetimepicker1'>
615
-							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
712
+							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') {
713
+	print $start_date;
714
+}
715
+?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
616 716
 							<span class="input-group-addon">
617 717
 								<span class="glyphicon glyphicon-calendar"></span>
618 718
 							</span>
@@ -623,7 +723,10 @@  discard block
 block discarded – undo
623 723
 					<label class="control-label col-sm-2"><?php echo _("End Date"); ?></label>
624 724
 					<div class="col-sm-10">
625 725
 						<div class='input-group date' id='datetimepicker2'>
626
-						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" />
726
+						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') {
727
+	print $end_date;
728
+}
729
+?>" placeholder="<?php echo _("End Date/Time"); ?>" />
627 730
 						<span class="input-group-addon">
628 731
 							<span class="glyphicon glyphicon-calendar"></span>
629 732
 						</span>
Please login to merge, or discard this patch.
manufacturer-statistics-airline-country.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))));
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
11
+$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING))));
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Airlines by Country from %s"),$manufacturer);
17
+	$title = sprintf(_("Most Common Airlines by Country from %s"), $manufacturer);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
28
+		if ($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Airlines by Country").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 	$airline_array = $Spotter->countAllAirlineCountriesByManufacturer($manufacturer);
49 49
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
50 50
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	print '<div id="chartCountry" class="chart" width="100%"></div><script>';
53 53
 	print 'var series = [';
54 54
 	$country_data = '';
55
-	foreach($airline_array as $airline_item)
55
+	foreach ($airline_array as $airline_item)
56 56
 	{
57 57
 		$country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],';
58 58
 	}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		print '</thead>';
100 100
 		print '<tbody>';
101 101
 		$i = 1;
102
-		foreach($airline_array as $airline_item)
102
+		foreach ($airline_array as $airline_item)
103 103
 		{
104 104
 			print '<tr>';
105 105
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_manufacturer'])) {
7
-        header('Location: '.$globalURL.'/manufacturer');
8
-        die();
7
+		header('Location: '.$globalURL.'/manufacturer');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))));
Please login to merge, or discard this patch.
country-statistics-registration.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['country'])) {
6
-        header('Location: '.$globalURL.'/country');
7
-        die();
6
+		header('Location: '.$globalURL.'/country');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
11
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
10
+$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING))));
11
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
12 12
 if (isset($_GET['sort'])) {
13 13
 	$spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort);
14 14
 } else {
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 if (!empty($spotter_array))
19 19
 {
20
-	$title = sprintf(_("Most Common Aircraft by registration from %s"),$country);
20
+	$title = sprintf(_("Most Common Aircraft by registration from %s"), $country);
21 21
 	require_once('header.php');
22 22
 	print '<div class="select-item">';
23 23
 	print '<form action="'.$globalURL.'/country" method="post">';
24 24
 	print '<select name="country" class="selectpicker" data-live-search="true">';
25 25
 	print '<option></option>';
26 26
 	$all_countries = $Spotter->getAllCountries();
27
-	foreach($all_countries as $all_country)
27
+	foreach ($all_countries as $all_country)
28 28
 	{
29
-		if($country == $all_country['country'])
29
+		if ($country == $all_country['country'])
30 30
 		{
31 31
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
32 32
 		} else {
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	if ($_GET['country'] != "NA")
42 42
 	{
43 43
 		print '<div class="info column">';
44
-		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"),$country).'</h1>';
44
+		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"), $country).'</h1>';
45 45
 		print '</div>';
46 46
 	} else {
47 47
 		print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	include('country-sub-menu.php');
51 51
 	print '<div class="column">';
52 52
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
53
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."),$country).'</p>';
53
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."), $country).'</p>';
54 54
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByCountry($country);
55 55
 	if (!empty($aircraft_array))
56 56
 	{
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		print '</thead>';
66 66
 		print '<tbody>';
67 67
 		$i = 1;
68
-		foreach($aircraft_array as $aircraft_item)
68
+		foreach ($aircraft_array as $aircraft_item)
69 69
 		{
70 70
 			print '<tr>';
71 71
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
registration-sub-menu.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 </span>
16 16
 <div class="sub-menu sub-menu-container">
17 17
 	<ul class="nav nav-pills">
18
-		<li><a href="<?php print $globalURL; ?>/registration/<?php print $_GET['registration']; ?>" <?php if (strtolower($current_page) == "registration-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
18
+		<li><a href="<?php print $globalURL; ?>/registration/<?php print $_GET['registration']; ?>" <?php if (strtolower($current_page) == "registration-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
19 19
 		<li class="dropdown">
20
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "registration-statistics-departure-airport" || strtolower($current_page) == "registration-statistics-departure-airport-country" || strtolower($current_page) == "registration-statistics-arrival-airport" || strtolower($current_page) == "registration-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
20
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "registration-statistics-departure-airport" || strtolower($current_page) == "registration-statistics-departure-airport-country" || strtolower($current_page) == "registration-statistics-arrival-airport" || strtolower($current_page) == "registration-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
21 21
 		      <?php _("Airport"); ?> <span class="caret"></span>
22 22
 		    </a>
23 23
 		    <ul class="dropdown-menu" role="menu">
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			  <li><a href="<?php print $globalURL; ?>/registration/statistics/arrival-airport-country/<?php print $registration; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
28 28
 		    </ul>
29 29
 		</li>
30
-		<li><a href="<?php print $globalURL; ?>/registration/statistics/route/<?php print $registration; ?>" <?php if (strtolower($current_page) == "registration-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
31
-		<li><a href="<?php print $globalURL; ?>/registration/statistics/time/<?php print $registration; ?>" <?php if (strtolower($current_page) == "registration-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
30
+		<li><a href="<?php print $globalURL; ?>/registration/statistics/route/<?php print $registration; ?>" <?php if (strtolower($current_page) == "registration-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
31
+		<li><a href="<?php print $globalURL; ?>/registration/statistics/time/<?php print $registration; ?>" <?php if (strtolower($current_page) == "registration-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
32 32
 	</ul>
33 33
 </div>
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
tv.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -147,18 +147,18 @@
 block discarded – undo
147 147
    
148 148
 <?php
149 149
 	if (isset($_GET['image']) && isset($_GET['q'])) {
150
-	$image = filter_input(INPUT_GET,'image',FILTER_SANITIZE_STRING);
151
-	$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
150
+	$image = filter_input(INPUT_GET, 'image', FILTER_SANITIZE_STRING);
151
+	$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
152 152
 ?>
153 153
    $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&image=<?php print $image; ?>&q=<?php print $q; ?>", function( data ) {
154 154
 <?php
155 155
 	} elseif (isset($_GET['image'])) {
156
-	$image = filter_input(INPUT_GET,'image',FILTER_SANITIZE_STRING);
156
+	$image = filter_input(INPUT_GET, 'image', FILTER_SANITIZE_STRING);
157 157
 ?>
158 158
    $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&image=<?php print $image; ?>", function( data ) {
159 159
 <?php
160 160
 	} elseif (isset($_GET['q'])) {
161
-	$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
161
+	$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
162 162
 ?>
163 163
    $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&q=<?php print $q; ?>", function( data ) {
164 164
 <?php
Please login to merge, or discard this patch.
country-statistics-departure-airport.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 	die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
11
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
10
+$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING))));
11
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
12 12
 
13 13
 if (isset($_GET['sort'])) {
14 14
 	$spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort);
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Departure Airports from %s"),$country);
21
+	$title = sprintf(_("Most Common Departure Airports from %s"), $country);
22 22
 	require_once('header.php');
23 23
 	print '<div class="select-item">';
24 24
 	print '<form action="'.$globalURL.'/country" method="post">';
25 25
 	print '<select name="country" class="selectpicker" data-live-search="true">';
26 26
 	print '<option></option>';
27 27
 	$all_countries = $Spotter->getAllCountries();
28
-	foreach($all_countries as $all_country)
28
+	foreach ($all_countries as $all_country)
29 29
 	{
30
-		if($country == $all_country['country'])
30
+		if ($country == $all_country['country'])
31 31
 		{
32 32
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
33 33
 		} else {
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	if ($_GET['country'] != "NA")
42 42
 	{
43 43
 		print '<div class="info column">';
44
-		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"),$country).'</h1>';
44
+		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"), $country).'</h1>';
45 45
 		print '</div>';
46 46
 	} else {
47 47
 		print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	include('country-sub-menu.php');
51 51
 	print '<div class="column">';
52 52
 	print '<h2>'._("Most Common Departure Airports").'</h2>';
53
-	print '<p>'.sprintf(_("The statistic below shows all departure airports of flights of airports &amp; airlines from <strong>%s</strong>."),$country).'</p>';
53
+	print '<p>'.sprintf(_("The statistic below shows all departure airports of flights of airports &amp; airlines from <strong>%s</strong>."), $country).'</p>';
54 54
 
55 55
 	$airport_airport_array = $Spotter->countAllDepartureAirportsByCountry($country);
56 56
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	print '<script>';
61 61
 	print 'var series = [';
62 62
 	$airport_data = '';
63
-	foreach($airport_airport_array as $airport_item)
63
+	foreach ($airport_airport_array as $airport_item)
64 64
 	{
65 65
 		$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
66 66
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	print '</thead>';
115 115
 	print '<tbody>';
116 116
 	$i = 1;
117
-	foreach($airport_airport_array as $airport_item)
117
+	foreach ($airport_airport_array as $airport_item)
118 118
 	{
119 119
 		print '<tr>';
120 120
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
manufacturer-statistics-aircraft.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))));
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
11
+$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING))));
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Aircraft from %s"),$manufacturer);
17
+	$title = sprintf(_("Most Common Aircraft from %s"), $manufacturer);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
28
+		if ($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Aircraft").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 
49 49
 	$aircraft_array = $Spotter->countAllAircraftTypesByManufacturer($manufacturer);
50 50
 	if (!empty($aircraft_array))
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		print '</thead>';
60 60
 		print '<tbody>';
61 61
 		$i = 1;
62
-		foreach($aircraft_array as $aircraft_item)
62
+		foreach ($aircraft_array as $aircraft_item)
63 63
 		{
64 64
 			print '<tr>';
65 65
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_manufacturer'])) {
7
-        header('Location: '.$globalURL.'/manufacturer');
8
-        die();
7
+		header('Location: '.$globalURL.'/manufacturer');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))));
Please login to merge, or discard this patch.
country-statistics-time.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
11
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
10
+$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING))));
11
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
12 12
 
13 13
 if (isset($_GET['sort'])) {
14 14
 	$spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort);
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Time of Day from %s"),$country);
21
+	$title = sprintf(_("Most Common Time of Day from %s"), $country);
22 22
 	require_once('header.php');
23 23
 	print '<div class="select-item">';
24 24
 	print '<form action="'.$globalURL.'/country" method="post">';
25 25
 	print '<select name="country" class="selectpicker" data-live-search="true">';
26 26
 	print '<option></option>';
27 27
 	$all_countries = $Spotter->getAllCountries();
28
-	foreach($all_countries as $all_country)
28
+	foreach ($all_countries as $all_country)
29 29
 	{
30
-		if($country == $all_country['country'])
30
+		if ($country == $all_country['country'])
31 31
 		{
32 32
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
33 33
 		} else {
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	if ($_GET['country'] != "NA")
43 43
 	{
44 44
 		print '<div class="info column">';
45
-		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"),$country).'</h1>';
45
+		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"), $country).'</h1>';
46 46
 		print '</div>';
47 47
 	} else {
48 48
 		print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	include('country-sub-menu.php');
52 52
 	print '<div class="column">';
53 53
 	print '<h2>'._("Most Common Time of Day").'</h2>';
54
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day of airports &amp; airlines from <strong>%s</strong>."),$country).'</p>';
54
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day of airports &amp; airlines from <strong>%s</strong>."), $country).'</p>';
55 55
 	$hour_array = $Spotter->countAllHoursByCountry($country);
56 56
 	print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
57 57
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	$hour_data = '';
61 61
 	$hour_cnt = '';
62 62
 	$last = 0;
63
-	foreach($hour_array as $hour_item)
63
+	foreach ($hour_array as $hour_item)
64 64
 	{
65
-		while($last != $hour_item['hour_name']) {
65
+		while ($last != $hour_item['hour_name']) {
66 66
 			$hour_data .= '"'.$last.':00",';
67 67
 			$hour_cnt .= '0,';
68 68
 			$last++;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		$hour_cnt .= $hour_item['hour_count'].',';
73 73
 	}
74 74
 	$hour_data = "['x',".substr($hour_data, 0, -1)."]";
75
-	$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
75
+	$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
76 76
 	print 'c3.generate({
77 77
 	    bindto: "#chartHour",
78 78
 	    data: {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		print '</thead>';
98 98
 		print '<tbody>';
99 99
 		$i = 1;
100
-		foreach($hour_array as $hour_item)
100
+		foreach ($hour_array as $hour_item)
101 101
 		{
102 102
 			print '<tr>';
103 103
 			print '<td>'.$hour_item['hour_name'].':00</td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['country'])) {
6
-        header('Location: '.$globalURL.'/country');
7
-        die();
6
+		header('Location: '.$globalURL.'/country');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
Please login to merge, or discard this patch.