Completed
Push — master ( b8bf1c...02faf6 )
by Yannick
10:43
created
airline.php 2 patches
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,13 +24,21 @@  discard block
 block discarded – undo
24 24
 
25 25
 	print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">';
26 26
 	print '<option value="all"';
27
-	if ($airline_type == 'all') print 'selected="selected" ';
27
+	if ($airline_type == 'all') {
28
+		print 'selected="selected" ';
29
+	}
28 30
 	print '>'._("All").'</option><option value="passenger"';
29
-	if ($airline_type == 'passenger') print 'selected="selected" ';
31
+	if ($airline_type == 'passenger') {
32
+		print 'selected="selected" ';
33
+	}
30 34
 	print '>'._("Passenger").'</option><option value="cargo"';
31
-	if ($airline_type == 'cargo') print 'selected="selected" ';
35
+	if ($airline_type == 'cargo') {
36
+		print 'selected="selected" ';
37
+	}
32 38
 	print '>'._("Cargo").'</option><option value="military"';
33
-	if ($airline_type == 'military') print 'selected="selected" ';
39
+	if ($airline_type == 'military') {
40
+		print 'selected="selected" ';
41
+	}
34 42
 	print '>'._("Military").'</option></select>';
35 43
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>';
36 44
 
@@ -57,7 +65,9 @@  discard block
 block discarded – undo
57 65
 		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8');
58 66
 		if($previous !== $firstLetter)
59 67
 		{
60
-			if ($previous !== null) print ' | ';
68
+			if ($previous !== null) {
69
+				print ' | ';
70
+			}
61 71
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
62 72
 		}
63 73
 		$previous = $firstLetter;
@@ -70,7 +80,9 @@  discard block
 block discarded – undo
70 80
 		{
71 81
 			if($previous !== $firstLetter)
72 82
 			{
73
-				if ($previous !== null) print '</div>';
83
+				if ($previous !== null) {
84
+					print '</div>';
85
+				}
74 86
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
75 87
 			}
76 88
 			$previous = $firstLetter;
@@ -82,10 +94,14 @@  discard block
 block discarded – undo
82 94
 			} elseif (@getimagesize('images/airlines/'.$value['airline_icao'].'.png') || @getimagesize($globalURL.'/images/airlines/'.$value['airline_icao'].'.png'))
83 95
 			{
84 96
 				print '<img src="'.$globalURL.'/images/airlines/'.$value['airline_icao'].'.png" alt="'._("Click to see airline activity").'" title="'._("Click to see airline activity").'" /> ';
85
-				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
97
+				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) {
98
+					print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
99
+				}
86 100
 			} else {
87 101
 				print $value['airline_name'];
88
-				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
102
+				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) {
103
+					print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
104
+				}
89 105
 			}
90 106
 			print '</a>';
91 107
 			print '</div>';
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	print '<div class="column">';
16 16
 	print '<h1>'._("Airlines").'</h1>';
17 17
 	if (isset($_POST['airline_type'])) {
18
-		$airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING);
18
+		$airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING);
19 19
 		//$airline_names = $Spotter->getAllAirlineNames($airline_type);
20 20
 	} else {
21 21
 		//$airline_names = $Spotter->getAllAirlineNames();
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	$Stats = new Stats();
38 38
 	if (isset($_POST['airline_type'])) 
39 39
 	{
40
-		$airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING);
40
+		$airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING);
41 41
 		//$airline_names = $Stats->getAllAirlineNames($airline_type);
42 42
 		$airline_names = $Spotter->getAllAirlineNames($airline_type);
43 43
 	} else {
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 	$previous = null;
52 52
 	print '<div class="alphabet-legend">';
53
-	foreach($airline_names as $value) 
53
+	foreach ($airline_names as $value) 
54 54
 	{
55 55
 		//echo $value['airline_name']."\n";
56 56
 		//echo mb_substr($value['airline_name'],0,1).' - '.$value['airline_name']."\n";
57
-		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8');
58
-		if($previous !== $firstLetter)
57
+		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1), 'UTF-8');
58
+		if ($previous !== $firstLetter)
59 59
 		{
60 60
 			if ($previous !== null) print ' | ';
61 61
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	}
65 65
 	print '</div>';
66 66
 	$previous = null;
67
-	foreach($airline_names as $value) {
67
+	foreach ($airline_names as $value) {
68 68
 		$firstLetter = strtoupper(substr($value['airline_name'], 0, 1));
69 69
 		if ($firstLetter != "")
70 70
 		{
71
-			if($previous !== $firstLetter)
71
+			if ($previous !== $firstLetter)
72 72
 			{
73 73
 				if ($previous !== null) print '</div>';
74 74
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
airline-detailed.php 2 patches
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = $limit_explode[0];
20 20
 		$limit_end = $limit_explode[1];
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
 	{
39 39
 		if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) {
40 40
 			$title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
41
-		} else $title = '';
41
+		} else {
42
+			$title = '';
43
+		}
42 44
 		require_once('header.php');
43 45
 	  
44 46
 		print '<div class="select-item">';
@@ -47,7 +49,9 @@  discard block
 block discarded – undo
47 49
 		print '<option></option>';
48 50
 		$Stats = new Stats();
49 51
 		$airline_names = $Stats->getAllAirlineNames();
50
-		if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
52
+		if (empty($airline_names)) {
53
+			$airline_names = $Spotter->getAllAirlineNames();
54
+		}
51 55
 		foreach($airline_names as $airline_name)
52 56
 		{
53 57
 			if($_GET['airline'] == $airline_name['airline_icao'])
@@ -76,10 +80,16 @@  discard block
 block discarded – undo
76 80
 			print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['airline_name'].'</div>';
77 81
 			print '<div><span class="label">'._("Country").'</span>'.$spotter_array[0]['airline_country'].'</div>';
78 82
 			print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['airline_icao'].'</div>';
79
-			if (isset($spotter_array[0]['airline_iata'])) print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>';
80
-			if (isset($spotter_array[0]['airline_callsign'])) print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; 
83
+			if (isset($spotter_array[0]['airline_iata'])) {
84
+				print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>';
85
+			}
86
+			if (isset($spotter_array[0]['airline_callsign'])) {
87
+				print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>';
88
+			}
81 89
 			print '<div><span class="label">'._("Type").'</span>'.ucwords($spotter_array[0]['airline_type']).'</div>';
82
-			if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>';
90
+			if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) {
91
+				print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>';
92
+			}
83 93
 			print '</div>';
84 94
 		} else {
85 95
 			print '<div class="alert alert-warning">'._("This special airline profile shows all flights that do <u>not</u> have a airline associated with them.").'</div>';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 
7
-if (!isset($_GET['airline'])){
7
+if (!isset($_GET['airline'])) {
8 8
 	header('Location: '.$globalURL.'/airline');
9
-} else{
9
+} else {
10 10
 	$Spotter = new Spotter();
11 11
 	//calculuation for the pagination
12
-	if(!isset($_GET['limit']) || $_GET['limit'] == "")
12
+	if (!isset($_GET['limit']) || $_GET['limit'] == "")
13 13
 	{
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = $limit_explode[0];
20 20
 		$limit_end = $limit_explode[1];
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 	$limit_previous_1 = $limit_start - $absolute_difference;
29 29
 	$limit_previous_2 = $limit_end - $absolute_difference;
30 30
 	
31
-	$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
31
+	$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
32 32
 	$page_url = $globalURL.'/airline/'.$airline;
33 33
 	
34
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
35
-	$spotter_array = $Spotter->getSpotterDataByAirline($_GET['airline'],$limit_start.",".$absolute_difference, $sort);
34
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
35
+	$spotter_array = $Spotter->getSpotterDataByAirline($_GET['airline'], $limit_start.",".$absolute_difference, $sort);
36 36
 	
37 37
 	if (!empty($spotter_array))
38 38
 	{
39 39
 		if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) {
40
-			$title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
40
+			$title = sprintf(_("Detailed View for %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
41 41
 		} else $title = '';
42 42
 		require_once('header.php');
43 43
 	  
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		$Stats = new Stats();
49 49
 		$airline_names = $Stats->getAllAirlineNames();
50 50
 		if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
51
-		foreach($airline_names as $airline_name)
51
+		foreach ($airline_names as $airline_name)
52 52
 		{
53
-			if($_GET['airline'] == $airline_name['airline_icao'])
53
+			if ($_GET['airline'] == $airline_name['airline_icao'])
54 54
 			{
55 55
 				print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
56 56
 			} else {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		include('airline-sub-menu.php');
89 89
 		print '<div class="table column">';
90 90
 		if (isset($spotter_array[0]['airline_name'])) {
91
-			print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
91
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
92 92
 		}
93 93
 
94 94
 		include('table-output.php');  
Please login to merge, or discard this patch.
install/class.update_schema.php 3 patches
Indentation   +594 added lines, -594 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
 class update_schema {
9 9
 
10 10
 	public static function update_schedule() {
11
-	    $Connection = new Connection();
12
-	    $Schedule = new Schedule();
13
-	    $query = "SELECT * FROM schedule";
14
-            try {
15
-            	$sth = $Connection->db->prepare($query);
11
+		$Connection = new Connection();
12
+		$Schedule = new Schedule();
13
+		$query = "SELECT * FROM schedule";
14
+			try {
15
+				$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+			} catch(PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19
-    	    }
20
-    	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
-    	    }
19
+			}
20
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
+			$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
+			}
23 23
 	
24 24
 	}
25 25
 /*
@@ -43,198 +43,198 @@  discard block
 block discarded – undo
43 43
     	}
44 44
 */	
45 45
 	private static function update_from_1() {
46
-    		$Connection = new Connection();
47
-    		// Add new column to routes table
48
-    		//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
46
+			$Connection = new Connection();
47
+			// Add new column to routes table
48
+			//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
49 49
 		$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL";
50
-        	try {
51
-            	    $sth = $Connection->db->prepare($query);
52
-		    $sth->execute();
53
-    		} catch(PDOException $e) {
54
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
-    		}
56
-    		// Copy schedules data to routes table
57
-    		self::update_schedule();
58
-    		// Delete schedule table
50
+			try {
51
+					$sth = $Connection->db->prepare($query);
52
+			$sth->execute();
53
+			} catch(PDOException $e) {
54
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
+			}
56
+			// Copy schedules data to routes table
57
+			self::update_schedule();
58
+			// Delete schedule table
59 59
 		$query = "DROP TABLE `schedule`";
60
-        	try {
61
-            	    $sth = $Connection->db->prepare($query);
62
-		    $sth->execute();
63
-    		} catch(PDOException $e) {
64
-		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65
-    		}
66
-    		// Add source column
67
-    		$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
-    		try {
69
-            	    $sth = $Connection->db->prepare($query);
70
-		    $sth->execute();
71
-    		} catch(PDOException $e) {
72
-		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
-    		}
60
+			try {
61
+					$sth = $Connection->db->prepare($query);
62
+			$sth->execute();
63
+			} catch(PDOException $e) {
64
+			return "error (delete schedule table) : ".$e->getMessage()."\n";
65
+			}
66
+			// Add source column
67
+			$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
+			try {
69
+					$sth = $Connection->db->prepare($query);
70
+			$sth->execute();
71
+			} catch(PDOException $e) {
72
+			return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
+			}
74 74
 		// Delete unused column
75 75
 		$query = "ALTER TABLE `aircraft_modes`  DROP `SerialNo`,  DROP `OperatorFlagCode`,  DROP `Manufacturer`,  DROP `Type`,  DROP `FirstRegDate`,  DROP `CurrentRegDate`,  DROP `Country`,  DROP `PreviousID`,  DROP `DeRegDate`,  DROP `Status`,  DROP `PopularName`,  DROP `GenericName`,  DROP `AircraftClass`,  DROP `Engines`,  DROP `OwnershipStatus`,  DROP `RegisteredOwners`,  DROP `MTOW`,  DROP `TotalHours`,  DROP `YearBuilt`,  DROP `CofACategory`,  DROP `CofAExpiry`,  DROP `UserNotes`,  DROP `Interested`,  DROP `UserTag`,  DROP `InfoUrl`,  DROP `PictureUrl1`,  DROP `PictureUrl2`,  DROP `PictureUrl3`,  DROP `UserBool1`,  DROP `UserBool2`,  DROP `UserBool3`,  DROP `UserBool4`,  DROP `UserBool5`,  DROP `UserString1`,  DROP `UserString2`,  DROP `UserString3`,  DROP `UserString4`,  DROP `UserString5`,  DROP `UserInt1`,  DROP `UserInt2`,  DROP `UserInt3`,  DROP `UserInt4`,  DROP `UserInt5`";
76
-    		try {
77
-            	    $sth = $Connection->db->prepare($query);
78
-		    $sth->execute();
79
-    		} catch(PDOException $e) {
80
-		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
-    		}
76
+			try {
77
+					$sth = $Connection->db->prepare($query);
78
+			$sth->execute();
79
+			} catch(PDOException $e) {
80
+			return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
+			}
82 82
 		// Add ModeS column
83 83
 		$query = "ALTER TABLE `spotter_output`  ADD `ModeS` VARCHAR(255) NULL";
84
-    		try {
85
-            	    $sth = $Connection->db->prepare($query);
86
-		    $sth->execute();
87
-    		} catch(PDOException $e) {
88
-		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
-    		}
84
+			try {
85
+					$sth = $Connection->db->prepare($query);
86
+			$sth->execute();
87
+			} catch(PDOException $e) {
88
+			return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
+			}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91
-    		try {
92
-            	    $sth = $Connection->db->prepare($query);
93
-		    $sth->execute();
94
-    		} catch(PDOException $e) {
95
-		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
-    		}
97
-    		// Add auto_increment for aircraft_modes
98
-    		$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
-    		try {
100
-            	    $sth = $Connection->db->prepare($query);
101
-		    $sth->execute();
102
-    		} catch(PDOException $e) {
103
-		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
-    		}
105
-    		$error = '';
91
+			try {
92
+					$sth = $Connection->db->prepare($query);
93
+			$sth->execute();
94
+			} catch(PDOException $e) {
95
+			return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
+			}
97
+			// Add auto_increment for aircraft_modes
98
+			$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
+			try {
100
+					$sth = $Connection->db->prepare($query);
101
+			$sth->execute();
102
+			} catch(PDOException $e) {
103
+			return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
+			}
105
+			$error = '';
106 106
 		$error .= create_db::import_file('../db/acars_live.sql');
107 107
 		$error .= create_db::import_file('../db/config.sql');
108 108
 		// Update schema_version to 2
109 109
 		$query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'";
110
-        	try {
111
-            	    $sth = $Connection->db->prepare($query);
112
-		    $sth->execute();
113
-    		} catch(PDOException $e) {
114
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
115
-    		}
110
+			try {
111
+					$sth = $Connection->db->prepare($query);
112
+			$sth->execute();
113
+			} catch(PDOException $e) {
114
+			return "error (update schema_version) : ".$e->getMessage()."\n";
115
+			}
116 116
 		return $error;
117
-        }
117
+		}
118 118
 
119 119
 	private static function update_from_2() {
120
-    		$Connection = new Connection();
121
-    		// Add new column decode to acars_live table
120
+			$Connection = new Connection();
121
+			// Add new column decode to acars_live table
122 122
 		$query = "ALTER TABLE `acars_live` ADD `decode` TEXT";
123
-        	try {
124
-            	    $sth = $Connection->db->prepare($query);
125
-		    $sth->execute();
126
-    		} catch(PDOException $e) {
127
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
-    		}
129
-    		$error = '';
130
-    		// Create table acars_archive
123
+			try {
124
+					$sth = $Connection->db->prepare($query);
125
+			$sth->execute();
126
+			} catch(PDOException $e) {
127
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
+			}
129
+			$error = '';
130
+			// Create table acars_archive
131 131
 		$error .= create_db::import_file('../db/acars_archive.sql');
132 132
 		// Update schema_version to 3
133 133
 		$query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'";
134
-        	try {
135
-            	    $sth = $Connection->db->prepare($query);
136
-		    $sth->execute();
137
-    		} catch(PDOException $e) {
138
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
139
-    		}
134
+			try {
135
+					$sth = $Connection->db->prepare($query);
136
+			$sth->execute();
137
+			} catch(PDOException $e) {
138
+			return "error (update schema_version) : ".$e->getMessage()."\n";
139
+			}
140 140
 		return $error;
141 141
 	}
142 142
 
143 143
 	private static function update_from_3() {
144
-    		$Connection = new Connection();
145
-    		// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
144
+			$Connection = new Connection();
145
+			// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
146 146
 		$query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP";
147
-        	try {
148
-            	    $sth = $Connection->db->prepare($query);
149
-		    $sth->execute();
150
-    		} catch(PDOException $e) {
151
-		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
-    		}
153
-    		// Add image_source_website column to spotter_image
147
+			try {
148
+					$sth = $Connection->db->prepare($query);
149
+			$sth->execute();
150
+			} catch(PDOException $e) {
151
+			return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
+			}
153
+			// Add image_source_website column to spotter_image
154 154
 		$query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL";
155
-        	try {
156
-            	    $sth = $Connection->db->prepare($query);
157
-		    $sth->execute();
158
-    		} catch(PDOException $e) {
159
-		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
-    		}
161
-    		$error = '';
155
+			try {
156
+					$sth = $Connection->db->prepare($query);
157
+			$sth->execute();
158
+			} catch(PDOException $e) {
159
+			return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
+			}
161
+			$error = '';
162 162
 		// Update schema_version to 4
163 163
 		$query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'";
164
-        	try {
165
-            	    $sth = $Connection->db->prepare($query);
166
-		    $sth->execute();
167
-    		} catch(PDOException $e) {
168
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
169
-    		}
164
+			try {
165
+					$sth = $Connection->db->prepare($query);
166
+			$sth->execute();
167
+			} catch(PDOException $e) {
168
+			return "error (update schema_version) : ".$e->getMessage()."\n";
169
+			}
170 170
 		return $error;
171 171
 	}
172 172
 	
173 173
 	private static function update_from_4() {
174
-    		$Connection = new Connection();
174
+			$Connection = new Connection();
175 175
 	
176
-    		$error = '';
177
-    		// Create table acars_label
176
+			$error = '';
177
+			// Create table acars_label
178 178
 		$error .= create_db::import_file('../db/acars_label.sql');
179 179
 		if ($error == '') {
180
-		    // Update schema_version to 5
181
-		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
-        	    try {
183
-            		$sth = $Connection->db->prepare($query);
180
+			// Update schema_version to 5
181
+			$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
+				try {
183
+					$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+				} catch(PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187
-    		    }
188
-    		}
187
+				}
188
+			}
189 189
 		return $error;
190 190
 	}
191 191
 
192 192
 	private static function update_from_5() {
193
-    		$Connection = new Connection();
194
-    		// Add columns to translation
193
+			$Connection = new Connection();
194
+			// Add columns to translation
195 195
 		$query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;";
196
-        	try {
197
-            	    $sth = $Connection->db->prepare($query);
198
-		    $sth->execute();
199
-    		} catch(PDOException $e) {
200
-		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
-    		}
202
-    		// Add aircraft_shadow column to aircraft
203
-    		$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
-        	try {
205
-            	    $sth = $Connection->db->prepare($query);
206
-		    $sth->execute();
207
-    		} catch(PDOException $e) {
208
-		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
-    		}
210
-    		// Add aircraft_shadow column to spotter_live
211
-    		$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
-        	try {
213
-            	    $sth = $Connection->db->prepare($query);
214
-		    $sth->execute();
215
-    		} catch(PDOException $e) {
216
-		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
-    		}
218
-    		$error = '';
219
-    		// Update table aircraft
196
+			try {
197
+					$sth = $Connection->db->prepare($query);
198
+			$sth->execute();
199
+			} catch(PDOException $e) {
200
+			return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
+			}
202
+			// Add aircraft_shadow column to aircraft
203
+			$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
+			try {
205
+					$sth = $Connection->db->prepare($query);
206
+			$sth->execute();
207
+			} catch(PDOException $e) {
208
+			return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
+			}
210
+			// Add aircraft_shadow column to spotter_live
211
+			$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
+			try {
213
+					$sth = $Connection->db->prepare($query);
214
+			$sth->execute();
215
+			} catch(PDOException $e) {
216
+			return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
+			}
218
+			$error = '';
219
+			// Update table aircraft
220 220
 		$error .= create_db::import_file('../db/aircraft.sql');
221 221
 		$error .= create_db::import_file('../db/spotter_archive.sql');
222 222
 
223 223
 		// Update schema_version to 6
224 224
 		$query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'";
225
-        	try {
226
-            	    $sth = $Connection->db->prepare($query);
227
-		    $sth->execute();
228
-    		} catch(PDOException $e) {
229
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
230
-    		}
225
+			try {
226
+					$sth = $Connection->db->prepare($query);
227
+			$sth->execute();
228
+			} catch(PDOException $e) {
229
+			return "error (update schema_version) : ".$e->getMessage()."\n";
230
+			}
231 231
 		return $error;
232 232
 	}
233 233
 
234 234
 	private static function update_from_6() {
235
-    		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
-    		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
235
+			$Connection = new Connection();
236
+			if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
+				$query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
240 240
 			ALTER TABLE spotter_live ADD INDEX(flightaware_id);
@@ -247,147 +247,147 @@  discard block
 block discarded – undo
247 247
 			ALTER TABLE aircraft ADD INDEX(icao);
248 248
 			ALTER TABLE airport ADD INDEX(icao);
249 249
 			ALTER TABLE translation ADD INDEX(Operator);";
250
-        	    try {
251
-            		$sth = $Connection->db->prepare($query);
250
+				try {
251
+					$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+				} catch(PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255
-    		    }
256
-    		}
257
-    		$error = '';
258
-    		// Update table countries
259
-    		if ($Connection->tableExists('airspace')) {
260
-    		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
255
+				}
256
+			}
257
+			$error = '';
258
+			// Update table countries
259
+			if ($Connection->tableExists('airspace')) {
260
+				$error .= update_db::update_countries();
261
+			if ($error != '') return $error;
262 262
 		}
263 263
 		// Update schema_version to 7
264 264
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
265
-        	try {
266
-            	    $sth = $Connection->db->prepare($query);
267
-		    $sth->execute();
268
-    		} catch(PDOException $e) {
269
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
270
-    		}
265
+			try {
266
+					$sth = $Connection->db->prepare($query);
267
+			$sth->execute();
268
+			} catch(PDOException $e) {
269
+			return "error (update schema_version) : ".$e->getMessage()."\n";
270
+			}
271 271
 		return $error;
272
-    	}
272
+		}
273 273
 
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276
-    		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
276
+			$Connection = new Connection();
277
+			$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279
-        	try {
280
-            	    $sth = $Connection->db->prepare($query);
281
-		    $sth->execute();
282
-    		} catch(PDOException $e) {
283
-		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
-    		}
285
-    		if ($globalDBdriver == 'mysql') {
286
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
-		    try {
288
-            		$sth = $Connection->db->prepare($query);
279
+			try {
280
+					$sth = $Connection->db->prepare($query);
281
+			$sth->execute();
282
+			} catch(PDOException $e) {
283
+			return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
+			}
285
+			if ($globalDBdriver == 'mysql') {
286
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
+			try {
288
+					$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+				} catch(PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292
-    		    }
293
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
294
-    		    if ($row['engine'] == 'ARCHIVE') {
292
+				}
293
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
294
+				if ($row['engine'] == 'ARCHIVE') {
295 295
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
296 296
 				ALTER TABLE copy ENGINE=ARCHIVE;
297 297
 				ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
298 298
 				INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`;
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301
-            	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
-            	    }
304
-                } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
-                }
307
-        	try {
308
-            	    $sth = $Connection->db->prepare($query);
309
-		    $sth->execute();
310
-    		} catch(PDOException $e) {
311
-		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
-    		}
301
+					} else {
302
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
+					}
304
+				} else {
305
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
+				}
307
+			try {
308
+					$sth = $Connection->db->prepare($query);
309
+			$sth->execute();
310
+			} catch(PDOException $e) {
311
+			return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
+			}
313 313
 
314
-    		$error = '';
315
-    		// Update table aircraft
314
+			$error = '';
315
+			// Update table aircraft
316 316
 		$error .= create_db::import_file('../db/source_location.sql');
317 317
 		if ($error != '') return $error;
318 318
 		// Update schema_version to 6
319 319
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320
-        	try {
321
-            	    $sth = $Connection->db->prepare($query);
322
-		    $sth->execute();
323
-    		} catch(PDOException $e) {
324
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
325
-    		}
320
+			try {
321
+					$sth = $Connection->db->prepare($query);
322
+			$sth->execute();
323
+			} catch(PDOException $e) {
324
+			return "error (update schema_version) : ".$e->getMessage()."\n";
325
+			}
326 326
 		return $error;
327 327
 	}
328 328
 
329 329
 	private static function update_from_8() {
330
-    		$Connection = new Connection();
331
-    		$error = '';
332
-    		// Update table aircraft
330
+			$Connection = new Connection();
331
+			$error = '';
332
+			// Update table aircraft
333 333
 		$error .= create_db::import_file('../db/notam.sql');
334 334
 		if ($error != '') return $error;
335 335
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 336
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 337
                         DELETE FROM config WHERE name = 'last_update_notam_db';
338 338
                         INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
339
-        	try {
340
-            	    $sth = $Connection->db->prepare($query);
341
-		    $sth->execute();
342
-    		} catch(PDOException $e) {
343
-		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344
-    		}
339
+			try {
340
+					$sth = $Connection->db->prepare($query);
341
+			$sth->execute();
342
+			} catch(PDOException $e) {
343
+			return "error (insert last_update values) : ".$e->getMessage()."\n";
344
+			}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346
-        	try {
347
-            	    $sth = $Connection->db->prepare($query);
348
-		    $sth->execute();
349
-    		} catch(PDOException $e) {
350
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
351
-    		}
346
+			try {
347
+					$sth = $Connection->db->prepare($query);
348
+			$sth->execute();
349
+			} catch(PDOException $e) {
350
+			return "error (update schema_version) : ".$e->getMessage()."\n";
351
+			}
352 352
 		return $error;
353 353
 	}
354 354
 
355 355
 	private static function update_from_9() {
356
-    		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
356
+			$Connection = new Connection();
357
+			$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359
-        	try {
360
-            	    $sth = $Connection->db->prepare($query);
361
-		    $sth->execute();
362
-    		} catch(PDOException $e) {
363
-		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
-    		}
359
+			try {
360
+					$sth = $Connection->db->prepare($query);
361
+			$sth->execute();
362
+			} catch(PDOException $e) {
363
+			return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
+			}
365 365
 		$error = '';
366
-    		// Update table atc
366
+			// Update table atc
367 367
 		$error .= create_db::import_file('../db/atc.sql');
368 368
 		if ($error != '') return $error;
369 369
 		
370 370
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371
-        	try {
372
-            	    $sth = $Connection->db->prepare($query);
373
-		    $sth->execute();
374
-    		} catch(PDOException $e) {
375
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
376
-    		}
371
+			try {
372
+					$sth = $Connection->db->prepare($query);
373
+			$sth->execute();
374
+			} catch(PDOException $e) {
375
+			return "error (update schema_version) : ".$e->getMessage()."\n";
376
+			}
377 377
 		return $error;
378 378
 	}
379 379
 
380 380
 	private static function update_from_10() {
381
-    		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
-        	try {
384
-            	    $sth = $Connection->db->prepare($query);
385
-		    $sth->execute();
386
-    		} catch(PDOException $e) {
387
-		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
-    		}
381
+			$Connection = new Connection();
382
+			$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
+			try {
384
+					$sth = $Connection->db->prepare($query);
385
+			$sth->execute();
386
+			} catch(PDOException $e) {
387
+			return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
+			}
389 389
 		$error = '';
390
-    		// Add tables
390
+			// Add tables
391 391
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392 392
 		if ($error != '') return $error;
393 393
 		$error .= create_db::import_file('../db/metar.sql');
@@ -398,76 +398,76 @@  discard block
 block discarded – undo
398 398
 		if ($error != '') return $error;
399 399
 		
400 400
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401
-        	try {
402
-            	    $sth = $Connection->db->prepare($query);
403
-		    $sth->execute();
404
-    		} catch(PDOException $e) {
405
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
406
-    		}
401
+			try {
402
+					$sth = $Connection->db->prepare($query);
403
+			$sth->execute();
404
+			} catch(PDOException $e) {
405
+			return "error (update schema_version) : ".$e->getMessage()."\n";
406
+			}
407 407
 		return $error;
408 408
 	}
409 409
 
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412
-    		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
-        	try {
415
-            	    $sth = $Connection->db->prepare($query);
416
-		    $sth->execute();
417
-    		} catch(PDOException $e) {
418
-		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
-    		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
-        	try {
422
-            	    $sth = $Connection->db->prepare($query);
423
-		    $sth->execute();
424
-    		} catch(PDOException $e) {
425
-		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
-    		}
427
-    		if ($globalDBdriver == 'mysql') {
428
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
-		    try {
430
-            		$sth = $Connection->db->prepare($query);
412
+			$Connection = new Connection();
413
+			$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
+			try {
415
+					$sth = $Connection->db->prepare($query);
431 416
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
417
+			} catch(PDOException $e) {
418
+			return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
+			}
420
+			$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
+			try {
422
+					$sth = $Connection->db->prepare($query);
423
+			$sth->execute();
424
+			} catch(PDOException $e) {
425
+			return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
+			}
427
+			if ($globalDBdriver == 'mysql') {
428
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
+			try {
430
+					$sth = $Connection->db->prepare($query);
431
+			$sth->execute();
432
+				} catch(PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434
-    		    }
435
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
436
-    		    if ($row['engine'] == 'ARCHIVE') {
434
+				}
435
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
436
+				if ($row['engine'] == 'ARCHIVE') {
437 437
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
438 438
 				ALTER TABLE copy ENGINE=ARCHIVE;
439 439
 				ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE;
440 440
 				INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`;
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443
-            	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
-            	    }
446
-                } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
-                }
449
-        	try {
450
-            	    $sth = $Connection->db->prepare($query);
451
-		    $sth->execute();
452
-    		} catch(PDOException $e) {
453
-		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
-    		}
443
+					} else {
444
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
+					}
446
+				} else {
447
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
+				}
449
+			try {
450
+					$sth = $Connection->db->prepare($query);
451
+			$sth->execute();
452
+			} catch(PDOException $e) {
453
+			return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
+			}
455 455
 
456 456
 		$error = '';
457 457
 		
458 458
 		$query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'";
459
-        	try {
460
-            	    $sth = $Connection->db->prepare($query);
461
-		    $sth->execute();
462
-    		} catch(PDOException $e) {
463
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
464
-    		}
459
+			try {
460
+					$sth = $Connection->db->prepare($query);
461
+			$sth->execute();
462
+			} catch(PDOException $e) {
463
+			return "error (update schema_version) : ".$e->getMessage()."\n";
464
+			}
465 465
 		return $error;
466 466
 	}
467 467
 	private static function update_from_12() {
468
-    		$Connection = new Connection();
468
+			$Connection = new Connection();
469 469
 		$error = '';
470
-    		// Add tables
470
+			// Add tables
471 471
 		$error .= create_db::import_file('../db/stats.sql');
472 472
 		if ($error != '') return $error;
473 473
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
@@ -484,166 +484,166 @@  discard block
 block discarded – undo
484 484
 		if ($error != '') return $error;
485 485
 		
486 486
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487
-        	try {
488
-            	    $sth = $Connection->db->prepare($query);
489
-		    $sth->execute();
490
-    		} catch(PDOException $e) {
491
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
492
-    		}
487
+			try {
488
+					$sth = $Connection->db->prepare($query);
489
+			$sth->execute();
490
+			} catch(PDOException $e) {
491
+			return "error (update schema_version) : ".$e->getMessage()."\n";
492
+			}
493 493
 		return $error;
494 494
 	}
495 495
 
496 496
 	private static function update_from_13() {
497
-    		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
497
+			$Connection = new Connection();
498
+			if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
+				$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+				} catch(PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505
-    			}
505
+				}
506 506
 		}
507
-    		$error = '';
507
+			$error = '';
508 508
 		$query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'";
509
-        	try {
510
-            	    $sth = $Connection->db->prepare($query);
511
-		    $sth->execute();
512
-    		} catch(PDOException $e) {
513
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
514
-    		}
509
+			try {
510
+					$sth = $Connection->db->prepare($query);
511
+			$sth->execute();
512
+			} catch(PDOException $e) {
513
+			return "error (update schema_version) : ".$e->getMessage()."\n";
514
+			}
515 515
 		return $error;
516 516
 	}
517 517
 
518 518
 	private static function update_from_14() {
519
-    		$Connection = new Connection();
519
+			$Connection = new Connection();
520 520
 		$error = '';
521
-    		// Add tables
522
-    		if (!$Connection->tableExists('stats_flight')) {
521
+			// Add tables
522
+			if (!$Connection->tableExists('stats_flight')) {
523 523
 			$error .= create_db::import_file('../db/stats_flight.sql');
524 524
 			if ($error != '') return $error;
525 525
 		}
526 526
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527
-        	try {
528
-            	    $sth = $Connection->db->prepare($query);
529
-		    $sth->execute();
530
-    		} catch(PDOException $e) {
531
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
532
-    		}
527
+			try {
528
+					$sth = $Connection->db->prepare($query);
529
+			$sth->execute();
530
+			} catch(PDOException $e) {
531
+			return "error (update schema_version) : ".$e->getMessage()."\n";
532
+			}
533 533
 		return $error;
534 534
 	}
535 535
 
536 536
 
537 537
 	private static function update_from_15() {
538
-    		$Connection = new Connection();
538
+			$Connection = new Connection();
539 539
 		$error = '';
540
-    		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
-        	try {
543
-            	    $sth = $Connection->db->prepare($query);
544
-		    $sth->execute();
545
-    		} catch(PDOException $e) {
546
-		    return "error (update stats) : ".$e->getMessage()."\n";
547
-    		}
540
+			// Add tables
541
+			$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
+			try {
543
+					$sth = $Connection->db->prepare($query);
544
+			$sth->execute();
545
+			} catch(PDOException $e) {
546
+			return "error (update stats) : ".$e->getMessage()."\n";
547
+			}
548 548
 		if ($error != '') return $error;
549 549
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550
-        	try {
551
-            	    $sth = $Connection->db->prepare($query);
552
-		    $sth->execute();
553
-    		} catch(PDOException $e) {
554
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
555
-    		}
550
+			try {
551
+					$sth = $Connection->db->prepare($query);
552
+			$sth->execute();
553
+			} catch(PDOException $e) {
554
+			return "error (update schema_version) : ".$e->getMessage()."\n";
555
+			}
556 556
 		return $error;
557 557
 	}
558 558
 
559 559
 	private static function update_from_16() {
560
-    		$Connection = new Connection();
560
+			$Connection = new Connection();
561 561
 		$error = '';
562
-    		// Add tables
563
-    		if (!$Connection->tableExists('stats_registration')) {
562
+			// Add tables
563
+			if (!$Connection->tableExists('stats_registration')) {
564 564
 			$error .= create_db::import_file('../db/stats_registration.sql');
565 565
 		}
566
-    		if (!$Connection->tableExists('stats_callsign')) {
566
+			if (!$Connection->tableExists('stats_callsign')) {
567 567
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 568
 		}
569 569
 		if ($error != '') return $error;
570 570
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571
-        	try {
572
-            	    $sth = $Connection->db->prepare($query);
573
-		    $sth->execute();
574
-    		} catch(PDOException $e) {
575
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
576
-    		}
571
+			try {
572
+					$sth = $Connection->db->prepare($query);
573
+			$sth->execute();
574
+			} catch(PDOException $e) {
575
+			return "error (update schema_version) : ".$e->getMessage()."\n";
576
+			}
577 577
 		return $error;
578 578
 	}
579 579
 
580 580
 	private static function update_from_17() {
581
-    		$Connection = new Connection();
581
+			$Connection = new Connection();
582 582
 		$error = '';
583
-    		// Add tables
584
-    		if (!$Connection->tableExists('stats_country')) {
583
+			// Add tables
584
+			if (!$Connection->tableExists('stats_country')) {
585 585
 			$error .= create_db::import_file('../db/stats_country.sql');
586 586
 		}
587 587
 		if ($error != '') return $error;
588 588
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589
-        	try {
590
-            	    $sth = $Connection->db->prepare($query);
591
-		    $sth->execute();
592
-    		} catch(PDOException $e) {
593
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
594
-    		}
589
+			try {
590
+					$sth = $Connection->db->prepare($query);
591
+			$sth->execute();
592
+			} catch(PDOException $e) {
593
+			return "error (update schema_version) : ".$e->getMessage()."\n";
594
+			}
595 595
 		return $error;
596 596
 	}
597 597
 	private static function update_from_18() {
598
-    		$Connection = new Connection();
598
+			$Connection = new Connection();
599 599
 		$error = '';
600
-    		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
-    			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
-    	        	try {
604
-	            	    $sth = $Connection->db->prepare($query);
605
-			    $sth->execute();
606
-    			} catch(PDOException $e) {
607
-			    return "error (update stats) : ".$e->getMessage()."\n";
608
-    			}
609
-    		}
600
+			// Modify stats_airport table
601
+			if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
+				$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
+					try {
604
+						$sth = $Connection->db->prepare($query);
605
+				$sth->execute();
606
+				} catch(PDOException $e) {
607
+				return "error (update stats) : ".$e->getMessage()."\n";
608
+				}
609
+			}
610 610
 		if ($error != '') return $error;
611 611
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612
-        	try {
613
-            	    $sth = $Connection->db->prepare($query);
614
-		    $sth->execute();
615
-    		} catch(PDOException $e) {
616
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
617
-    		}
612
+			try {
613
+					$sth = $Connection->db->prepare($query);
614
+			$sth->execute();
615
+			} catch(PDOException $e) {
616
+			return "error (update schema_version) : ".$e->getMessage()."\n";
617
+			}
618 618
 		return $error;
619 619
 	}
620 620
 
621 621
 	private static function update_from_19() {
622
-    		$Connection = new Connection();
622
+			$Connection = new Connection();
623 623
 		$error = '';
624
-    		// Update airport table
624
+			// Update airport table
625 625
 		$error .= create_db::import_file('../db/airport.sql');
626 626
 		if ($error != '') return 'Import airport.sql : '.$error;
627 627
 		// Remove primary key on Spotter_Archive
628 628
 		$query = "alter table spotter_archive drop spotter_archive_id";
629
-        	try {
630
-            	    $sth = $Connection->db->prepare($query);
631
-		    $sth->execute();
632
-    		} catch(PDOException $e) {
633
-		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
-    		}
629
+			try {
630
+					$sth = $Connection->db->prepare($query);
631
+			$sth->execute();
632
+			} catch(PDOException $e) {
633
+			return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
+			}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636
-        	try {
637
-            	    $sth = $Connection->db->prepare($query);
638
-		    $sth->execute();
639
-    		} catch(PDOException $e) {
640
-		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
-    		}
636
+			try {
637
+					$sth = $Connection->db->prepare($query);
638
+			$sth->execute();
639
+			} catch(PDOException $e) {
640
+			return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
+			}
642 642
 		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
643 643
 			// Add column over_country
644
-    			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
644
+				$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646
-            			$sth = $Connection->db->prepare($query);
646
+						$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648 648
 			} catch(PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 		}
652 652
 		if (!$Connection->checkColumnName('spotter_live','over_country')) {
653 653
 			// Add column over_country
654
-    			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
654
+				$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656
-            			$sth = $Connection->db->prepare($query);
656
+						$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658 658
 			} catch(PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -661,74 +661,74 @@  discard block
 block discarded – undo
661 661
 		}
662 662
 		if (!$Connection->checkColumnName('spotter_output','source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664
-    			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
664
+				$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668 668
 			} catch(PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670
-    			}
671
-    		}
670
+				}
671
+			}
672 672
 		if (!$Connection->checkColumnName('spotter_live','source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674
-    			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
674
+				$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678 678
 			} catch(PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680
-    			}
681
-    		}
680
+				}
681
+			}
682 682
 		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684
-    			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
684
+				$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688 688
 			} catch(PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690
-    			}
691
-    		}
690
+				}
691
+			}
692 692
 		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694
-    			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
694
+				$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698 698
 			} catch(PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700
-    			}
701
-    		}
700
+				}
701
+			}
702 702
 		if ($error != '') return $error;
703 703
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704
-        	try {
705
-            	    $sth = $Connection->db->prepare($query);
706
-		    $sth->execute();
707
-    		} catch(PDOException $e) {
708
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
709
-    		}
704
+			try {
705
+					$sth = $Connection->db->prepare($query);
706
+			$sth->execute();
707
+			} catch(PDOException $e) {
708
+			return "error (update schema_version) : ".$e->getMessage()."\n";
709
+			}
710 710
 		return $error;
711 711
 	}
712 712
 
713 713
 	private static function update_from_20() {
714 714
 		global $globalIVAO, $globalVATSIM, $globalphpVMS;
715
-    		$Connection = new Connection();
715
+			$Connection = new Connection();
716 716
 		$error = '';
717
-    		// Update airline table
718
-    		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
717
+			// Update airline table
718
+			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722 722
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 723
 			// Add column over_country
724
-    			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
-        		try {
724
+				$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
+				try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728 728
 			} catch(PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730
-    			}
731
-    		}
730
+				}
731
+			}
732 732
 		if ($error != '') return $error;
733 733
 		/*
734 734
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 		}
739 739
 		*/
740 740
 		$query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'";
741
-        	try {
742
-            	    $sth = $Connection->db->prepare($query);
743
-		    $sth->execute();
744
-    		} catch(PDOException $e) {
745
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
746
-    		}
741
+			try {
742
+					$sth = $Connection->db->prepare($query);
743
+			$sth->execute();
744
+			} catch(PDOException $e) {
745
+			return "error (update schema_version) : ".$e->getMessage()."\n";
746
+			}
747 747
 		return $error;
748 748
 	}
749 749
 
@@ -762,35 +762,35 @@  discard block
 block discarded – undo
762 762
 			if ($error != '') return $error;
763 763
 		}
764 764
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765
-        	try {
766
-            	    $sth = $Connection->db->prepare($query);
767
-		    $sth->execute();
768
-    		} catch(PDOException $e) {
769
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
770
-    		}
765
+			try {
766
+					$sth = $Connection->db->prepare($query);
767
+			$sth->execute();
768
+			} catch(PDOException $e) {
769
+			return "error (update schema_version) : ".$e->getMessage()."\n";
770
+			}
771 771
 		return $error;
772 772
 	}
773 773
 
774 774
 	private static function update_from_22() {
775 775
 		global $globalDBdriver;
776
-    		$Connection = new Connection();
776
+			$Connection = new Connection();
777 777
 		$error = '';
778 778
 		// Add table stats polar
779
-    		if (!$Connection->tableExists('stats_source')) {
779
+			if (!$Connection->tableExists('stats_source')) {
780 780
 			if ($globalDBdriver == 'mysql') {
781
-    				$error .= create_db::import_file('../db/stats_source.sql');
781
+					$error .= create_db::import_file('../db/stats_source.sql');
782 782
 			} else {
783 783
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 784
 			}
785 785
 			if ($error != '') return $error;
786 786
 		}
787 787
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788
-        	try {
789
-            	    $sth = $Connection->db->prepare($query);
790
-		    $sth->execute();
791
-    		} catch(PDOException $e) {
792
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
793
-    		}
788
+			try {
789
+					$sth = $Connection->db->prepare($query);
790
+			$sth->execute();
791
+			} catch(PDOException $e) {
792
+			return "error (update schema_version) : ".$e->getMessage()."\n";
793
+			}
794 794
 		return $error;
795 795
 	}
796 796
 
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 		}
822 822
 		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824
-    			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
824
+				$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828 828
 			} catch(PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830
-    			}
831
-    		}
830
+				}
831
+			}
832 832
 		
833 833
 		$query = "UPDATE config SET value = '24' WHERE name = 'schema_version'";
834 834
 		try {
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 			} catch(PDOException $e) {
1177 1177
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1178 1178
 			}
1179
-                }
1179
+				}
1180 1180
 		if (!$Connection->checkColumnName('aircraft','mfr')) {
1181 1181
 			// Add mfr to aircraft
1182 1182
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 			} catch(PDOException $e) {
1251 1251
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1252 1252
 			}
1253
-                }
1253
+				}
1254 1254
 		if (!$Connection->indexExists('accidents','registration_idx')) {
1255 1255
 			// Add index key
1256 1256
 			$query = "create index registration_idx on accidents (registration)";
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 			} catch(PDOException $e) {
1261 1261
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1262 1262
 			}
1263
-                }
1263
+				}
1264 1264
 		if (!$Connection->indexExists('accidents','rdts')) {
1265 1265
 			// Add index key
1266 1266
 			$query = "create index rdts on accidents (registration,date,type,source)";
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 			} catch(PDOException $e) {
1271 1271
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1272 1272
 			}
1273
-                }
1273
+				}
1274 1274
 
1275 1275
 		$query = "UPDATE config SET value = '31' WHERE name = 'schema_version'";
1276 1276
 		try {
@@ -1384,161 +1384,161 @@  discard block
 block discarded – undo
1384 1384
 	}
1385 1385
 
1386 1386
 
1387
-    	public static function check_version($update = false) {
1388
-    	    global $globalDBname;
1389
-    	    $version = 0;
1390
-    	    $Connection = new Connection();
1391
-    	    if ($Connection->tableExists('aircraft')) {
1392
-    		if (!$Connection->tableExists('config')) {
1393
-    		    $version = '1';
1394
-    		    if ($update) return self::update_from_1();
1395
-    		    else return $version;
1387
+		public static function check_version($update = false) {
1388
+			global $globalDBname;
1389
+			$version = 0;
1390
+			$Connection = new Connection();
1391
+			if ($Connection->tableExists('aircraft')) {
1392
+			if (!$Connection->tableExists('config')) {
1393
+				$version = '1';
1394
+				if ($update) return self::update_from_1();
1395
+				else return $version;
1396 1396
 		} else {
1397
-    		    $Connection = new Connection();
1398
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1399
-		    try {
1400
-            		$sth = $Connection->db->prepare($query);
1401
-		        $sth->execute();
1402
-		    } catch(PDOException $e) {
1397
+				$Connection = new Connection();
1398
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1399
+			try {
1400
+					$sth = $Connection->db->prepare($query);
1401
+				$sth->execute();
1402
+			} catch(PDOException $e) {
1403 1403
 			return "error : ".$e->getMessage()."\n";
1404
-    		    }
1405
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
1406
-    		    if ($update) {
1407
-    			if ($result['value'] == '2') {
1408
-    			    $error = self::update_from_2();
1409
-    			    if ($error != '') return $error;
1410
-    			    else return self::check_version(true);
1411
-    			} elseif ($result['value'] == '3') {
1412
-    			    $error = self::update_from_3();
1413
-    			    if ($error != '') return $error;
1414
-    			    else return self::check_version(true);
1415
-    			} elseif ($result['value'] == '4') {
1416
-    			    $error = self::update_from_4();
1417
-    			    if ($error != '') return $error;
1418
-    			    else return self::check_version(true);
1419
-    			} elseif ($result['value'] == '5') {
1420
-    			    $error = self::update_from_5();
1421
-    			    if ($error != '') return $error;
1422
-    			    else return self::check_version(true);
1423
-    			} elseif ($result['value'] == '6') {
1424
-    			    $error = self::update_from_6();
1425
-    			    if ($error != '') return $error;
1426
-    			    else return self::check_version(true);
1427
-    			} elseif ($result['value'] == '7') {
1428
-    			    $error = self::update_from_7();
1429
-    			    if ($error != '') return $error;
1430
-    			    else return self::check_version(true);
1431
-    			} elseif ($result['value'] == '8') {
1432
-    			    $error = self::update_from_8();
1433
-    			    if ($error != '') return $error;
1434
-    			    else return self::check_version(true);
1435
-    			} elseif ($result['value'] == '9') {
1436
-    			    $error = self::update_from_9();
1437
-    			    if ($error != '') return $error;
1438
-    			    else return self::check_version(true);
1439
-    			} elseif ($result['value'] == '10') {
1440
-    			    $error = self::update_from_10();
1441
-    			    if ($error != '') return $error;
1442
-    			    else return self::check_version(true);
1443
-    			} elseif ($result['value'] == '11') {
1444
-    			    $error = self::update_from_11();
1445
-    			    if ($error != '') return $error;
1446
-    			    else return self::check_version(true);
1447
-    			} elseif ($result['value'] == '12') {
1448
-    			    $error = self::update_from_12();
1449
-    			    if ($error != '') return $error;
1450
-    			    else return self::check_version(true);
1451
-    			} elseif ($result['value'] == '13') {
1452
-    			    $error = self::update_from_13();
1453
-    			    if ($error != '') return $error;
1454
-    			    else return self::check_version(true);
1455
-    			} elseif ($result['value'] == '14') {
1456
-    			    $error = self::update_from_14();
1457
-    			    if ($error != '') return $error;
1458
-    			    else return self::check_version(true);
1459
-    			} elseif ($result['value'] == '15') {
1460
-    			    $error = self::update_from_15();
1461
-    			    if ($error != '') return $error;
1462
-    			    else return self::check_version(true);
1463
-    			} elseif ($result['value'] == '16') {
1464
-    			    $error = self::update_from_16();
1465
-    			    if ($error != '') return $error;
1466
-    			    else return self::check_version(true);
1467
-    			} elseif ($result['value'] == '17') {
1468
-    			    $error = self::update_from_17();
1469
-    			    if ($error != '') return $error;
1470
-    			    else return self::check_version(true);
1471
-    			} elseif ($result['value'] == '18') {
1472
-    			    $error = self::update_from_18();
1473
-    			    if ($error != '') return $error;
1474
-    			    else return self::check_version(true);
1475
-    			} elseif ($result['value'] == '19') {
1476
-    			    $error = self::update_from_19();
1477
-    			    if ($error != '') return $error;
1478
-    			    else return self::check_version(true);
1479
-    			} elseif ($result['value'] == '20') {
1480
-    			    $error = self::update_from_20();
1481
-    			    if ($error != '') return $error;
1482
-    			    else return self::check_version(true);
1483
-    			} elseif ($result['value'] == '21') {
1484
-    			    $error = self::update_from_21();
1485
-    			    if ($error != '') return $error;
1486
-    			    else return self::check_version(true);
1487
-    			} elseif ($result['value'] == '22') {
1488
-    			    $error = self::update_from_22();
1489
-    			    if ($error != '') return $error;
1490
-    			    else return self::check_version(true);
1491
-    			} elseif ($result['value'] == '23') {
1492
-    			    $error = self::update_from_23();
1493
-    			    if ($error != '') return $error;
1494
-    			    else return self::check_version(true);
1495
-    			} elseif ($result['value'] == '24') {
1496
-    			    $error = self::update_from_24();
1497
-    			    if ($error != '') return $error;
1498
-    			    else return self::check_version(true);
1499
-    			} elseif ($result['value'] == '25') {
1500
-    			    $error = self::update_from_25();
1501
-    			    if ($error != '') return $error;
1502
-    			    else return self::check_version(true);
1503
-    			} elseif ($result['value'] == '26') {
1504
-    			    $error = self::update_from_26();
1505
-    			    if ($error != '') return $error;
1506
-    			    else return self::check_version(true);
1507
-    			} elseif ($result['value'] == '27') {
1508
-    			    $error = self::update_from_27();
1509
-    			    if ($error != '') return $error;
1510
-    			    else return self::check_version(true);
1511
-    			} elseif ($result['value'] == '28') {
1512
-    			    $error = self::update_from_28();
1513
-    			    if ($error != '') return $error;
1514
-    			    else return self::check_version(true);
1515
-    			} elseif ($result['value'] == '29') {
1516
-    			    $error = self::update_from_29();
1517
-    			    if ($error != '') return $error;
1518
-    			    else return self::check_version(true);
1519
-    			} elseif ($result['value'] == '30') {
1520
-    			    $error = self::update_from_30();
1521
-    			    if ($error != '') return $error;
1522
-    			    else return self::check_version(true);
1523
-    			} elseif ($result['value'] == '31') {
1524
-    			    $error = self::update_from_31();
1525
-    			    if ($error != '') return $error;
1526
-    			    else return self::check_version(true);
1527
-    			} elseif ($result['value'] == '32') {
1528
-    			    $error = self::update_from_32();
1529
-    			    if ($error != '') return $error;
1530
-    			    else return self::check_version(true);
1531
-    			} elseif ($result['value'] == '33') {
1532
-    			    $error = self::update_from_33();
1533
-    			    if ($error != '') return $error;
1534
-    			    else return self::check_version(true);
1535
-    			} else return '';
1536
-    		    }
1537
-    		    else return $result['value'];
1404
+				}
1405
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
1406
+				if ($update) {
1407
+				if ($result['value'] == '2') {
1408
+					$error = self::update_from_2();
1409
+					if ($error != '') return $error;
1410
+					else return self::check_version(true);
1411
+				} elseif ($result['value'] == '3') {
1412
+					$error = self::update_from_3();
1413
+					if ($error != '') return $error;
1414
+					else return self::check_version(true);
1415
+				} elseif ($result['value'] == '4') {
1416
+					$error = self::update_from_4();
1417
+					if ($error != '') return $error;
1418
+					else return self::check_version(true);
1419
+				} elseif ($result['value'] == '5') {
1420
+					$error = self::update_from_5();
1421
+					if ($error != '') return $error;
1422
+					else return self::check_version(true);
1423
+				} elseif ($result['value'] == '6') {
1424
+					$error = self::update_from_6();
1425
+					if ($error != '') return $error;
1426
+					else return self::check_version(true);
1427
+				} elseif ($result['value'] == '7') {
1428
+					$error = self::update_from_7();
1429
+					if ($error != '') return $error;
1430
+					else return self::check_version(true);
1431
+				} elseif ($result['value'] == '8') {
1432
+					$error = self::update_from_8();
1433
+					if ($error != '') return $error;
1434
+					else return self::check_version(true);
1435
+				} elseif ($result['value'] == '9') {
1436
+					$error = self::update_from_9();
1437
+					if ($error != '') return $error;
1438
+					else return self::check_version(true);
1439
+				} elseif ($result['value'] == '10') {
1440
+					$error = self::update_from_10();
1441
+					if ($error != '') return $error;
1442
+					else return self::check_version(true);
1443
+				} elseif ($result['value'] == '11') {
1444
+					$error = self::update_from_11();
1445
+					if ($error != '') return $error;
1446
+					else return self::check_version(true);
1447
+				} elseif ($result['value'] == '12') {
1448
+					$error = self::update_from_12();
1449
+					if ($error != '') return $error;
1450
+					else return self::check_version(true);
1451
+				} elseif ($result['value'] == '13') {
1452
+					$error = self::update_from_13();
1453
+					if ($error != '') return $error;
1454
+					else return self::check_version(true);
1455
+				} elseif ($result['value'] == '14') {
1456
+					$error = self::update_from_14();
1457
+					if ($error != '') return $error;
1458
+					else return self::check_version(true);
1459
+				} elseif ($result['value'] == '15') {
1460
+					$error = self::update_from_15();
1461
+					if ($error != '') return $error;
1462
+					else return self::check_version(true);
1463
+				} elseif ($result['value'] == '16') {
1464
+					$error = self::update_from_16();
1465
+					if ($error != '') return $error;
1466
+					else return self::check_version(true);
1467
+				} elseif ($result['value'] == '17') {
1468
+					$error = self::update_from_17();
1469
+					if ($error != '') return $error;
1470
+					else return self::check_version(true);
1471
+				} elseif ($result['value'] == '18') {
1472
+					$error = self::update_from_18();
1473
+					if ($error != '') return $error;
1474
+					else return self::check_version(true);
1475
+				} elseif ($result['value'] == '19') {
1476
+					$error = self::update_from_19();
1477
+					if ($error != '') return $error;
1478
+					else return self::check_version(true);
1479
+				} elseif ($result['value'] == '20') {
1480
+					$error = self::update_from_20();
1481
+					if ($error != '') return $error;
1482
+					else return self::check_version(true);
1483
+				} elseif ($result['value'] == '21') {
1484
+					$error = self::update_from_21();
1485
+					if ($error != '') return $error;
1486
+					else return self::check_version(true);
1487
+				} elseif ($result['value'] == '22') {
1488
+					$error = self::update_from_22();
1489
+					if ($error != '') return $error;
1490
+					else return self::check_version(true);
1491
+				} elseif ($result['value'] == '23') {
1492
+					$error = self::update_from_23();
1493
+					if ($error != '') return $error;
1494
+					else return self::check_version(true);
1495
+				} elseif ($result['value'] == '24') {
1496
+					$error = self::update_from_24();
1497
+					if ($error != '') return $error;
1498
+					else return self::check_version(true);
1499
+				} elseif ($result['value'] == '25') {
1500
+					$error = self::update_from_25();
1501
+					if ($error != '') return $error;
1502
+					else return self::check_version(true);
1503
+				} elseif ($result['value'] == '26') {
1504
+					$error = self::update_from_26();
1505
+					if ($error != '') return $error;
1506
+					else return self::check_version(true);
1507
+				} elseif ($result['value'] == '27') {
1508
+					$error = self::update_from_27();
1509
+					if ($error != '') return $error;
1510
+					else return self::check_version(true);
1511
+				} elseif ($result['value'] == '28') {
1512
+					$error = self::update_from_28();
1513
+					if ($error != '') return $error;
1514
+					else return self::check_version(true);
1515
+				} elseif ($result['value'] == '29') {
1516
+					$error = self::update_from_29();
1517
+					if ($error != '') return $error;
1518
+					else return self::check_version(true);
1519
+				} elseif ($result['value'] == '30') {
1520
+					$error = self::update_from_30();
1521
+					if ($error != '') return $error;
1522
+					else return self::check_version(true);
1523
+				} elseif ($result['value'] == '31') {
1524
+					$error = self::update_from_31();
1525
+					if ($error != '') return $error;
1526
+					else return self::check_version(true);
1527
+				} elseif ($result['value'] == '32') {
1528
+					$error = self::update_from_32();
1529
+					if ($error != '') return $error;
1530
+					else return self::check_version(true);
1531
+				} elseif ($result['value'] == '33') {
1532
+					$error = self::update_from_33();
1533
+					if ($error != '') return $error;
1534
+					else return self::check_version(true);
1535
+				} else return '';
1536
+				}
1537
+				else return $result['value'];
1538 1538
 		}
1539 1539
 		
1540
-	    } else return $version;
1541
-    	}
1540
+		} else return $version;
1541
+		}
1542 1542
     	
1543 1543
 }
1544 1544
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 412
     		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 430
             		$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+    		    } catch (PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 443
             	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445 445
             	    }
446 446
                 } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 497
     		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+    		if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) {
499
+    			$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+	    		} catch (PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505 505
     			}
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 602
     			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 664
     			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 674
     			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
682
+		if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684 684
     			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 694
     			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 824
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,36 +922,36 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948
-			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
948
+			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
949 949
 				// Add unique key
950 950
 				$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
951 951
 				try {
952 952
 					$sth = $Connection->db->prepare($query);
953 953
 					$sth->execute();
954
-				} catch(PDOException $e) {
954
+				} catch (PDOException $e) {
955 955
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
956 956
 				}
957 957
 			} else {
@@ -964,18 +964,18 @@  discard block
 block discarded – undo
964 964
 				try {
965 965
 					$sth = $Connection->db->prepare($query);
966 966
 					$sth->execute();
967
-				} catch(PDOException $e) {
967
+				} catch (PDOException $e) {
968 968
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
969 969
 				}
970 970
 			}
971 971
 		}
972
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
972
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
973 973
 			// Add forsource to airlines
974 974
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
975 975
 			try {
976 976
 				$sth = $Connection->db->prepare($query);
977 977
 				$sth->execute();
978
-			} catch(PDOException $e) {
978
+			} catch (PDOException $e) {
979 979
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
980 980
 			}
981 981
 			// Add unique key
@@ -987,17 +987,17 @@  discard block
 block discarded – undo
987 987
 			try {
988 988
 				$sth = $Connection->db->prepare($query);
989 989
 				$sth->execute();
990
-			} catch(PDOException $e) {
990
+			} catch (PDOException $e) {
991 991
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
992 992
 			}
993 993
 		}
994
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
994
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
995 995
 			// Add forsource to airlines
996 996
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
997 997
 			try {
998 998
 				$sth = $Connection->db->prepare($query);
999 999
 				$sth->execute();
1000
-			} catch(PDOException $e) {
1000
+			} catch (PDOException $e) {
1001 1001
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1002 1002
 			}
1003 1003
 			// Add unique key
@@ -1009,17 +1009,17 @@  discard block
 block discarded – undo
1009 1009
 			try {
1010 1010
 				$sth = $Connection->db->prepare($query);
1011 1011
 				$sth->execute();
1012
-			} catch(PDOException $e) {
1012
+			} catch (PDOException $e) {
1013 1013
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1014 1014
 			}
1015 1015
 		}
1016
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1016
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1017 1017
 			// Add forsource to airlines
1018 1018
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1019 1019
 			try {
1020 1020
 				$sth = $Connection->db->prepare($query);
1021 1021
 				$sth->execute();
1022
-			} catch(PDOException $e) {
1022
+			} catch (PDOException $e) {
1023 1023
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1024 1024
 			}
1025 1025
 			// Add unique key
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 			try {
1032 1032
 				$sth = $Connection->db->prepare($query);
1033 1033
 				$sth->execute();
1034
-			} catch(PDOException $e) {
1034
+			} catch (PDOException $e) {
1035 1035
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1036 1036
 			}
1037 1037
 		}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 		try {
1041 1041
 			$sth = $Connection->db->prepare($query);
1042 1042
 			$sth->execute();
1043
-		} catch(PDOException $e) {
1043
+		} catch (PDOException $e) {
1044 1044
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1045 1045
 		}
1046 1046
 		return $error;
@@ -1050,13 +1050,13 @@  discard block
 block discarded – undo
1050 1050
 		global $globalDBdriver;
1051 1051
 		$Connection = new Connection();
1052 1052
 		$error = '';
1053
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1053
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1054 1054
 			// Add forsource to airlines
1055 1055
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1056 1056
 			try {
1057 1057
 				$sth = $Connection->db->prepare($query);
1058 1058
 				$sth->execute();
1059
-			} catch(PDOException $e) {
1059
+			} catch (PDOException $e) {
1060 1060
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1061 1061
 			}
1062 1062
 			// Add unique key
@@ -1068,17 +1068,17 @@  discard block
 block discarded – undo
1068 1068
 			try {
1069 1069
 				$sth = $Connection->db->prepare($query);
1070 1070
 				$sth->execute();
1071
-			} catch(PDOException $e) {
1071
+			} catch (PDOException $e) {
1072 1072
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1073 1073
 			}
1074 1074
 		}
1075
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1075
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1076 1076
 			// Add forsource to airlines
1077 1077
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1078 1078
 			try {
1079 1079
 				$sth = $Connection->db->prepare($query);
1080 1080
 				$sth->execute();
1081
-			} catch(PDOException $e) {
1081
+			} catch (PDOException $e) {
1082 1082
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1083 1083
 			}
1084 1084
 			// Add unique key
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			try {
1091 1091
 				$sth = $Connection->db->prepare($query);
1092 1092
 				$sth->execute();
1093
-			} catch(PDOException $e) {
1093
+			} catch (PDOException $e) {
1094 1094
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1095 1095
 			}
1096 1096
 		}
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 		try {
1099 1099
 			$sth = $Connection->db->prepare($query);
1100 1100
 			$sth->execute();
1101
-		} catch(PDOException $e) {
1101
+		} catch (PDOException $e) {
1102 1102
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1103 1103
 		}
1104 1104
 		return $error;
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 		global $globalDBdriver;
1109 1109
 		$Connection = new Connection();
1110 1110
 		$error = '';
1111
-		if (!$Connection->checkColumnName('atc','format_source')) {
1111
+		if (!$Connection->checkColumnName('atc', 'format_source')) {
1112 1112
 			$query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL";
1113 1113
 			try {
1114 1114
 				$sth = $Connection->db->prepare($query);
1115 1115
 				$sth->execute();
1116
-			} catch(PDOException $e) {
1116
+			} catch (PDOException $e) {
1117 1117
 				return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n";
1118 1118
 			}
1119 1119
 		}
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 		try {
1122 1122
 			$sth = $Connection->db->prepare($query);
1123 1123
 			$sth->execute();
1124
-		} catch(PDOException $e) {
1124
+		} catch (PDOException $e) {
1125 1125
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1126 1126
 		}
1127 1127
 		return $error;
@@ -1131,13 +1131,13 @@  discard block
 block discarded – undo
1131 1131
 		global $globalDBdriver;
1132 1132
 		$Connection = new Connection();
1133 1133
 		$error = '';
1134
-		if (!$Connection->checkColumnName('stats_pilot','format_source')) {
1134
+		if (!$Connection->checkColumnName('stats_pilot', 'format_source')) {
1135 1135
 			// Add forsource to airlines
1136 1136
 			$query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''";
1137 1137
 			try {
1138 1138
 				$sth = $Connection->db->prepare($query);
1139 1139
 				$sth->execute();
1140
-			} catch(PDOException $e) {
1140
+			} catch (PDOException $e) {
1141 1141
 				return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n";
1142 1142
 			}
1143 1143
 			// Add unique key
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			try {
1150 1150
 				$sth = $Connection->db->prepare($query);
1151 1151
 				$sth->execute();
1152
-			} catch(PDOException $e) {
1152
+			} catch (PDOException $e) {
1153 1153
 				return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n";
1154 1154
 			}
1155 1155
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		try {
1158 1158
 			$sth = $Connection->db->prepare($query);
1159 1159
 			$sth->execute();
1160
-		} catch(PDOException $e) {
1160
+		} catch (PDOException $e) {
1161 1161
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1162 1162
 		}
1163 1163
 		return $error;
@@ -1167,23 +1167,23 @@  discard block
 block discarded – undo
1167 1167
 		global $globalDBdriver;
1168 1168
 		$Connection = new Connection();
1169 1169
 		$error = '';
1170
-		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) {
1170
+		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) {
1171 1171
 			// Add unique key
1172 1172
 			$query = "alter table spotter_live add index(latitude,longitude)";
1173 1173
 			try {
1174 1174
 				$sth = $Connection->db->prepare($query);
1175 1175
 				$sth->execute();
1176
-			} catch(PDOException $e) {
1176
+			} catch (PDOException $e) {
1177 1177
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1178 1178
 			}
1179 1179
                 }
1180
-		if (!$Connection->checkColumnName('aircraft','mfr')) {
1180
+		if (!$Connection->checkColumnName('aircraft', 'mfr')) {
1181 1181
 			// Add mfr to aircraft
1182 1182
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
1183 1183
 			try {
1184 1184
 				$sth = $Connection->db->prepare($query);
1185 1185
 				$sth->execute();
1186
-			} catch(PDOException $e) {
1186
+			} catch (PDOException $e) {
1187 1187
 				return "error (add mfr column in aircraft) : ".$e->getMessage()."\n";
1188 1188
 			}
1189 1189
 		}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		try {
1200 1200
 			$sth = $Connection->db->prepare($query);
1201 1201
 			$sth->execute();
1202
-		} catch(PDOException $e) {
1202
+		} catch (PDOException $e) {
1203 1203
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1204 1204
 		}
1205 1205
 		return $error;
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 		global $globalDBdriver;
1210 1210
 		$Connection = new Connection();
1211 1211
 		$error = '';
1212
-		if ($Connection->checkColumnName('aircraft','mfr')) {
1212
+		if ($Connection->checkColumnName('aircraft', 'mfr')) {
1213 1213
 			// drop mfr to aircraft
1214 1214
 			$query = "ALTER TABLE aircraft DROP COLUMN mfr";
1215 1215
 			try {
1216 1216
 				$sth = $Connection->db->prepare($query);
1217 1217
 				$sth->execute();
1218
-			} catch(PDOException $e) {
1218
+			} catch (PDOException $e) {
1219 1219
 				return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n";
1220 1220
 			}
1221 1221
 		}
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		try {
1232 1232
 			$sth = $Connection->db->prepare($query);
1233 1233
 			$sth->execute();
1234
-		} catch(PDOException $e) {
1234
+		} catch (PDOException $e) {
1235 1235
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1236 1236
 		}
1237 1237
 		return $error;
@@ -1241,33 +1241,33 @@  discard block
 block discarded – undo
1241 1241
 		global $globalDBdriver;
1242 1242
 		$Connection = new Connection();
1243 1243
 		$error = '';
1244
-		if (!$Connection->indexExists('notam','ref_idx')) {
1244
+		if (!$Connection->indexExists('notam', 'ref_idx')) {
1245 1245
 			// Add index key
1246 1246
 			$query = "create index ref_idx on notam (ref)";
1247 1247
 			try {
1248 1248
 				$sth = $Connection->db->prepare($query);
1249 1249
 				$sth->execute();
1250
-			} catch(PDOException $e) {
1250
+			} catch (PDOException $e) {
1251 1251
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1252 1252
 			}
1253 1253
                 }
1254
-		if (!$Connection->indexExists('accidents','registration_idx')) {
1254
+		if (!$Connection->indexExists('accidents', 'registration_idx')) {
1255 1255
 			// Add index key
1256 1256
 			$query = "create index registration_idx on accidents (registration)";
1257 1257
 			try {
1258 1258
 				$sth = $Connection->db->prepare($query);
1259 1259
 				$sth->execute();
1260
-			} catch(PDOException $e) {
1260
+			} catch (PDOException $e) {
1261 1261
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1262 1262
 			}
1263 1263
                 }
1264
-		if (!$Connection->indexExists('accidents','rdts')) {
1264
+		if (!$Connection->indexExists('accidents', 'rdts')) {
1265 1265
 			// Add index key
1266 1266
 			$query = "create index rdts on accidents (registration,date,type,source)";
1267 1267
 			try {
1268 1268
 				$sth = $Connection->db->prepare($query);
1269 1269
 				$sth->execute();
1270
-			} catch(PDOException $e) {
1270
+			} catch (PDOException $e) {
1271 1271
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1272 1272
 			}
1273 1273
                 }
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 		try {
1277 1277
 			$sth = $Connection->db->prepare($query);
1278 1278
 			$sth->execute();
1279
-		} catch(PDOException $e) {
1279
+		} catch (PDOException $e) {
1280 1280
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1281 1281
 		}
1282 1282
 		return $error;
@@ -1286,23 +1286,23 @@  discard block
 block discarded – undo
1286 1286
 		global $globalDBdriver;
1287 1287
 		$Connection = new Connection();
1288 1288
 		$error = '';
1289
-		if (!$Connection->checkColumnName('accidents','airline_name')) {
1289
+		if (!$Connection->checkColumnName('accidents', 'airline_name')) {
1290 1290
 			// Add airline_name to accidents
1291 1291
 			$query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL";
1292 1292
 			try {
1293 1293
 				$sth = $Connection->db->prepare($query);
1294 1294
 				$sth->execute();
1295
-			} catch(PDOException $e) {
1295
+			} catch (PDOException $e) {
1296 1296
 				return "error (add airline_name column in accidents) : ".$e->getMessage()."\n";
1297 1297
 			}
1298 1298
 		}
1299
-		if (!$Connection->checkColumnName('accidents','airline_icao')) {
1299
+		if (!$Connection->checkColumnName('accidents', 'airline_icao')) {
1300 1300
 			// Add airline_icao to accidents
1301 1301
 			$query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL";
1302 1302
 			try {
1303 1303
 				$sth = $Connection->db->prepare($query);
1304 1304
 				$sth->execute();
1305
-			} catch(PDOException $e) {
1305
+			} catch (PDOException $e) {
1306 1306
 				return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n";
1307 1307
 			}
1308 1308
 		}
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 		try {
1311 1311
 			$sth = $Connection->db->prepare($query);
1312 1312
 			$sth->execute();
1313
-		} catch(PDOException $e) {
1313
+		} catch (PDOException $e) {
1314 1314
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1315 1315
 		}
1316 1316
 		return $error;
@@ -1320,13 +1320,13 @@  discard block
 block discarded – undo
1320 1320
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1321 1321
 		$Connection = new Connection();
1322 1322
 		$error = '';
1323
-		if (!$Connection->checkColumnName('airlines','alliance')) {
1323
+		if (!$Connection->checkColumnName('airlines', 'alliance')) {
1324 1324
 			// Add alliance to airlines
1325 1325
 			$query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL";
1326 1326
 			try {
1327 1327
 				$sth = $Connection->db->prepare($query);
1328 1328
 				$sth->execute();
1329
-			} catch(PDOException $e) {
1329
+			} catch (PDOException $e) {
1330 1330
 				return "error (add alliance column in airlines) : ".$e->getMessage()."\n";
1331 1331
 			}
1332 1332
 		}
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 		try {
1354 1354
 			$sth = $Connection->db->prepare($query);
1355 1355
 			$sth->execute();
1356
-		} catch(PDOException $e) {
1356
+		} catch (PDOException $e) {
1357 1357
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1358 1358
 		}
1359 1359
 		return $error;
@@ -1363,13 +1363,13 @@  discard block
 block discarded – undo
1363 1363
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1364 1364
 		$Connection = new Connection();
1365 1365
 		$error = '';
1366
-		if (!$Connection->checkColumnName('airlines','ban_eu')) {
1366
+		if (!$Connection->checkColumnName('airlines', 'ban_eu')) {
1367 1367
 			// Add ban_eu to airlines
1368 1368
 			$query = "ALTER TABLE airlines ADD ban_eu INTEGER NOT NULL DEFAULT '0'";
1369 1369
 			try {
1370 1370
 				$sth = $Connection->db->prepare($query);
1371 1371
 				$sth->execute();
1372
-			} catch(PDOException $e) {
1372
+			} catch (PDOException $e) {
1373 1373
 				return "error (add ban_eu column in airlines) : ".$e->getMessage()."\n";
1374 1374
 			}
1375 1375
 		}
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 		try {
1378 1378
 			$sth = $Connection->db->prepare($query);
1379 1379
 			$sth->execute();
1380
-		} catch(PDOException $e) {
1380
+		} catch (PDOException $e) {
1381 1381
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1382 1382
 		}
1383 1383
 		return $error;
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 		    try {
1400 1400
             		$sth = $Connection->db->prepare($query);
1401 1401
 		        $sth->execute();
1402
-		    } catch(PDOException $e) {
1402
+		    } catch (PDOException $e) {
1403 1403
 			return "error : ".$e->getMessage()."\n";
1404 1404
     		    }
1405 1405
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +272 added lines, -102 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1332,20 +1390,28 @@  discard block
 block discarded – undo
1332 1390
 		}
1333 1391
 		if ($globalDBdriver == 'mysql') {
1334 1392
 			$error .= create_db::import_file('../db/airlines.sql');
1335
-			if ($error != '') return $error;
1393
+			if ($error != '') {
1394
+				return $error;
1395
+			}
1336 1396
 		} else {
1337 1397
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1338
-			if ($error != '') return $error;
1398
+			if ($error != '') {
1399
+				return $error;
1400
+			}
1339 1401
 		}
1340 1402
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1341 1403
 			include_once(dirname(__FILE__).'/class.update_db.php');
1342 1404
 			if (isset($globalVATSIM) && $globalVATSIM) {
1343 1405
 				$error .= update_db::update_vatsim();
1344
-				if ($error != '') return $error;
1406
+				if ($error != '') {
1407
+					return $error;
1408
+				}
1345 1409
 			}
1346 1410
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1347 1411
 				$error .= update_db::update_IVAO();
1348
-				if ($error != '') return $error;
1412
+				if ($error != '') {
1413
+					return $error;
1414
+				}
1349 1415
 			}
1350 1416
 		}
1351 1417
 
@@ -1391,8 +1457,11 @@  discard block
 block discarded – undo
1391 1457
     	    if ($Connection->tableExists('aircraft')) {
1392 1458
     		if (!$Connection->tableExists('config')) {
1393 1459
     		    $version = '1';
1394
-    		    if ($update) return self::update_from_1();
1395
-    		    else return $version;
1460
+    		    if ($update) {
1461
+    		    	return self::update_from_1();
1462
+    		    } else {
1463
+    		    	return $version;
1464
+    		    }
1396 1465
 		} else {
1397 1466
     		    $Connection = new Connection();
1398 1467
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -1406,138 +1475,239 @@  discard block
 block discarded – undo
1406 1475
     		    if ($update) {
1407 1476
     			if ($result['value'] == '2') {
1408 1477
     			    $error = self::update_from_2();
1409
-    			    if ($error != '') return $error;
1410
-    			    else return self::check_version(true);
1478
+    			    if ($error != '') {
1479
+    			    	return $error;
1480
+    			    } else {
1481
+    			    	return self::check_version(true);
1482
+    			    }
1411 1483
     			} elseif ($result['value'] == '3') {
1412 1484
     			    $error = self::update_from_3();
1413
-    			    if ($error != '') return $error;
1414
-    			    else return self::check_version(true);
1485
+    			    if ($error != '') {
1486
+    			    	return $error;
1487
+    			    } else {
1488
+    			    	return self::check_version(true);
1489
+    			    }
1415 1490
     			} elseif ($result['value'] == '4') {
1416 1491
     			    $error = self::update_from_4();
1417
-    			    if ($error != '') return $error;
1418
-    			    else return self::check_version(true);
1492
+    			    if ($error != '') {
1493
+    			    	return $error;
1494
+    			    } else {
1495
+    			    	return self::check_version(true);
1496
+    			    }
1419 1497
     			} elseif ($result['value'] == '5') {
1420 1498
     			    $error = self::update_from_5();
1421
-    			    if ($error != '') return $error;
1422
-    			    else return self::check_version(true);
1499
+    			    if ($error != '') {
1500
+    			    	return $error;
1501
+    			    } else {
1502
+    			    	return self::check_version(true);
1503
+    			    }
1423 1504
     			} elseif ($result['value'] == '6') {
1424 1505
     			    $error = self::update_from_6();
1425
-    			    if ($error != '') return $error;
1426
-    			    else return self::check_version(true);
1506
+    			    if ($error != '') {
1507
+    			    	return $error;
1508
+    			    } else {
1509
+    			    	return self::check_version(true);
1510
+    			    }
1427 1511
     			} elseif ($result['value'] == '7') {
1428 1512
     			    $error = self::update_from_7();
1429
-    			    if ($error != '') return $error;
1430
-    			    else return self::check_version(true);
1513
+    			    if ($error != '') {
1514
+    			    	return $error;
1515
+    			    } else {
1516
+    			    	return self::check_version(true);
1517
+    			    }
1431 1518
     			} elseif ($result['value'] == '8') {
1432 1519
     			    $error = self::update_from_8();
1433
-    			    if ($error != '') return $error;
1434
-    			    else return self::check_version(true);
1520
+    			    if ($error != '') {
1521
+    			    	return $error;
1522
+    			    } else {
1523
+    			    	return self::check_version(true);
1524
+    			    }
1435 1525
     			} elseif ($result['value'] == '9') {
1436 1526
     			    $error = self::update_from_9();
1437
-    			    if ($error != '') return $error;
1438
-    			    else return self::check_version(true);
1527
+    			    if ($error != '') {
1528
+    			    	return $error;
1529
+    			    } else {
1530
+    			    	return self::check_version(true);
1531
+    			    }
1439 1532
     			} elseif ($result['value'] == '10') {
1440 1533
     			    $error = self::update_from_10();
1441
-    			    if ($error != '') return $error;
1442
-    			    else return self::check_version(true);
1534
+    			    if ($error != '') {
1535
+    			    	return $error;
1536
+    			    } else {
1537
+    			    	return self::check_version(true);
1538
+    			    }
1443 1539
     			} elseif ($result['value'] == '11') {
1444 1540
     			    $error = self::update_from_11();
1445
-    			    if ($error != '') return $error;
1446
-    			    else return self::check_version(true);
1541
+    			    if ($error != '') {
1542
+    			    	return $error;
1543
+    			    } else {
1544
+    			    	return self::check_version(true);
1545
+    			    }
1447 1546
     			} elseif ($result['value'] == '12') {
1448 1547
     			    $error = self::update_from_12();
1449
-    			    if ($error != '') return $error;
1450
-    			    else return self::check_version(true);
1548
+    			    if ($error != '') {
1549
+    			    	return $error;
1550
+    			    } else {
1551
+    			    	return self::check_version(true);
1552
+    			    }
1451 1553
     			} elseif ($result['value'] == '13') {
1452 1554
     			    $error = self::update_from_13();
1453
-    			    if ($error != '') return $error;
1454
-    			    else return self::check_version(true);
1555
+    			    if ($error != '') {
1556
+    			    	return $error;
1557
+    			    } else {
1558
+    			    	return self::check_version(true);
1559
+    			    }
1455 1560
     			} elseif ($result['value'] == '14') {
1456 1561
     			    $error = self::update_from_14();
1457
-    			    if ($error != '') return $error;
1458
-    			    else return self::check_version(true);
1562
+    			    if ($error != '') {
1563
+    			    	return $error;
1564
+    			    } else {
1565
+    			    	return self::check_version(true);
1566
+    			    }
1459 1567
     			} elseif ($result['value'] == '15') {
1460 1568
     			    $error = self::update_from_15();
1461
-    			    if ($error != '') return $error;
1462
-    			    else return self::check_version(true);
1569
+    			    if ($error != '') {
1570
+    			    	return $error;
1571
+    			    } else {
1572
+    			    	return self::check_version(true);
1573
+    			    }
1463 1574
     			} elseif ($result['value'] == '16') {
1464 1575
     			    $error = self::update_from_16();
1465
-    			    if ($error != '') return $error;
1466
-    			    else return self::check_version(true);
1576
+    			    if ($error != '') {
1577
+    			    	return $error;
1578
+    			    } else {
1579
+    			    	return self::check_version(true);
1580
+    			    }
1467 1581
     			} elseif ($result['value'] == '17') {
1468 1582
     			    $error = self::update_from_17();
1469
-    			    if ($error != '') return $error;
1470
-    			    else return self::check_version(true);
1583
+    			    if ($error != '') {
1584
+    			    	return $error;
1585
+    			    } else {
1586
+    			    	return self::check_version(true);
1587
+    			    }
1471 1588
     			} elseif ($result['value'] == '18') {
1472 1589
     			    $error = self::update_from_18();
1473
-    			    if ($error != '') return $error;
1474
-    			    else return self::check_version(true);
1590
+    			    if ($error != '') {
1591
+    			    	return $error;
1592
+    			    } else {
1593
+    			    	return self::check_version(true);
1594
+    			    }
1475 1595
     			} elseif ($result['value'] == '19') {
1476 1596
     			    $error = self::update_from_19();
1477
-    			    if ($error != '') return $error;
1478
-    			    else return self::check_version(true);
1597
+    			    if ($error != '') {
1598
+    			    	return $error;
1599
+    			    } else {
1600
+    			    	return self::check_version(true);
1601
+    			    }
1479 1602
     			} elseif ($result['value'] == '20') {
1480 1603
     			    $error = self::update_from_20();
1481
-    			    if ($error != '') return $error;
1482
-    			    else return self::check_version(true);
1604
+    			    if ($error != '') {
1605
+    			    	return $error;
1606
+    			    } else {
1607
+    			    	return self::check_version(true);
1608
+    			    }
1483 1609
     			} elseif ($result['value'] == '21') {
1484 1610
     			    $error = self::update_from_21();
1485
-    			    if ($error != '') return $error;
1486
-    			    else return self::check_version(true);
1611
+    			    if ($error != '') {
1612
+    			    	return $error;
1613
+    			    } else {
1614
+    			    	return self::check_version(true);
1615
+    			    }
1487 1616
     			} elseif ($result['value'] == '22') {
1488 1617
     			    $error = self::update_from_22();
1489
-    			    if ($error != '') return $error;
1490
-    			    else return self::check_version(true);
1618
+    			    if ($error != '') {
1619
+    			    	return $error;
1620
+    			    } else {
1621
+    			    	return self::check_version(true);
1622
+    			    }
1491 1623
     			} elseif ($result['value'] == '23') {
1492 1624
     			    $error = self::update_from_23();
1493
-    			    if ($error != '') return $error;
1494
-    			    else return self::check_version(true);
1625
+    			    if ($error != '') {
1626
+    			    	return $error;
1627
+    			    } else {
1628
+    			    	return self::check_version(true);
1629
+    			    }
1495 1630
     			} elseif ($result['value'] == '24') {
1496 1631
     			    $error = self::update_from_24();
1497
-    			    if ($error != '') return $error;
1498
-    			    else return self::check_version(true);
1632
+    			    if ($error != '') {
1633
+    			    	return $error;
1634
+    			    } else {
1635
+    			    	return self::check_version(true);
1636
+    			    }
1499 1637
     			} elseif ($result['value'] == '25') {
1500 1638
     			    $error = self::update_from_25();
1501
-    			    if ($error != '') return $error;
1502
-    			    else return self::check_version(true);
1639
+    			    if ($error != '') {
1640
+    			    	return $error;
1641
+    			    } else {
1642
+    			    	return self::check_version(true);
1643
+    			    }
1503 1644
     			} elseif ($result['value'] == '26') {
1504 1645
     			    $error = self::update_from_26();
1505
-    			    if ($error != '') return $error;
1506
-    			    else return self::check_version(true);
1646
+    			    if ($error != '') {
1647
+    			    	return $error;
1648
+    			    } else {
1649
+    			    	return self::check_version(true);
1650
+    			    }
1507 1651
     			} elseif ($result['value'] == '27') {
1508 1652
     			    $error = self::update_from_27();
1509
-    			    if ($error != '') return $error;
1510
-    			    else return self::check_version(true);
1653
+    			    if ($error != '') {
1654
+    			    	return $error;
1655
+    			    } else {
1656
+    			    	return self::check_version(true);
1657
+    			    }
1511 1658
     			} elseif ($result['value'] == '28') {
1512 1659
     			    $error = self::update_from_28();
1513
-    			    if ($error != '') return $error;
1514
-    			    else return self::check_version(true);
1660
+    			    if ($error != '') {
1661
+    			    	return $error;
1662
+    			    } else {
1663
+    			    	return self::check_version(true);
1664
+    			    }
1515 1665
     			} elseif ($result['value'] == '29') {
1516 1666
     			    $error = self::update_from_29();
1517
-    			    if ($error != '') return $error;
1518
-    			    else return self::check_version(true);
1667
+    			    if ($error != '') {
1668
+    			    	return $error;
1669
+    			    } else {
1670
+    			    	return self::check_version(true);
1671
+    			    }
1519 1672
     			} elseif ($result['value'] == '30') {
1520 1673
     			    $error = self::update_from_30();
1521
-    			    if ($error != '') return $error;
1522
-    			    else return self::check_version(true);
1674
+    			    if ($error != '') {
1675
+    			    	return $error;
1676
+    			    } else {
1677
+    			    	return self::check_version(true);
1678
+    			    }
1523 1679
     			} elseif ($result['value'] == '31') {
1524 1680
     			    $error = self::update_from_31();
1525
-    			    if ($error != '') return $error;
1526
-    			    else return self::check_version(true);
1681
+    			    if ($error != '') {
1682
+    			    	return $error;
1683
+    			    } else {
1684
+    			    	return self::check_version(true);
1685
+    			    }
1527 1686
     			} elseif ($result['value'] == '32') {
1528 1687
     			    $error = self::update_from_32();
1529
-    			    if ($error != '') return $error;
1530
-    			    else return self::check_version(true);
1688
+    			    if ($error != '') {
1689
+    			    	return $error;
1690
+    			    } else {
1691
+    			    	return self::check_version(true);
1692
+    			    }
1531 1693
     			} elseif ($result['value'] == '33') {
1532 1694
     			    $error = self::update_from_33();
1533
-    			    if ($error != '') return $error;
1534
-    			    else return self::check_version(true);
1535
-    			} else return '';
1695
+    			    if ($error != '') {
1696
+    			    	return $error;
1697
+    			    } else {
1698
+    			    	return self::check_version(true);
1699
+    			    }
1700
+    			} else {
1701
+    				return '';
1702
+    			}
1703
+    		    } else {
1704
+    		    	return $result['value'];
1536 1705
     		    }
1537
-    		    else return $result['value'];
1538 1706
 		}
1539 1707
 		
1540
-	    } else return $version;
1708
+	    } else {
1709
+	    	return $version;
1710
+	    }
1541 1711
     	}
1542 1712
     	
1543 1713
 }
Please login to merge, or discard this patch.
require/class.Common.php 4 patches
Doc Comments   +9 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,6 +79,10 @@  discard block
 block discarded – undo
79 79
 		return strlen($headerLine); // Needed by curl
80 80
 	}
81 81
 
82
+	/**
83
+	 * @param string $url
84
+	 * @param string $file
85
+	 */
82 86
 	public static function download($url, $file, $referer = '') {
83 87
 		global $globalDebug;
84 88
 		$fp = fopen($file, 'w');
@@ -179,7 +183,7 @@  discard block
 block discarded – undo
179 183
 	* Check is distance realistic
180 184
 	* @param int $timeDifference the time between the reception of both messages
181 185
 	* @param float $distance distance covered
182
-	* @return whether distance is realistic
186
+	* @return boolean distance is realistic
183 187
 	*/
184 188
 	public function withinThreshold ($timeDifference, $distance) {
185 189
 		$x = abs($timeDifference);
@@ -202,6 +206,9 @@  discard block
 block discarded – undo
202 206
 	}
203 207
 
204 208
 
209
+	/**
210
+	 * @param string $latlong
211
+	 */
205 212
 	public function convertDec($dms,$latlong) {
206 213
 		if ($latlong == 'latitude') {
207 214
 			$deg = substr($dms, 0, 2);
@@ -303,7 +310,7 @@  discard block
 block discarded – undo
303 310
 	/**
304 311
 	* Returns list of available locales
305 312
 	*
306
-	* @return array
313
+	* @return string[]
307 314
 	 */
308 315
 	public function listLocaleDir()
309 316
 	{
Please login to merge, or discard this patch.
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 	//protected $cookies = array();
7 7
 	
8 8
 	/**
9
-	* Get data from form result
10
-	* @param String $url form URL
11
-	* @param String $type type of submit form method (get or post)
12
-	* @param String|Array $data values form post method
13
-	* @param Array $headers header to submit with the form
14
-	* @return String the result
15
-	*/
9
+	 * Get data from form result
10
+	 * @param String $url form URL
11
+	 * @param String $type type of submit form method (get or post)
12
+	 * @param String|Array $data values form post method
13
+	 * @param Array $headers header to submit with the form
14
+	 * @return String the result
15
+	 */
16 16
 	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
17 17
 		$ch = curl_init();
18 18
 		curl_setopt($ch, CURLOPT_URL, $url);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
68 68
 			}
69 69
 		} else {
70
-		    return $result;
70
+			return $result;
71 71
 		}
72 72
 	}
73 73
 	
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 	
98 98
 	/**
99
-	* Convert a HTML table to an array
100
-	* @param String $data HTML page
101
-	* @return Array array of the tables in HTML page
102
-	*/
99
+	 * Convert a HTML table to an array
100
+	 * @param String $data HTML page
101
+	 * @return Array array of the tables in HTML page
102
+	 */
103 103
 	public function table2array($data) {
104 104
 		if (!is_string($data)) return array();
105 105
 		if ($data == '') return array();
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	}
134 134
 	
135 135
 	/**
136
-	* Convert <p> part of a HTML page to an array
137
-	* @param String $data HTML page
138
-	* @return Array array of the <p> in HTML page
139
-	*/
136
+	 * Convert <p> part of a HTML page to an array
137
+	 * @param String $data HTML page
138
+	 * @return Array array of the <p> in HTML page
139
+	 */
140 140
 	public function text2array($data) {
141 141
 		$html = str_get_html($data);
142 142
 		if ($html === false) return array();
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	/**
154
-	* Give distance between 2 coordonnates
155
-	* @param Float $lat latitude of first point
156
-	* @param Float $lon longitude of first point
157
-	* @param Float $latc latitude of second point
158
-	* @param Float $lonc longitude of second point
159
-	* @param String $unit km else no unit used
160
-	* @return Float Distance in $unit
161
-	*/
154
+	 * Give distance between 2 coordonnates
155
+	 * @param Float $lat latitude of first point
156
+	 * @param Float $lon longitude of first point
157
+	 * @param Float $latc latitude of second point
158
+	 * @param Float $lonc longitude of second point
159
+	 * @param String $unit km else no unit used
160
+	 * @return Float Distance in $unit
161
+	 */
162 162
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
163 163
 		if ($lat == $latc && $lon == $lonc) return 0;
164 164
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 
178 178
 	/**
179
-	* Check is distance realistic
180
-	* @param int $timeDifference the time between the reception of both messages
181
-	* @param float $distance distance covered
182
-	* @return whether distance is realistic
183
-	*/
179
+	 * Check is distance realistic
180
+	 * @param int $timeDifference the time between the reception of both messages
181
+	 * @param float $distance distance covered
182
+	 * @return whether distance is realistic
183
+	 */
184 184
 	public function withinThreshold ($timeDifference, $distance) {
185 185
 		$x = abs($timeDifference);
186 186
 		$d = abs($distance);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	}
199 199
 
200 200
 	public function isInteger($input){
201
-	    return(ctype_digit(strval($input)));
201
+		return(ctype_digit(strval($input)));
202 202
 	}
203 203
 
204 204
 
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 	
216 216
 	/**
217
-	* Copy folder contents
218
-	* @param       string   $source    Source path
219
-	* @param       string   $dest      Destination path
220
-	* @return      bool     Returns true on success, false on failure
221
-	*/
217
+	 * Copy folder contents
218
+	 * @param       string   $source    Source path
219
+	 * @param       string   $dest      Destination path
220
+	 * @return      bool     Returns true on success, false on failure
221
+	 */
222 222
 	public function xcopy($source, $dest)
223 223
 	{
224 224
 		$files = glob($source.'*.*');
@@ -230,20 +230,20 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 	
232 232
 	/**
233
-	* Check if an url exist
234
-	* @param	String $url url to check
235
-	* @return	bool Return true on succes false on failure
236
-	*/
233
+	 * Check if an url exist
234
+	 * @param	String $url url to check
235
+	 * @return	bool Return true on succes false on failure
236
+	 */
237 237
 	public function urlexist($url){
238 238
 		$headers=get_headers($url);
239 239
 		return stripos($headers[0],"200 OK")?true:false;
240 240
 	}
241 241
 	
242 242
 	/**
243
-	* Convert hexa to string
244
-	* @param	String $hex data in hexa
245
-	* @return	String Return result
246
-	*/
243
+	 * Convert hexa to string
244
+	 * @param	String $hex data in hexa
245
+	 * @return	String Return result
246
+	 */
247 247
 	public function hex2str($hex) {
248 248
 		$str = '';
249 249
 		$hexln = strlen($hex);
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 	}
302 302
 	
303 303
 	/**
304
-	* Returns list of available locales
305
-	*
306
-	* @return array
304
+	 * Returns list of available locales
305
+	 *
306
+	 * @return array
307 307
 	 */
308 308
 	public function listLocaleDir()
309 309
 	{
@@ -398,100 +398,100 @@  discard block
 block discarded – undo
398 398
 	public function remove_accents($string) {
399 399
 		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
400 400
 		$chars = array(
401
-		    // Decompositions for Latin-1 Supplement
402
-		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
403
-		    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
404
-		    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
405
-		    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
406
-		    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
407
-		    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
408
-		    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
409
-		    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
410
-		    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
411
-		    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
412
-		    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
413
-		    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
414
-		    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
415
-		    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
416
-		    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
417
-		    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
418
-		    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
419
-		    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
420
-		    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
421
-		    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
422
-		    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
423
-		    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
424
-		    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
425
-		    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
426
-		    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
427
-		    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
428
-		    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
429
-		    chr(195).chr(191) => 'y',
430
-		    // Decompositions for Latin Extended-A
431
-		    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
432
-		    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
433
-		    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
434
-		    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
435
-		    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
436
-		    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
437
-		    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
438
-		    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
439
-		    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
440
-		    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
441
-		    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
442
-		    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
443
-		    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
444
-		    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
445
-		    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
446
-		    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
447
-		    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
448
-		    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
449
-		    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
450
-		    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
451
-		    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
452
-		    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
453
-		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
454
-		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
455
-		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
456
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
457
-		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
458
-		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
459
-		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
460
-		    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
461
-		    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
462
-		    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
463
-		    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
464
-		    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
465
-		    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
466
-		    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
467
-		    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
468
-		    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
469
-		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
470
-		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
471
-		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
472
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
473
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
474
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
475
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
476
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
477
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
478
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
479
-		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
480
-		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
481
-		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
482
-		    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
483
-		    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
484
-		    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
485
-		    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
486
-		    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
487
-		    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
488
-		    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
489
-		    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
490
-		    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
491
-		    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
492
-		    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
493
-		    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
494
-		    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
401
+			// Decompositions for Latin-1 Supplement
402
+			chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
403
+			chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
404
+			chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
405
+			chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
406
+			chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
407
+			chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
408
+			chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
409
+			chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
410
+			chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
411
+			chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
412
+			chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
413
+			chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
414
+			chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
415
+			chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
416
+			chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
417
+			chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
418
+			chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
419
+			chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
420
+			chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
421
+			chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
422
+			chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
423
+			chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
424
+			chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
425
+			chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
426
+			chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
427
+			chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
428
+			chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
429
+			chr(195).chr(191) => 'y',
430
+			// Decompositions for Latin Extended-A
431
+			chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
432
+			chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
433
+			chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
434
+			chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
435
+			chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
436
+			chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
437
+			chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
438
+			chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
439
+			chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
440
+			chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
441
+			chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
442
+			chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
443
+			chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
444
+			chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
445
+			chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
446
+			chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
447
+			chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
448
+			chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
449
+			chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
450
+			chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
451
+			chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
452
+			chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
453
+			chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
454
+			chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
455
+			chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
456
+			chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
457
+			chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
458
+			chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
459
+			chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
460
+			chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
461
+			chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
462
+			chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
463
+			chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
464
+			chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
465
+			chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
466
+			chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
467
+			chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
468
+			chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
469
+			chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
470
+			chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
471
+			chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
472
+			chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
473
+			chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
474
+			chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
475
+			chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
476
+			chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
477
+			chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
478
+			chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
479
+			chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
480
+			chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
481
+			chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
482
+			chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
483
+			chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
484
+			chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
485
+			chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
486
+			chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
487
+			chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
488
+			chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
489
+			chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
490
+			chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
491
+			chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
492
+			chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
493
+			chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
494
+			chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
495 495
 		);
496 496
 		$string = strtr($string, $chars);
497 497
 		return $string;
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 	* @param Array $headers header to submit with the form
14 14
 	* @return String the result
15 15
 	*/
16
-	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
16
+	public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') {
17 17
 		$ch = curl_init();
18 18
 		curl_setopt($ch, CURLOPT_URL, $url);
19 19
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
20 20
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
21 21
 		curl_setopt($ch, CURLINFO_HEADER_OUT, true); 
22
-		curl_setopt($ch,CURLOPT_ENCODING , "gzip");
22
+		curl_setopt($ch, CURLOPT_ENCODING, "gzip");
23 23
 		//curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
24 24
 //		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0');
25 25
 		if ($useragent == '') {
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 		}
30 30
 		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
31 31
 		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
32
-		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
32
+		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback"));
33 33
 		if ($type == 'post') {
34 34
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
35 35
 			if (is_array($data)) {
36 36
 				curl_setopt($ch, CURLOPT_POST, count($data));
37 37
 				$data_string = '';
38
-				foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
38
+				foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
39 39
 				rtrim($data_string, '&');
40 40
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
41 41
 			} else {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 		if ($cookie != '') {
49 49
 			if (is_array($cookie)) {
50
-				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';'));
50
+				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';'));
51 51
 			} else {
52 52
 				curl_setopt($ch, CURLOPT_COOKIE, $cookie);
53 53
 			}
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 		$result = curl_exec($ch);
59 59
 		$info = curl_getinfo($ch);
60 60
 		curl_close($ch);
61
-		if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) {
61
+		if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) {
62 62
 			echo "Cloudflare Detected\n";
63 63
 			require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php');
64 64
 			$useragent = UAgent::random();
65 65
 			cloudflare::useUserAgent($useragent);
66 66
 			if ($clearanceCookie = cloudflare::bypass($url)) {
67
-				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
67
+				return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent);
68 68
 			}
69 69
 		} else {
70 70
 		    return $result;
@@ -105,27 +105,27 @@  discard block
 block discarded – undo
105 105
 		if ($data == '') return array();
106 106
 		$html = str_get_html($data);
107 107
 		if ($html === false) return array();
108
-		$tabledata=array();
109
-		foreach($html->find('tr') as $element)
108
+		$tabledata = array();
109
+		foreach ($html->find('tr') as $element)
110 110
 		{
111 111
 			$td = array();
112
-			foreach( $element->find('th') as $row)
112
+			foreach ($element->find('th') as $row)
113 113
 			{
114 114
 				$td [] = trim($row->plaintext);
115 115
 			}
116
-			$td=array_filter($td);
116
+			$td = array_filter($td);
117 117
 			$tabledata[] = $td;
118 118
 
119 119
 			$td = array();
120 120
 			$tdi = array();
121
-			foreach( $element->find('td') as $row)
121
+			foreach ($element->find('td') as $row)
122 122
 			{
123 123
 				$td [] = trim($row->plaintext);
124 124
 				$tdi [] = trim($row->innertext);
125 125
 			}
126
-			$td=array_filter($td);
127
-			$tdi=array_filter($tdi);
128
-			$tabledata[]=array_merge($td,$tdi);
126
+			$td = array_filter($td);
127
+			$tdi = array_filter($tdi);
128
+			$tabledata[] = array_merge($td, $tdi);
129 129
 		}
130 130
 		$html->clear();
131 131
 		unset($html);
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	public function text2array($data) {
141 141
 		$html = str_get_html($data);
142 142
 		if ($html === false) return array();
143
-		$tabledata=array();
144
-		foreach($html->find('p') as $element)
143
+		$tabledata = array();
144
+		foreach ($html->find('p') as $element)
145 145
 		{
146 146
 			$tabledata [] = trim($element->plaintext);
147 147
 		}
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 	*/
162 162
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
163 163
 		if ($lat == $latc && $lon == $lonc) return 0;
164
-		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
164
+		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515;
165 165
 		if ($unit == "km") {
166
-			return round($dist * 1.609344);
166
+			return round($dist*1.609344);
167 167
 		} elseif ($unit == "m") {
168
-			return round($dist * 1.609344 * 1000);
168
+			return round($dist*1.609344*1000);
169 169
 		} elseif ($unit == "mile" || $unit == "mi") {
170 170
 			return round($dist);
171 171
 		} elseif ($unit == "nm") {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	* @param float $distance distance covered
182 182
 	* @return whether distance is realistic
183 183
 	*/
184
-	public function withinThreshold ($timeDifference, $distance) {
184
+	public function withinThreshold($timeDifference, $distance) {
185 185
 		$x = abs($timeDifference);
186 186
 		$d = abs($distance);
187 187
 		if ($x == 0 || $d == 0) return true;
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 		return ($array !== array_values($array));
198 198
 	}
199 199
 
200
-	public function isInteger($input){
200
+	public function isInteger($input) {
201 201
 	    return(ctype_digit(strval($input)));
202 202
 	}
203 203
 
204 204
 
205
-	public function convertDec($dms,$latlong) {
205
+	public function convertDec($dms, $latlong) {
206 206
 		if ($latlong == 'latitude') {
207 207
 			$deg = substr($dms, 0, 2);
208 208
 			$min = substr($dms, 2, 4);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			$deg = substr($dms, 0, 3);
211 211
 			$min = substr($dms, 3, 5);
212 212
 		}
213
-		return $deg+(($min*60)/3600);
213
+		return $deg + (($min*60)/3600);
214 214
 	}
215 215
 	
216 216
 	/**
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 	public function xcopy($source, $dest)
223 223
 	{
224 224
 		$files = glob($source.'*.*');
225
-		foreach($files as $file){
226
-			$file_to_go = str_replace($source,$dest,$file);
225
+		foreach ($files as $file) {
226
+			$file_to_go = str_replace($source, $dest, $file);
227 227
 			copy($file, $file_to_go);
228 228
 		}
229 229
 		return true;
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 	* @param	String $url url to check
235 235
 	* @return	bool Return true on succes false on failure
236 236
 	*/
237
-	public function urlexist($url){
238
-		$headers=get_headers($url);
239
-		return stripos($headers[0],"200 OK")?true:false;
237
+	public function urlexist($url) {
238
+		$headers = get_headers($url);
239
+		return stripos($headers[0], "200 OK") ? true : false;
240 240
 	}
241 241
 	
242 242
 	/**
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	public function hex2str($hex) {
248 248
 		$str = '';
249 249
 		$hexln = strlen($hex);
250
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
250
+		for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2)));
251 251
 		return $str;
252 252
 	}
253 253
 	
@@ -256,33 +256,33 @@  discard block
 block discarded – undo
256 256
 		//difference in longitudinal coordinates
257 257
 		$dLon = deg2rad($lon2) - deg2rad($lon1);
258 258
 		//difference in the phi of latitudinal coordinates
259
-		$dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4));
259
+		$dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4));
260 260
 		//we need to recalculate $dLon if it is greater than pi
261
-		if(abs($dLon) > pi()) {
262
-			if($dLon > 0) {
263
-				$dLon = (2 * pi() - $dLon) * -1;
261
+		if (abs($dLon) > pi()) {
262
+			if ($dLon > 0) {
263
+				$dLon = (2*pi() - $dLon)*-1;
264 264
 			} else {
265
-				$dLon = 2 * pi() + $dLon;
265
+				$dLon = 2*pi() + $dLon;
266 266
 			}
267 267
 		}
268 268
 		//return the angle, normalized
269
-		return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360;
269
+		return (rad2deg(atan2($dLon, $dPhi)) + 360)%360;
270 270
 	}
271 271
 	
272
-	public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.1) {
272
+	public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.1) {
273 273
 		//$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1);
274
-		$a = -($lon2-$lon1);
274
+		$a = -($lon2 - $lon1);
275 275
 		$b = $lat2 - $lat1;
276
-		$c = -($a*$lat1+$b*$lon1);
277
-		$d = $a*$lat3+$b*$lon3+$c;
276
+		$c = -($a*$lat1 + $b*$lon1);
277
+		$d = $a*$lat3 + $b*$lon3 + $c;
278 278
 		if ($d > -$approx && $d < $approx) return true;
279 279
 		else return false;
280 280
 	}
281 281
 	
282 282
 	public function array_merge_noappend() {
283 283
 		$output = array();
284
-		foreach(func_get_args() as $array) {
285
-			foreach($array as $key => $value) {
284
+		foreach (func_get_args() as $array) {
285
+			foreach ($array as $key => $value) {
286 286
 				$output[$key] = isset($output[$key]) ?
287 287
 				array_merge($output[$key], $value) : $value;
288 288
 			}
@@ -323,34 +323,34 @@  discard block
 block discarded – undo
323 323
 		return $result;
324 324
 	}
325 325
 
326
-	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){
326
+	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) {
327 327
 		global $globalMapRefresh;
328 328
 		$distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000;
329 329
 		$r = 6378;
330 330
 		$latitude = deg2rad($latitude);
331 331
 		$longitude = deg2rad($longitude);
332 332
 		$bearing = deg2rad($heading); 
333
-		$latitude2 =  asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) );
334
-		$longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) );
335
-		return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.',''));
333
+		$latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing)));
334
+		$longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2)));
335
+		return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', ''));
336 336
 	}
337 337
 	
338
-	public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) {
338
+	public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) {
339 339
 		// distance in meter
340 340
 		$R = 6378.14;
341
-		$latitude1 = $latitude * (M_PI/180);
342
-		$longitude1 = $longitude * (M_PI/180);
343
-		$brng = $bearing * (M_PI/180);
341
+		$latitude1 = $latitude*(M_PI/180);
342
+		$longitude1 = $longitude*(M_PI/180);
343
+		$brng = $bearing*(M_PI/180);
344 344
 		$d = $distance;
345 345
 
346 346
 		$latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng));
347
-		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2));
347
+		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2));
348 348
 
349
-		$latitude2 = $latitude2 * (180/M_PI);
350
-		$longitude2 = $longitude2 * (180/M_PI);
349
+		$latitude2 = $latitude2*(180/M_PI);
350
+		$longitude2 = $longitude2*(180/M_PI);
351 351
 
352
-		$flat = round ($latitude2,6);
353
-		$flong = round ($longitude2,6);
352
+		$flat = round($latitude2, 6);
353
+		$flong = round($longitude2, 6);
354 354
 /*
355 355
 		$dx = $distance*cos($bearing);
356 356
 		$dy = $distance*sin($bearing);
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		$flong = $longitude + $dlong;
360 360
 		$flat = $latitude + $dlat;
361 361
 */
362
-		return array('latitude' => $flat,'longitude' => $flong);
362
+		return array('latitude' => $flat, 'longitude' => $flong);
363 363
 	}
364 364
 
365 365
 	/**
@@ -373,14 +373,14 @@  discard block
 block discarded – undo
373 373
 	 * @param integer $level GZIP compression level (default: 9)
374 374
 	 * @return string New filename (with .gz appended) if success, or false if operation fails
375 375
 	 */
376
-	public function gzCompressFile($source, $level = 9){ 
377
-		$dest = $source . '.gz'; 
378
-		$mode = 'wb' . $level; 
376
+	public function gzCompressFile($source, $level = 9) { 
377
+		$dest = $source.'.gz'; 
378
+		$mode = 'wb'.$level; 
379 379
 		$error = false; 
380 380
 		if ($fp_out = gzopen($dest, $mode)) { 
381
-			if ($fp_in = fopen($source,'rb')) { 
381
+			if ($fp_in = fopen($source, 'rb')) { 
382 382
 				while (!feof($fp_in)) 
383
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
383
+					gzwrite($fp_out, fread($fp_in, 1024*512)); 
384 384
 				fclose($fp_in); 
385 385
 			} else {
386 386
 				$error = true; 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	} 
397 397
 	
398 398
 	public function remove_accents($string) {
399
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
399
+		if (!preg_match('/[\x80-\xff]/', $string)) return $string;
400 400
 		$chars = array(
401 401
 		    // Decompositions for Latin-1 Supplement
402 402
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
454 454
 		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
455 455
 		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
456
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
456
+		    chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
457 457
 		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
458 458
 		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
459 459
 		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
 		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
470 470
 		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
471 471
 		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
472
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
473
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
474
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
475
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
476
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
477
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
478
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
472
+		    chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
473
+		    chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
474
+		    chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
475
+		    chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
476
+		    chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
477
+		    chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
478
+		    chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
479 479
 		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
480 480
 		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
481 481
 		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
Please login to merge, or discard this patch.
Braces   +60 added lines, -25 removed lines patch added patch discarded remove patch
@@ -27,8 +27,11 @@  discard block
 block discarded – undo
27 27
 		} else {
28 28
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
29 29
 		}
30
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
31
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
30
+		if ($timeout == '') {
31
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
32
+		} else {
33
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
34
+		}
32 35
 		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
33 36
 		if ($type == 'post') {
34 37
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -74,8 +77,9 @@  discard block
 block discarded – undo
74 77
 	private function curlResponseHeaderCallback($ch, $headerLine) {
75 78
 		//global $cookies;
76 79
 		$cookies = array();
77
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
78
-			$cookies[] = $cookie;
80
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
81
+					$cookies[] = $cookie;
82
+		}
79 83
 		return strlen($headerLine); // Needed by curl
80 84
 	}
81 85
 
@@ -86,11 +90,15 @@  discard block
 block discarded – undo
86 90
 		curl_setopt($ch, CURLOPT_URL, $url);
87 91
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
88 92
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
89
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
93
+		if ($referer != '') {
94
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
95
+		}
90 96
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
91 97
 		curl_setopt($ch, CURLOPT_FILE, $fp);
92 98
 		curl_exec($ch);
93
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
99
+		if (curl_errno($ch) && $globalDebug) {
100
+			echo 'Download error: '.curl_error($ch);
101
+		}
94 102
 		curl_close($ch);
95 103
 		fclose($fp);
96 104
 	}
@@ -101,10 +109,16 @@  discard block
 block discarded – undo
101 109
 	* @return Array array of the tables in HTML page
102 110
 	*/
103 111
 	public function table2array($data) {
104
-		if (!is_string($data)) return array();
105
-		if ($data == '') return array();
112
+		if (!is_string($data)) {
113
+			return array();
114
+		}
115
+		if ($data == '') {
116
+			return array();
117
+		}
106 118
 		$html = str_get_html($data);
107
-		if ($html === false) return array();
119
+		if ($html === false) {
120
+			return array();
121
+		}
108 122
 		$tabledata=array();
109 123
 		foreach($html->find('tr') as $element)
110 124
 		{
@@ -139,7 +153,9 @@  discard block
 block discarded – undo
139 153
 	*/
140 154
 	public function text2array($data) {
141 155
 		$html = str_get_html($data);
142
-		if ($html === false) return array();
156
+		if ($html === false) {
157
+			return array();
158
+		}
143 159
 		$tabledata=array();
144 160
 		foreach($html->find('p') as $element)
145 161
 		{
@@ -160,7 +176,9 @@  discard block
 block discarded – undo
160 176
 	* @return Float Distance in $unit
161 177
 	*/
162 178
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
163
-		if ($lat == $latc && $lon == $lonc) return 0;
179
+		if ($lat == $latc && $lon == $lonc) {
180
+			return 0;
181
+		}
164 182
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
165 183
 		if ($unit == "km") {
166 184
 			return round($dist * 1.609344);
@@ -184,10 +202,16 @@  discard block
 block discarded – undo
184 202
 	public function withinThreshold ($timeDifference, $distance) {
185 203
 		$x = abs($timeDifference);
186 204
 		$d = abs($distance);
187
-		if ($x == 0 || $d == 0) return true;
205
+		if ($x == 0 || $d == 0) {
206
+			return true;
207
+		}
188 208
 		// may be due to Internet jitter; distance is realistic
189
-		if ($x < 0.7 && $d < 2000) return true;
190
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
209
+		if ($x < 0.7 && $d < 2000) {
210
+			return true;
211
+		} else {
212
+			return $d/$x < 1500*0.27778;
213
+		}
214
+		// 1500 km/h max
191 215
 	}
192 216
 
193 217
 
@@ -247,7 +271,9 @@  discard block
 block discarded – undo
247 271
 	public function hex2str($hex) {
248 272
 		$str = '';
249 273
 		$hexln = strlen($hex);
250
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
274
+		for($i=0;$i<$hexln;$i+=2) {
275
+			$str .= chr(hexdec(substr($hex,$i,2)));
276
+		}
251 277
 		return $str;
252 278
 	}
253 279
 	
@@ -275,8 +301,11 @@  discard block
 block discarded – undo
275 301
 		$b = $lat2 - $lat1;
276 302
 		$c = -($a*$lat1+$b*$lon1);
277 303
 		$d = $a*$lat3+$b*$lon3+$c;
278
-		if ($d > -$approx && $d < $approx) return true;
279
-		else return false;
304
+		if ($d > -$approx && $d < $approx) {
305
+			return true;
306
+		} else {
307
+			return false;
308
+		}
280 309
 	}
281 310
 	
282 311
 	public function array_merge_noappend() {
@@ -312,7 +341,9 @@  discard block
 block discarded – undo
312 341
 			return $result;
313 342
 		}
314 343
 		$handle = @opendir('./locale');
315
-		if ($handle === false) return $result;
344
+		if ($handle === false) {
345
+			return $result;
346
+		}
316 347
 		while (false !== ($file = readdir($handle))) {
317 348
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
318 349
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -379,8 +410,9 @@  discard block
 block discarded – undo
379 410
 		$error = false; 
380 411
 		if ($fp_out = gzopen($dest, $mode)) { 
381 412
 			if ($fp_in = fopen($source,'rb')) { 
382
-				while (!feof($fp_in)) 
383
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
413
+				while (!feof($fp_in)) {
414
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
415
+				}
384 416
 				fclose($fp_in); 
385 417
 			} else {
386 418
 				$error = true; 
@@ -389,14 +421,17 @@  discard block
 block discarded – undo
389 421
 		} else {
390 422
 			$error = true; 
391 423
 		}
392
-		if ($error)
393
-			return false; 
394
-		else
395
-			return $dest; 
424
+		if ($error) {
425
+					return false;
426
+		} else {
427
+					return $dest;
428
+		}
396 429
 	} 
397 430
 	
398 431
 	public function remove_accents($string) {
399
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
432
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
433
+			return $string;
434
+		}
400 435
 		$chars = array(
401 436
 		    // Decompositions for Latin-1 Supplement
402 437
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
Please login to merge, or discard this patch.
require/class.Connection.php 4 patches
Doc Comments   +16 added lines patch added patch discarded remove patch
@@ -6,6 +6,9 @@  discard block
 block discarded – undo
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 34;
8 8
 	
9
+	/**
10
+	 * @param string $dbname
11
+	 */
9 12
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10 13
 	    global $globalDBdriver;
11 14
 	    if ($dbc === null) {
@@ -132,6 +135,9 @@  discard block
 block discarded – undo
132 135
 		return true;
133 136
 	}
134 137
 
138
+	/**
139
+	 * @param string $table
140
+	 */
135 141
 	public function tableExists($table)
136 142
 	{
137 143
 		global $globalDBdriver, $globalDBname;
@@ -181,6 +187,11 @@  discard block
 block discarded – undo
181 187
 	/*
182 188
 	* Check if index exist
183 189
 	*/
190
+
191
+	/**
192
+	 * @param string $table
193
+	 * @param string $index
194
+	 */
184 195
 	public function indexExists($table,$index)
185 196
 	{
186 197
 		global $globalDBdriver, $globalDBname;
@@ -227,6 +238,11 @@  discard block
 block discarded – undo
227 238
 	* Check if a column name exist in a table
228 239
 	* @return Boolean column exist or not
229 240
 	*/
241
+
242
+	/**
243
+	 * @param string $table
244
+	 * @param string $name
245
+	 */
230 246
 	public function checkColumnName($table,$name)
231 247
 	{
232 248
 		global $globalDBdriver, $globalDBname;
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
 	public $latest_schema = 34;
8 8
 	
9 9
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10
-	    global $globalDBdriver;
11
-	    if ($dbc === null) {
10
+		global $globalDBdriver;
11
+		if ($dbc === null) {
12 12
 		if ($this->db === null && $dbname === null) {
13
-		    if ($user === null && $pass === null) {
13
+			if ($user === null && $pass === null) {
14 14
 			$this->createDBConnection();
15
-		    } else {
15
+			} else {
16 16
 			$this->createDBConnection(null,$user,$pass);
17
-		    }
17
+			}
18 18
 		} else {
19
-		    $this->createDBConnection($dbname);
19
+			$this->createDBConnection($dbname);
20 20
 		}
21
-	    } elseif ($dbname === null || $dbname === 'default') {
21
+		} elseif ($dbname === null || $dbname === 'default') {
22 22
 		$this->db = $dbc;
23 23
 		if ($this->connectionExists() === false) {
24 24
 			/*
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 			*/
29 29
 			$this->createDBConnection();
30 30
 		}
31
-	    } else {
31
+		} else {
32 32
 		//$this->connectionExists();
33 33
 		$this->dbs[$dbname] = $dbc;
34
-	    }
34
+		}
35 35
 	}
36 36
 
37 37
 	public function db() {
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	/**
50
-	* Creates the database connection
51
-	*
52
-	* @return Boolean of the database connection
53
-	*
54
-	*/
50
+	 * Creates the database connection
51
+	 *
52
+	 * @return Boolean of the database connection
53
+	 *
54
+	 */
55 55
 
56 56
 	public function createDBConnection($DBname = null, $user = null, $pass = null)
57 57
 	{
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			return false;
149 149
 		}
150 150
 		if($results->rowCount()>0) {
151
-		    return true; 
151
+			return true; 
152 152
 		}
153 153
 		else return false;
154 154
 	}
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
 				$sum = $sum->fetchColumn(0);
166 166
 			} else $sum = 0;
167 167
 			if (intval($sum) !== 2) {
168
-			     return false;
168
+				 return false;
169 169
 			}
170 170
 			
171 171
 		} catch(PDOException $e) {
172 172
 			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
173
-            			throw $e;
174
-	                }
175
-	                //echo 'error ! '.$e->getMessage();
173
+						throw $e;
174
+					}
175
+					//echo 'error ! '.$e->getMessage();
176 176
 			return false;
177 177
 		}
178 178
 		return true; 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 		$version = 0;
271 271
 		if ($this->tableExists('aircraft')) {
272 272
 			if (!$this->tableExists('config')) {
273
-	    			$version = '1';
274
-	    			return $version;
273
+					$version = '1';
274
+					return $version;
275 275
 			} else {
276 276
 				$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
277 277
 				try {
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	* @return Boolean if latest version or not
293 293
 	*/
294 294
 	public function latest() {
295
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
296
-	    else return false;
295
+		if ($this->check_schema_version() == $this->latest_schema) return true;
296
+		else return false;
297 297
 	}
298 298
 
299 299
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 
4
-class Connection{
4
+class Connection {
5 5
 	public $db = null;
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 34;
8 8
 	
9
-	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
9
+	public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) {
10 10
 	    global $globalDBdriver;
11 11
 	    if ($dbc === null) {
12 12
 		if ($this->db === null && $dbname === null) {
13 13
 		    if ($user === null && $pass === null) {
14 14
 			$this->createDBConnection();
15 15
 		    } else {
16
-			$this->createDBConnection(null,$user,$pass);
16
+			$this->createDBConnection(null, $user, $pass);
17 17
 		    }
18 18
 		} else {
19 19
 		    $this->createDBConnection($dbname);
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 		while (true) {
92 92
 			try {
93 93
 				if ($globalDBSdriver == 'mysql') {
94
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser,  $globalDBSpass);
94
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass);
95 95
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
96 96
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
97
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
98
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
99
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
100
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
101
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
97
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
98
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500);
99
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
100
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
101
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
102 102
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
103 103
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
104 104
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 					$this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"');
109 109
 					//$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"');
110 110
 				} else {
111
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser,  $globalDBSpass);
111
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass);
112 112
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
113 113
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
114
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
115
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
116
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
117
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
118
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
114
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
115
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200);
116
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
117
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
118
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
119 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
120 120
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
121 121
 				}
122 122
 				break;
123
-			} catch(PDOException $e) {
123
+			} catch (PDOException $e) {
124 124
 				$i++;
125 125
 				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
126 126
 				//exit;
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 		try {
145 145
 			//$Connection = new Connection();
146 146
 			$results = $this->db->query($query);
147
-		} catch(PDOException $e) {
147
+		} catch (PDOException $e) {
148 148
 			return false;
149 149
 		}
150
-		if($results->rowCount()>0) {
150
+		if ($results->rowCount() > 0) {
151 151
 		    return true; 
152 152
 		}
153 153
 		else return false;
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 			     return false;
169 169
 			}
170 170
 			
171
-		} catch(PDOException $e) {
172
-			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
171
+		} catch (PDOException $e) {
172
+			if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
173 173
             			throw $e;
174 174
 	                }
175 175
 	                //echo 'error ! '.$e->getMessage();
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	/*
182 182
 	* Check if index exist
183 183
 	*/
184
-	public function indexExists($table,$index)
184
+	public function indexExists($table, $index)
185 185
 	{
186 186
 		global $globalDBdriver, $globalDBname;
187 187
 		if ($globalDBdriver == 'mysql') {
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 		try {
193 193
 			//$Connection = new Connection();
194 194
 			$results = $this->db->query($query);
195
-		} catch(PDOException $e) {
195
+		} catch (PDOException $e) {
196 196
 			return false;
197 197
 		}
198 198
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
199
-		if($nb[0]['nb'] > 0) {
199
+		if ($nb[0]['nb'] > 0) {
200 200
 			return true; 
201 201
 		}
202 202
 		else return false;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$query = "SELECT * FROM ".$table." LIMIT 0";
212 212
 		try {
213 213
 			$results = $this->db->query($query);
214
-		} catch(PDOException $e) {
214
+		} catch (PDOException $e) {
215 215
 			return "error : ".$e->getMessage()."\n";
216 216
 		}
217 217
 		$columns = array();
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	* Check if a column name exist in a table
228 228
 	* @return Boolean column exist or not
229 229
 	*/
230
-	public function checkColumnName($table,$name)
230
+	public function checkColumnName($table, $name)
231 231
 	{
232 232
 		global $globalDBdriver, $globalDBname;
233 233
 		if ($globalDBdriver == 'mysql') {
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 		}
238 238
 			try {
239 239
 				$sth = $this->db()->prepare($query);
240
-				$sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name));
241
-			} catch(PDOException $e) {
240
+				$sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name));
241
+			} catch (PDOException $e) {
242 242
 				echo "error : ".$e->getMessage()."\n";
243 243
 			}
244 244
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 				try {
278 278
 					$sth = $this->db->prepare($query);
279 279
 					$sth->execute();
280
-				} catch(PDOException $e) {
280
+				} catch (PDOException $e) {
281 281
 					return "error : ".$e->getMessage()."\n";
282 282
 				}
283 283
 				$result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +77 added lines, -30 removed lines patch added patch discarded remove patch
@@ -64,8 +64,11 @@  discard block
 block discarded – undo
64 64
 				$globalDBSname = $globalDBname;
65 65
 				$globalDBSuser = $globalDBuser;
66 66
 				$globalDBSpass = $globalDBpass;
67
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
68
-				else $globalDBSport = $globalDBport;
67
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
68
+					$globalDBSport = 3306;
69
+				} else {
70
+					$globalDBSport = $globalDBport;
71
+				}
69 72
 			} else {
70 73
 				$DBname = 'default';
71 74
 				$globalDBSdriver = $globalDBdriver;
@@ -73,8 +76,11 @@  discard block
 block discarded – undo
73 76
 				$globalDBSname = $globalDBname;
74 77
 				$globalDBSuser = $user;
75 78
 				$globalDBSpass = $pass;
76
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
77
-				else $globalDBSport = $globalDBport;
79
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
80
+					$globalDBSport = 3306;
81
+				} else {
82
+					$globalDBSport = $globalDBport;
83
+				}
78 84
 			}
79 85
 		} else {
80 86
 			$globalDBSdriver = $globalDB[$DBname]['driver'];
@@ -82,11 +88,16 @@  discard block
 block discarded – undo
82 88
 			$globalDBSname = $globalDB[$DBname]['name'];
83 89
 			$globalDBSuser = $globalDB[$DBname]['user'];
84 90
 			$globalDBSpass = $globalDB[$DBname]['pass'];
85
-			if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port'];
86
-			else $globalDBSport = 3306;
91
+			if (isset($globalDB[$DBname]['port'])) {
92
+				$globalDBSport = $globalDB[$DBname]['port'];
93
+			} else {
94
+				$globalDBSport = 3306;
95
+			}
87 96
 		}
88 97
 		// Set number of try to connect to DB
89
-		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5;
98
+		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) {
99
+			$globalDBretry = 5;
100
+		}
90 101
 		$i = 0;
91 102
 		while (true) {
92 103
 			try {
@@ -95,10 +106,16 @@  discard block
 block discarded – undo
95 106
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
96 107
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
97 108
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
98
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
99
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
100
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
101
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
109
+					if (!isset($globalDBTimeOut)) {
110
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
111
+					} else {
112
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
113
+					}
114
+					if (!isset($globalDBPersistent)) {
115
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
116
+					} else {
117
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
118
+					}
102 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
103 120
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
104 121
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -112,23 +129,35 @@  discard block
 block discarded – undo
112 129
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
113 130
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
114 131
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
115
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
116
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
117
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
118
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
132
+					if (!isset($globalDBTimeOut)) {
133
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
134
+					} else {
135
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
136
+					}
137
+					if (!isset($globalDBPersistent)) {
138
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
139
+					} else {
140
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
141
+					}
119 142
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
120 143
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
121 144
 				}
122 145
 				break;
123 146
 			} catch(PDOException $e) {
124 147
 				$i++;
125
-				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
148
+				if (isset($globalDebug) && $globalDebug) {
149
+					echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
150
+				}
126 151
 				//exit;
127
-				if ($i > $globalDBretry) return false;
152
+				if ($i > $globalDBretry) {
153
+					return false;
154
+				}
128 155
 				//return false;
129 156
 			}
130 157
 		}
131
-		if ($DBname === 'default') $this->db = $this->dbs['default'];
158
+		if ($DBname === 'default') {
159
+			$this->db = $this->dbs['default'];
160
+		}
132 161
 		return true;
133 162
 	}
134 163
 
@@ -140,7 +169,9 @@  discard block
 block discarded – undo
140 169
 		} else {
141 170
 			$query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'";
142 171
 		}
143
-		if ($this->db == NULL) return false;
172
+		if ($this->db == NULL) {
173
+			return false;
174
+		}
144 175
 		try {
145 176
 			//$Connection = new Connection();
146 177
 			$results = $this->db->query($query);
@@ -149,21 +180,28 @@  discard block
 block discarded – undo
149 180
 		}
150 181
 		if($results->rowCount()>0) {
151 182
 		    return true; 
183
+		} else {
184
+			return false;
152 185
 		}
153
-		else return false;
154 186
 	}
155 187
 
156 188
 	public function connectionExists()
157 189
 	{
158 190
 		global $globalDBdriver, $globalDBCheckConnection;
159
-		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true;
191
+		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) {
192
+			return true;
193
+		}
160 194
 		$query = "SELECT 1 + 1";
161
-		if ($this->db === null) return false;
195
+		if ($this->db === null) {
196
+			return false;
197
+		}
162 198
 		try {
163 199
 			$sum = @$this->db->query($query);
164 200
 			if ($sum instanceof \PDOStatement) {
165 201
 				$sum = $sum->fetchColumn(0);
166
-			} else $sum = 0;
202
+			} else {
203
+				$sum = 0;
204
+			}
167 205
 			if (intval($sum) !== 2) {
168 206
 			     return false;
169 207
 			}
@@ -198,8 +236,9 @@  discard block
 block discarded – undo
198 236
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
199 237
 		if($nb[0]['nb'] > 0) {
200 238
 			return true; 
239
+		} else {
240
+			return false;
201 241
 		}
202
-		else return false;
203 242
 	}
204 243
 
205 244
 	/*
@@ -243,9 +282,12 @@  discard block
 block discarded – undo
243 282
 			}
244 283
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
245 284
 			$sth->closeCursor();
246
-			if ($result['nb'] > 0) return true;
247
-			else return false;
248
-/*		} else {
285
+			if ($result['nb'] > 0) {
286
+				return true;
287
+			} else {
288
+				return false;
289
+			}
290
+			/*		} else {
249 291
 			$query = "SELECT * FROM ".$table." LIMIT 0";
250 292
 			try {
251 293
 				$results = $this->db->query($query);
@@ -284,7 +326,9 @@  discard block
 block discarded – undo
284 326
 				$sth->closeCursor();
285 327
 				return $result['value'];
286 328
 			}
287
-		} else return $version;
329
+		} else {
330
+			return $version;
331
+		}
288 332
 	}
289 333
 	
290 334
 	/*
@@ -292,8 +336,11 @@  discard block
 block discarded – undo
292 336
 	* @return Boolean if latest version or not
293 337
 	*/
294 338
 	public function latest() {
295
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
296
-	    else return false;
339
+	    if ($this->check_schema_version() == $this->latest_schema) {
340
+	    	return true;
341
+	    } else {
342
+	    	return false;
343
+	    }
297 344
 	}
298 345
 
299 346
 }
Please login to merge, or discard this patch.
require/class.Spotter.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
@@ -8717,6 +8717,7 @@  discard block
 block discarded – undo
8717 8717
 	/**
8718 8718
 	* Counts all hours
8719 8719
 	*
8720
+	* @param string $orderby
8720 8721
 	* @return Array the hour list
8721 8722
 	*
8722 8723
 	*/
@@ -8782,6 +8783,7 @@  discard block
 block discarded – undo
8782 8783
 	/**
8783 8784
 	* Counts all hours
8784 8785
 	*
8786
+	* @param string $orderby
8785 8787
 	* @return Array the hour list
8786 8788
 	*
8787 8789
 	*/
@@ -9594,7 +9596,7 @@  discard block
 block discarded – undo
9594 9596
 	/**
9595 9597
 	* Parses the direction degrees to working
9596 9598
 	*
9597
-	* @param Float $direction the direction in degrees
9599
+	* @param integer $direction the direction in degrees
9598 9600
 	* @return Array the direction information
9599 9601
 	*
9600 9602
 	*/
Please login to merge, or discard this patch.
Indentation   +1437 added lines, -1437 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
64 64
 		$filters = array();
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Executes the SQL statements to get the spotter information
133
-	*
134
-	* @param String $query the SQL query
135
-	* @param Array $params parameter of the query
136
-	* @param String $limitQuery the limit query
137
-	* @return Array the spotter information
138
-	*
139
-	*/
132
+	 * Executes the SQL statements to get the spotter information
133
+	 *
134
+	 * @param String $query the SQL query
135
+	 * @param Array $params parameter of the query
136
+	 * @param String $limitQuery the limit query
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 301
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302 302
 					} else $temp_array['aircraft_shadow'] = 'default.png';
303
-                                } else {
304
-                            		$temp_array['aircraft_shadow'] = 'default.png';
303
+								} else {
304
+									$temp_array['aircraft_shadow'] = 'default.png';
305 305
 					$temp_array['aircraft_name'] = 'N/A';
306 306
 					$temp_array['aircraft_manufacturer'] = 'N/A';
307
-                            	}
307
+								}
308 308
 			}
309 309
 			$fromsource = NULL;
310 310
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -500,11 +500,11 @@  discard block
 block discarded – undo
500 500
 	
501 501
 	
502 502
 	/**
503
-	* Gets all the spotter information
504
-	*
505
-	* @return Array the spotter information
506
-	*
507
-	*/
503
+	 * Gets all the spotter information
504
+	 *
505
+	 * @return Array the spotter information
506
+	 *
507
+	 */
508 508
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
509 509
 	{
510 510
 		global $globalTimezone, $globalDBdriver;
@@ -851,11 +851,11 @@  discard block
 block discarded – undo
851 851
 	
852 852
 	
853 853
 	/**
854
-	* Gets all the spotter information based on the latest data entry
855
-	*
856
-	* @return Array the spotter information
857
-	*
858
-	*/
854
+	 * Gets all the spotter information based on the latest data entry
855
+	 *
856
+	 * @return Array the spotter information
857
+	 *
858
+	 */
859 859
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
860 860
 	{
861 861
 		global $global_query;
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
 	}
895 895
     
896 896
     
897
-    /**
898
-	* Gets all the spotter information based on a user's latitude and longitude
899
-	*
900
-	* @return Array the spotter information
901
-	*
902
-	*/
897
+	/**
898
+	 * Gets all the spotter information based on a user's latitude and longitude
899
+	 *
900
+	 * @return Array the spotter information
901
+	 *
902
+	 */
903 903
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
904 904
 	{
905 905
 		date_default_timezone_set('UTC');
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 				return false;
928 928
 			}
929 929
 		}
930
-    		$additional_query = '';
930
+			$additional_query = '';
931 931
 		if ($interval != "")
932 932
 		{
933 933
 			if (!is_string($interval))
@@ -967,12 +967,12 @@  discard block
 block discarded – undo
967 967
 	}
968 968
     
969 969
     
970
-    /**
971
-	* Gets all the spotter information sorted by the newest aircraft type
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
970
+	/**
971
+	 * Gets all the spotter information sorted by the newest aircraft type
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1013,11 +1013,11 @@  discard block
 block discarded – undo
1013 1013
     
1014 1014
     
1015 1015
 	/**
1016
-	* Gets all the spotter information sorted by the newest aircraft registration
1017
-	*
1018
-	* @return Array the spotter information
1019
-	*
1020
-	*/
1016
+	 * Gets all the spotter information sorted by the newest aircraft registration
1017
+	 *
1018
+	 * @return Array the spotter information
1019
+	 *
1020
+	 */
1021 1021
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1022 1022
 	{
1023 1023
 		global $global_query;
@@ -1057,11 +1057,11 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 
1059 1059
 	/**
1060
-	* Gets all the spotter information sorted by the newest airline
1061
-	*
1062
-	* @return Array the spotter information
1063
-	*
1064
-	*/
1060
+	 * Gets all the spotter information sorted by the newest airline
1061
+	 *
1062
+	 * @return Array the spotter information
1063
+	 *
1064
+	 */
1065 1065
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
@@ -1100,12 +1100,12 @@  discard block
 block discarded – undo
1100 1100
 	}
1101 1101
     
1102 1102
     
1103
-    /**
1104
-	* Gets all the spotter information sorted by the newest departure airport
1105
-	*
1106
-	* @return Array the spotter information
1107
-	*
1108
-	*/
1103
+	/**
1104
+	 * Gets all the spotter information sorted by the newest departure airport
1105
+	 *
1106
+	 * @return Array the spotter information
1107
+	 *
1108
+	 */
1109 1109
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1110 1110
 	{
1111 1111
 		global $global_query;
@@ -1147,11 +1147,11 @@  discard block
 block discarded – undo
1147 1147
 
1148 1148
 
1149 1149
 	/**
1150
-	* Gets all the spotter information sorted by the newest arrival airport
1151
-	*
1152
-	* @return Array the spotter information
1153
-	*
1154
-	*/
1150
+	 * Gets all the spotter information sorted by the newest arrival airport
1151
+	 *
1152
+	 * @return Array the spotter information
1153
+	 *
1154
+	 */
1155 1155
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1156 1156
 	{
1157 1157
 		global $global_query;
@@ -1190,11 +1190,11 @@  discard block
 block discarded – undo
1190 1190
 	
1191 1191
 
1192 1192
 	/**
1193
-	* Gets all the spotter information based on the spotter id
1194
-	*
1195
-	* @return Array the spotter information
1196
-	*
1197
-	*/
1193
+	 * Gets all the spotter information based on the spotter id
1194
+	 *
1195
+	 * @return Array the spotter information
1196
+	 *
1197
+	 */
1198 1198
 	public function getSpotterDataByID($id = '')
1199 1199
 	{
1200 1200
 		global $global_query;
@@ -1216,11 +1216,11 @@  discard block
 block discarded – undo
1216 1216
 	
1217 1217
 	
1218 1218
 	/**
1219
-	* Gets all the spotter information based on the callsign
1220
-	*
1221
-	* @return Array the spotter information
1222
-	*
1223
-	*/
1219
+	 * Gets all the spotter information based on the callsign
1220
+	 *
1221
+	 * @return Array the spotter information
1222
+	 *
1223
+	 */
1224 1224
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1225 1225
 	{
1226 1226
 		global $global_query;
@@ -1271,11 +1271,11 @@  discard block
 block discarded – undo
1271 1271
 	}
1272 1272
 	
1273 1273
 	/**
1274
-	* Gets all the spotter information based on the owner
1275
-	*
1276
-	* @return Array the spotter information
1277
-	*
1278
-	*/
1274
+	 * Gets all the spotter information based on the owner
1275
+	 *
1276
+	 * @return Array the spotter information
1277
+	 *
1278
+	 */
1279 1279
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '')
1280 1280
 	{
1281 1281
 		global $global_query;
@@ -1326,11 +1326,11 @@  discard block
 block discarded – undo
1326 1326
 	}
1327 1327
 	
1328 1328
 	/**
1329
-	* Gets all the spotter information based on the pilot
1330
-	*
1331
-	* @return Array the spotter information
1332
-	*
1333
-	*/
1329
+	 * Gets all the spotter information based on the pilot
1330
+	 *
1331
+	 * @return Array the spotter information
1332
+	 *
1333
+	 */
1334 1334
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '')
1335 1335
 	{
1336 1336
 		global $global_query;
@@ -1378,11 +1378,11 @@  discard block
 block discarded – undo
1378 1378
 	
1379 1379
 	
1380 1380
 	/**
1381
-	* Gets all the spotter information based on the aircraft type
1382
-	*
1383
-	* @return Array the spotter information
1384
-	*
1385
-	*/
1381
+	 * Gets all the spotter information based on the aircraft type
1382
+	 *
1383
+	 * @return Array the spotter information
1384
+	 *
1385
+	 */
1386 1386
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1387 1387
 	{
1388 1388
 		global $global_query;
@@ -1436,11 +1436,11 @@  discard block
 block discarded – undo
1436 1436
 	
1437 1437
 	
1438 1438
 	/**
1439
-	* Gets all the spotter information based on the aircraft registration
1440
-	*
1441
-	* @return Array the spotter information
1442
-	*
1443
-	*/
1439
+	 * Gets all the spotter information based on the aircraft registration
1440
+	 *
1441
+	 * @return Array the spotter information
1442
+	 *
1443
+	 */
1444 1444
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1445 1445
 	{
1446 1446
 		global $global_query;
@@ -1497,11 +1497,11 @@  discard block
 block discarded – undo
1497 1497
 	
1498 1498
 	
1499 1499
 	/**
1500
-	* Gets all the spotter information based on the airline
1501
-	*
1502
-	* @return Array the spotter information
1503
-	*
1504
-	*/
1500
+	 * Gets all the spotter information based on the airline
1501
+	 *
1502
+	 * @return Array the spotter information
1503
+	 *
1504
+	 */
1505 1505
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1506 1506
 	{
1507 1507
 		global $global_query;
@@ -1554,11 +1554,11 @@  discard block
 block discarded – undo
1554 1554
 	
1555 1555
 	
1556 1556
 	/**
1557
-	* Gets all the spotter information based on the airport
1558
-	*
1559
-	* @return Array the spotter information
1560
-	*
1561
-	*/
1557
+	 * Gets all the spotter information based on the airport
1558
+	 *
1559
+	 * @return Array the spotter information
1560
+	 *
1561
+	 */
1562 1562
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1563 1563
 	{
1564 1564
 		global $global_query;
@@ -1612,11 +1612,11 @@  discard block
 block discarded – undo
1612 1612
 
1613 1613
 
1614 1614
 	/**
1615
-	* Gets all the spotter information based on the date
1616
-	*
1617
-	* @return Array the spotter information
1618
-	*
1619
-	*/
1615
+	 * Gets all the spotter information based on the date
1616
+	 *
1617
+	 * @return Array the spotter information
1618
+	 *
1619
+	 */
1620 1620
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1621 1621
 	{
1622 1622
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 
1681 1681
 
1682 1682
 	/**
1683
-	* Gets all the spotter information based on the country name
1684
-	*
1685
-	* @return Array the spotter information
1686
-	*
1687
-	*/
1683
+	 * Gets all the spotter information based on the country name
1684
+	 *
1685
+	 * @return Array the spotter information
1686
+	 *
1687
+	 */
1688 1688
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1689 1689
 	{
1690 1690
 		global $global_query;
@@ -1738,11 +1738,11 @@  discard block
 block discarded – undo
1738 1738
 	
1739 1739
 	
1740 1740
 	/**
1741
-	* Gets all the spotter information based on the manufacturer name
1742
-	*
1743
-	* @return Array the spotter information
1744
-	*
1745
-	*/
1741
+	 * Gets all the spotter information based on the manufacturer name
1742
+	 *
1743
+	 * @return Array the spotter information
1744
+	 *
1745
+	 */
1746 1746
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1747 1747
 	{
1748 1748
 		global $global_query;
@@ -1798,13 +1798,13 @@  discard block
 block discarded – undo
1798 1798
   
1799 1799
   
1800 1800
 	/**
1801
-	* Gets a list of all aircraft that take a route
1802
-	*
1803
-	* @param String $departure_airport_icao ICAO code of departure airport
1804
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1805
-	* @return Array the spotter information
1806
-	*
1807
-	*/
1801
+	 * Gets a list of all aircraft that take a route
1802
+	 *
1803
+	 * @param String $departure_airport_icao ICAO code of departure airport
1804
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1805
+	 * @return Array the spotter information
1806
+	 *
1807
+	 */
1808 1808
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1809 1809
 	{
1810 1810
 		global $global_query;
@@ -1873,11 +1873,11 @@  discard block
 block discarded – undo
1873 1873
 	
1874 1874
 	
1875 1875
 	/**
1876
-	* Gets all the spotter information based on the special column in the table
1877
-	*
1878
-	* @return Array the spotter information
1879
-	*
1880
-	*/
1876
+	 * Gets all the spotter information based on the special column in the table
1877
+	 *
1878
+	 * @return Array the spotter information
1879
+	 *
1880
+	 */
1881 1881
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1882 1882
 	{
1883 1883
 		global $global_query;
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
 	}
1917 1917
 
1918 1918
 	/**
1919
-	* Gets all the highlight based on a aircraft registration
1920
-	*
1921
-	* @return String the highlight text
1922
-	*
1923
-	*/
1919
+	 * Gets all the highlight based on a aircraft registration
1920
+	 *
1921
+	 * @return String the highlight text
1922
+	 *
1923
+	 */
1924 1924
 	public function getHighlightByRegistration($registration,$filter = array())
1925 1925
 	{
1926 1926
 		global $global_query;
@@ -1942,13 +1942,13 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 	
1944 1944
 	/**
1945
-	* Gets the squawk usage from squawk code
1946
-	*
1947
-	* @param String $squawk squawk code
1948
-	* @param String $country country
1949
-	* @return String usage
1950
-	*
1951
-	*/
1945
+	 * Gets the squawk usage from squawk code
1946
+	 *
1947
+	 * @param String $squawk squawk code
1948
+	 * @param String $country country
1949
+	 * @return String usage
1950
+	 *
1951
+	 */
1952 1952
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1953 1953
 	{
1954 1954
 		
@@ -1969,12 +1969,12 @@  discard block
 block discarded – undo
1969 1969
 	}
1970 1970
 
1971 1971
 	/**
1972
-	* Gets the airport icao from the iata
1973
-	*
1974
-	* @param String $airport_iata the iata code of the airport
1975
-	* @return String airport iata
1976
-	*
1977
-	*/
1972
+	 * Gets the airport icao from the iata
1973
+	 *
1974
+	 * @param String $airport_iata the iata code of the airport
1975
+	 * @return String airport iata
1976
+	 *
1977
+	 */
1978 1978
 	public function getAirportIcao($airport_iata = '')
1979 1979
 	{
1980 1980
 		
@@ -1994,14 +1994,14 @@  discard block
 block discarded – undo
1994 1994
 	}
1995 1995
 
1996 1996
 	/**
1997
-	* Gets the airport distance
1998
-	*
1999
-	* @param String $airport_icao the icao code of the airport
2000
-	* @param Float $latitude the latitude
2001
-	* @param Float $longitude the longitude
2002
-	* @return Float distance to the airport
2003
-	*
2004
-	*/
1997
+	 * Gets the airport distance
1998
+	 *
1999
+	 * @param String $airport_icao the icao code of the airport
2000
+	 * @param Float $latitude the latitude
2001
+	 * @param Float $longitude the longitude
2002
+	 * @return Float distance to the airport
2003
+	 *
2004
+	 */
2005 2005
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2006 2006
 	{
2007 2007
 		
@@ -2022,12 +2022,12 @@  discard block
 block discarded – undo
2022 2022
 	}
2023 2023
 	
2024 2024
 	/**
2025
-	* Gets the airport info based on the icao
2026
-	*
2027
-	* @param String $airport the icao code of the airport
2028
-	* @return Array airport information
2029
-	*
2030
-	*/
2025
+	 * Gets the airport info based on the icao
2026
+	 *
2027
+	 * @param String $airport the icao code of the airport
2028
+	 * @return Array airport information
2029
+	 *
2030
+	 */
2031 2031
 	public function getAllAirportInfo($airport = '')
2032 2032
 	{
2033 2033
 		
@@ -2073,12 +2073,12 @@  discard block
 block discarded – undo
2073 2073
 	}
2074 2074
 	
2075 2075
 	/**
2076
-	* Gets the airport info based on the country
2077
-	*
2078
-	* @param Array $countries Airports countries
2079
-	* @return Array airport information
2080
-	*
2081
-	*/
2076
+	 * Gets the airport info based on the country
2077
+	 *
2078
+	 * @param Array $countries Airports countries
2079
+	 * @return Array airport information
2080
+	 *
2081
+	 */
2082 2082
 	public function getAllAirportInfobyCountry($countries)
2083 2083
 	{
2084 2084
 		$lst_countries = '';
@@ -2116,12 +2116,12 @@  discard block
 block discarded – undo
2116 2116
 	}
2117 2117
 	
2118 2118
 	/**
2119
-	* Gets airports info based on the coord
2120
-	*
2121
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2122
-	* @return Array airport information
2123
-	*
2124
-	*/
2119
+	 * Gets airports info based on the coord
2120
+	 *
2121
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2122
+	 * @return Array airport information
2123
+	 *
2124
+	 */
2125 2125
 	public function getAllAirportInfobyCoord($coord)
2126 2126
 	{
2127 2127
 		global $globalDBdriver;
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	}
2153 2153
 
2154 2154
 	/**
2155
-	* Gets waypoints info based on the coord
2156
-	*
2157
-	* @param Array $coord waypoints coord
2158
-	* @return Array airport information
2159
-	*
2160
-	*/
2155
+	 * Gets waypoints info based on the coord
2156
+	 *
2157
+	 * @param Array $coord waypoints coord
2158
+	 * @return Array airport information
2159
+	 *
2160
+	 */
2161 2161
 	public function getAllWaypointsInfobyCoord($coord)
2162 2162
 	{
2163 2163
 		if (is_array($coord)) {
@@ -2191,12 +2191,12 @@  discard block
 block discarded – undo
2191 2191
 	
2192 2192
 	
2193 2193
 	/**
2194
-	* Gets the airline info based on the icao code or iata code
2195
-	*
2196
-	* @param String $airline_icao the iata code of the airport
2197
-	* @return Array airport information
2198
-	*
2199
-	*/
2194
+	 * Gets the airline info based on the icao code or iata code
2195
+	 *
2196
+	 * @param String $airline_icao the iata code of the airport
2197
+	 * @return Array airport information
2198
+	 *
2199
+	 */
2200 2200
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2201 2201
 	{
2202 2202
 		global $globalUseRealAirlines;
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
 			} else {
2228 2228
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2229 2229
 			}
2230
-                        /*
2230
+						/*
2231 2231
 			$airline_array = array();
2232 2232
 			$temp_array = array();
2233 2233
 		
@@ -2260,12 +2260,12 @@  discard block
 block discarded – undo
2260 2260
 	}
2261 2261
 	
2262 2262
 	/**
2263
-	* Gets the airline info based on the airline name
2264
-	*
2265
-	* @param String $airline_name the name of the airline
2266
-	* @return Array airline information
2267
-	*
2268
-	*/
2263
+	 * Gets the airline info based on the airline name
2264
+	 *
2265
+	 * @param String $airline_name the name of the airline
2266
+	 * @return Array airline information
2267
+	 *
2268
+	 */
2269 2269
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2270 2270
 	{
2271 2271
 		global $globalUseRealAirlines;
@@ -2293,12 +2293,12 @@  discard block
 block discarded – undo
2293 2293
 	
2294 2294
 	
2295 2295
 	/**
2296
-	* Gets the aircraft info based on the aircraft type
2297
-	*
2298
-	* @param String $aircraft_type the aircraft type
2299
-	* @return Array aircraft information
2300
-	*
2301
-	*/
2296
+	 * Gets the aircraft info based on the aircraft type
2297
+	 *
2298
+	 * @param String $aircraft_type the aircraft type
2299
+	 * @return Array aircraft information
2300
+	 *
2301
+	 */
2302 2302
 	public function getAllAircraftInfo($aircraft_type)
2303 2303
 	{
2304 2304
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2330,12 +2330,12 @@  discard block
 block discarded – undo
2330 2330
 	}
2331 2331
 
2332 2332
 	/**
2333
-	* Gets the aircraft icao based on the aircraft name/type
2334
-	*
2335
-	* @param String $aircraft_type the aircraft type
2336
-	* @return String aircraft information
2337
-	*
2338
-	*/
2333
+	 * Gets the aircraft icao based on the aircraft name/type
2334
+	 *
2335
+	 * @param String $aircraft_type the aircraft type
2336
+	 * @return String aircraft information
2337
+	 *
2338
+	 */
2339 2339
 	public function getAircraftIcao($aircraft_type)
2340 2340
 	{
2341 2341
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2360,12 +2360,12 @@  discard block
 block discarded – undo
2360 2360
 	}
2361 2361
 	
2362 2362
 	/**
2363
-	* Gets the aircraft info based on the aircraft modes
2364
-	*
2365
-	* @param String $aircraft_modes the aircraft ident (hex)
2366
-	* @return String aircraft type
2367
-	*
2368
-	*/
2363
+	 * Gets the aircraft info based on the aircraft modes
2364
+	 *
2365
+	 * @param String $aircraft_modes the aircraft ident (hex)
2366
+	 * @return String aircraft type
2367
+	 *
2368
+	 */
2369 2369
 	public function getAllAircraftType($aircraft_modes)
2370 2370
 	{
2371 2371
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2385,12 +2385,12 @@  discard block
 block discarded – undo
2385 2385
 	}
2386 2386
 
2387 2387
 	/**
2388
-	* Gets the aircraft info based on the aircraft registration
2389
-	*
2390
-	* @param String $registration the aircraft registration
2391
-	* @return String aircraft type
2392
-	*
2393
-	*/
2388
+	 * Gets the aircraft info based on the aircraft registration
2389
+	 *
2390
+	 * @param String $registration the aircraft registration
2391
+	 * @return String aircraft type
2392
+	 *
2393
+	 */
2394 2394
 	public function getAllAircraftTypeByRegistration($registration)
2395 2395
 	{
2396 2396
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2408,12 +2408,12 @@  discard block
 block discarded – undo
2408 2408
 	}
2409 2409
 
2410 2410
 	/**
2411
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2412
-	*
2413
-	* @param String $registration the aircraft registration
2414
-	* @return Array spotter_id and flightaware_id
2415
-	*
2416
-	*/
2411
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2412
+	 *
2413
+	 * @param String $registration the aircraft registration
2414
+	 * @return Array spotter_id and flightaware_id
2415
+	 *
2416
+	 */
2417 2417
 	public function getAllIDByRegistration($registration)
2418 2418
 	{
2419 2419
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2432,12 +2432,12 @@  discard block
 block discarded – undo
2432 2432
 	}
2433 2433
 
2434 2434
 	/**
2435
-	* Gets correct aircraft operator code
2436
-	*
2437
-	* @param String $operator the aircraft operator code (callsign)
2438
-	* @return String aircraft operator code
2439
-	*
2440
-	*/
2435
+	 * Gets correct aircraft operator code
2436
+	 *
2437
+	 * @param String $operator the aircraft operator code (callsign)
2438
+	 * @return String aircraft operator code
2439
+	 *
2440
+	 */
2441 2441
 	public function getOperator($operator)
2442 2442
 	{
2443 2443
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2454,16 +2454,16 @@  discard block
 block discarded – undo
2454 2454
 	}
2455 2455
 
2456 2456
 	/**
2457
-	* Gets the aircraft route based on the aircraft callsign
2458
-	*
2459
-	* @param String $callsign the aircraft callsign
2460
-	* @return Array aircraft type
2461
-	*
2462
-	*/
2457
+	 * Gets the aircraft route based on the aircraft callsign
2458
+	 *
2459
+	 * @param String $callsign the aircraft callsign
2460
+	 * @return Array aircraft type
2461
+	 *
2462
+	 */
2463 2463
 	public function getRouteInfo($callsign)
2464 2464
 	{
2465 2465
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2466
-                if ($callsign == '') return array();
2466
+				if ($callsign == '') return array();
2467 2467
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2468 2468
 		
2469 2469
 		$sth = $this->db->prepare($query);
@@ -2477,12 +2477,12 @@  discard block
 block discarded – undo
2477 2477
 	}
2478 2478
 	
2479 2479
 	/**
2480
-	* Gets the aircraft info based on the aircraft registration
2481
-	*
2482
-	* @param String $registration the aircraft registration
2483
-	* @return Array aircraft information
2484
-	*
2485
-	*/
2480
+	 * Gets the aircraft info based on the aircraft registration
2481
+	 *
2482
+	 * @param String $registration the aircraft registration
2483
+	 * @return Array aircraft information
2484
+	 *
2485
+	 */
2486 2486
 	public function getAircraftInfoByRegistration($registration)
2487 2487
 	{
2488 2488
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2509,12 +2509,12 @@  discard block
 block discarded – undo
2509 2509
 	}
2510 2510
 	
2511 2511
 	/**
2512
-	* Gets the aircraft owner & base based on the aircraft registration
2513
-	*
2514
-	* @param String $registration the aircraft registration
2515
-	* @return Array aircraft information
2516
-	*
2517
-	*/
2512
+	 * Gets the aircraft owner & base based on the aircraft registration
2513
+	 *
2514
+	 * @param String $registration the aircraft registration
2515
+	 * @return Array aircraft information
2516
+	 *
2517
+	 */
2518 2518
 	public function getAircraftOwnerByRegistration($registration)
2519 2519
 	{
2520 2520
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2531,11 +2531,11 @@  discard block
 block discarded – undo
2531 2531
 	
2532 2532
   
2533 2533
   /**
2534
-	* Gets all flights (but with only little info)
2535
-	*
2536
-	* @return Array basic flight information
2537
-	*
2538
-	*/
2534
+   * Gets all flights (but with only little info)
2535
+   *
2536
+   * @return Array basic flight information
2537
+   *
2538
+   */
2539 2539
 	public function getAllFlightsforSitemap()
2540 2540
 	{
2541 2541
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
 		
2544 2544
 		$sth = $this->db->prepare($query);
2545 2545
 		$sth->execute();
2546
-                  /*
2546
+				  /*
2547 2547
 		$flight_array = array();
2548 2548
 		$temp_array = array();
2549 2549
 		
@@ -2565,11 +2565,11 @@  discard block
 block discarded – undo
2565 2565
 	}
2566 2566
   
2567 2567
 	/**
2568
-	* Gets a list of all aircraft manufacturers
2569
-	*
2570
-	* @return Array list of aircraft types
2571
-	*
2572
-	*/
2568
+	 * Gets a list of all aircraft manufacturers
2569
+	 *
2570
+	 * @return Array list of aircraft types
2571
+	 *
2572
+	 */
2573 2573
 	public function getAllManufacturers()
2574 2574
 	{
2575 2575
 		/*
@@ -2598,11 +2598,11 @@  discard block
 block discarded – undo
2598 2598
   
2599 2599
   
2600 2600
   /**
2601
-	* Gets a list of all aircraft types
2602
-	*
2603
-	* @return Array list of aircraft types
2604
-	*
2605
-	*/
2601
+   * Gets a list of all aircraft types
2602
+   *
2603
+   * @return Array list of aircraft types
2604
+   *
2605
+   */
2606 2606
 	public function getAllAircraftTypes($filters = array())
2607 2607
 	{
2608 2608
 		/*
@@ -2637,11 +2637,11 @@  discard block
 block discarded – undo
2637 2637
 	
2638 2638
 	
2639 2639
 	/**
2640
-	* Gets a list of all aircraft registrations
2641
-	*
2642
-	* @return Array list of aircraft registrations
2643
-	*
2644
-	*/
2640
+	 * Gets a list of all aircraft registrations
2641
+	 *
2642
+	 * @return Array list of aircraft registrations
2643
+	 *
2644
+	 */
2645 2645
 	public function getAllAircraftRegistrations($filters = array())
2646 2646
 	{
2647 2647
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2666,12 +2666,12 @@  discard block
 block discarded – undo
2666 2666
 	}
2667 2667
 
2668 2668
 	/**
2669
-	* Gets all source name
2670
-	*
2671
-	* @param String type format of source
2672
-	* @return Array list of source name
2673
-	*
2674
-	*/
2669
+	 * Gets all source name
2670
+	 *
2671
+	 * @param String type format of source
2672
+	 * @return Array list of source name
2673
+	 *
2674
+	 */
2675 2675
 	public function getAllSourceName($type = '',$filters = array())
2676 2676
 	{
2677 2677
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 
2703 2703
 
2704 2704
 	/**
2705
-	* Gets a list of all airline names
2706
-	*
2707
-	* @return Array list of airline names
2708
-	*
2709
-	*/
2705
+	 * Gets a list of all airline names
2706
+	 *
2707
+	 * @return Array list of airline names
2708
+	 *
2709
+	 */
2710 2710
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2711 2711
 	{
2712 2712
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
 	}
2756 2756
 	
2757 2757
 	/**
2758
-	* Gets a list of all alliance names
2759
-	*
2760
-	* @return Array list of alliance names
2761
-	*
2762
-	*/
2758
+	 * Gets a list of all alliance names
2759
+	 *
2760
+	 * @return Array list of alliance names
2761
+	 *
2762
+	 */
2763 2763
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2764 2764
 	{
2765 2765
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2784,11 +2784,11 @@  discard block
 block discarded – undo
2784 2784
 	}
2785 2785
 	
2786 2786
 	/**
2787
-	* Gets a list of all airline countries
2788
-	*
2789
-	* @return Array list of airline countries
2790
-	*
2791
-	*/
2787
+	 * Gets a list of all airline countries
2788
+	 *
2789
+	 * @return Array list of airline countries
2790
+	 *
2791
+	 */
2792 2792
 	public function getAllAirlineCountries($filters = array())
2793 2793
 	{
2794 2794
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2816,11 +2816,11 @@  discard block
 block discarded – undo
2816 2816
 	
2817 2817
 	
2818 2818
 	/**
2819
-	* Gets a list of all departure & arrival names
2820
-	*
2821
-	* @return Array list of airport names
2822
-	*
2823
-	*/
2819
+	 * Gets a list of all departure & arrival names
2820
+	 *
2821
+	 * @return Array list of airport names
2822
+	 *
2823
+	 */
2824 2824
 	public function getAllAirportNames($filters = array())
2825 2825
 	{
2826 2826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2868,11 +2868,11 @@  discard block
 block discarded – undo
2868 2868
 	} 
2869 2869
 
2870 2870
 	/**
2871
-	* Gets a list of all owner names
2872
-	*
2873
-	* @return Array list of owner names
2874
-	*
2875
-	*/
2871
+	 * Gets a list of all owner names
2872
+	 *
2873
+	 * @return Array list of owner names
2874
+	 *
2875
+	 */
2876 2876
 	public function getAllOwnerNames($filters = array())
2877 2877
 	{
2878 2878
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2886,11 +2886,11 @@  discard block
 block discarded – undo
2886 2886
 	} 
2887 2887
 
2888 2888
 	/**
2889
-	* Gets a list of all pilot names and pilot ids
2890
-	*
2891
-	* @return Array list of pilot names and pilot ids
2892
-	*
2893
-	*/
2889
+	 * Gets a list of all pilot names and pilot ids
2890
+	 *
2891
+	 * @return Array list of pilot names and pilot ids
2892
+	 *
2893
+	 */
2894 2894
 	public function getAllPilotNames($filters = array())
2895 2895
 	{
2896 2896
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2905,11 +2905,11 @@  discard block
 block discarded – undo
2905 2905
 	
2906 2906
 	
2907 2907
 	/**
2908
-	* Gets a list of all departure & arrival airport countries
2909
-	*
2910
-	* @return Array list of airport countries
2911
-	*
2912
-	*/
2908
+	 * Gets a list of all departure & arrival airport countries
2909
+	 *
2910
+	 * @return Array list of airport countries
2911
+	 *
2912
+	 */
2913 2913
 	public function getAllAirportCountries($filters = array())
2914 2914
 	{
2915 2915
 		$airport_array = array();
@@ -2957,11 +2957,11 @@  discard block
 block discarded – undo
2957 2957
 	
2958 2958
 	
2959 2959
 	/**
2960
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2961
-	*
2962
-	* @return Array list of countries
2963
-	*
2964
-	*/
2960
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2961
+	 *
2962
+	 * @return Array list of countries
2963
+	 *
2964
+	 */
2965 2965
 	public function getAllCountries($filters = array())
2966 2966
 	{
2967 2967
 		$Connection= new Connection($this->db);
@@ -3038,11 +3038,11 @@  discard block
 block discarded – undo
3038 3038
 	
3039 3039
 	
3040 3040
 	/**
3041
-	* Gets a list of all idents/callsigns
3042
-	*
3043
-	* @return Array list of ident/callsign names
3044
-	*
3045
-	*/
3041
+	 * Gets a list of all idents/callsigns
3042
+	 *
3043
+	 * @return Array list of ident/callsign names
3044
+	 *
3045
+	 */
3046 3046
 	public function getAllIdents($filters = array())
3047 3047
 	{
3048 3048
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3066,9 +3066,9 @@  discard block
 block discarded – undo
3066 3066
 	}
3067 3067
 
3068 3068
 	/**
3069
-	* Get a list of flights from airport since 7 days
3070
-	* @return Array number, icao, name and city of airports
3071
-	*/
3069
+	 * Get a list of flights from airport since 7 days
3070
+	 * @return Array number, icao, name and city of airports
3071
+	 */
3072 3072
 
3073 3073
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3074 3074
 		global $globalTimezone, $globalDBdriver;
@@ -3099,9 +3099,9 @@  discard block
 block discarded – undo
3099 3099
 	}
3100 3100
 
3101 3101
 	/**
3102
-	* Get a list of flights from airport since 7 days
3103
-	* @return Array number, icao, name and city of airports
3104
-	*/
3102
+	 * Get a list of flights from airport since 7 days
3103
+	 * @return Array number, icao, name and city of airports
3104
+	 */
3105 3105
 
3106 3106
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3107 3107
 		global $globalTimezone, $globalDBdriver;
@@ -3131,9 +3131,9 @@  discard block
 block discarded – undo
3131 3131
 	}
3132 3132
 
3133 3133
 	/**
3134
-	* Get a list of flights from detected airport since 7 days
3135
-	* @return Array number, icao, name and city of airports
3136
-	*/
3134
+	 * Get a list of flights from detected airport since 7 days
3135
+	 * @return Array number, icao, name and city of airports
3136
+	 */
3137 3137
 
3138 3138
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3139 3139
 		global $globalTimezone, $globalDBdriver;
@@ -3171,9 +3171,9 @@  discard block
 block discarded – undo
3171 3171
 	}
3172 3172
 
3173 3173
 	/**
3174
-	* Get a list of flights from detected airport since 7 days
3175
-	* @return Array number, icao, name and city of airports
3176
-	*/
3174
+	 * Get a list of flights from detected airport since 7 days
3175
+	 * @return Array number, icao, name and city of airports
3176
+	 */
3177 3177
 
3178 3178
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3179 3179
 		global $globalTimezone, $globalDBdriver;
@@ -3215,9 +3215,9 @@  discard block
 block discarded – undo
3215 3215
 
3216 3216
 
3217 3217
 	/**
3218
-	* Get a list of flights to airport since 7 days
3219
-	* @return Array number, icao, name and city of airports
3220
-	*/
3218
+	 * Get a list of flights to airport since 7 days
3219
+	 * @return Array number, icao, name and city of airports
3220
+	 */
3221 3221
 
3222 3222
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3223 3223
 		global $globalTimezone, $globalDBdriver;
@@ -3250,9 +3250,9 @@  discard block
 block discarded – undo
3250 3250
 
3251 3251
 
3252 3252
 	/**
3253
-	* Get a list of flights detected to airport since 7 days
3254
-	* @return Array number, icao, name and city of airports
3255
-	*/
3253
+	 * Get a list of flights detected to airport since 7 days
3254
+	 * @return Array number, icao, name and city of airports
3255
+	 */
3256 3256
 
3257 3257
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3258 3258
 		global $globalTimezone, $globalDBdriver;
@@ -3293,9 +3293,9 @@  discard block
 block discarded – undo
3293 3293
 
3294 3294
 
3295 3295
 	/**
3296
-	* Get a list of flights to airport since 7 days
3297
-	* @return Array number, icao, name and city of airports
3298
-	*/
3296
+	 * Get a list of flights to airport since 7 days
3297
+	 * @return Array number, icao, name and city of airports
3298
+	 */
3299 3299
 
3300 3300
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3301 3301
 		global $globalTimezone, $globalDBdriver;
@@ -3327,9 +3327,9 @@  discard block
 block discarded – undo
3327 3327
 
3328 3328
 
3329 3329
 	/**
3330
-	* Get a list of flights detected to airport since 7 days
3331
-	* @return Array number, icao, name and city of airports
3332
-	*/
3330
+	 * Get a list of flights detected to airport since 7 days
3331
+	 * @return Array number, icao, name and city of airports
3332
+	 */
3333 3333
 
3334 3334
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3335 3335
 		global $globalTimezone, $globalDBdriver;
@@ -3373,11 +3373,11 @@  discard block
 block discarded – undo
3373 3373
 
3374 3374
 
3375 3375
 	/**
3376
-	* Gets a list of all dates
3377
-	*
3378
-	* @return Array list of date names
3379
-	*
3380
-	*/
3376
+	 * Gets a list of all dates
3377
+	 *
3378
+	 * @return Array list of date names
3379
+	 *
3380
+	 */
3381 3381
 	public function getAllDates()
3382 3382
 	{
3383 3383
 		global $globalTimezone, $globalDBdriver;
@@ -3418,11 +3418,11 @@  discard block
 block discarded – undo
3418 3418
 	
3419 3419
 	
3420 3420
 	/**
3421
-	* Gets all route combinations
3422
-	*
3423
-	* @return Array the route list
3424
-	*
3425
-	*/
3421
+	 * Gets all route combinations
3422
+	 *
3423
+	 * @return Array the route list
3424
+	 *
3425
+	 */
3426 3426
 	public function getAllRoutes()
3427 3427
 	{
3428 3428
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3448,13 +3448,13 @@  discard block
 block discarded – undo
3448 3448
 	}
3449 3449
 
3450 3450
 	/**
3451
-	* Update ident spotter data
3452
-	*
3453
-	* @param String $flightaware_id the ID from flightaware
3454
-	* @param String $ident the flight ident
3455
-	* @return String success or false
3456
-	*
3457
-	*/	
3451
+	 * Update ident spotter data
3452
+	 *
3453
+	 * @param String $flightaware_id the ID from flightaware
3454
+	 * @param String $ident the flight ident
3455
+	 * @return String success or false
3456
+	 *
3457
+	 */	
3458 3458
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3459 3459
 	{
3460 3460
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3475,14 +3475,14 @@  discard block
 block discarded – undo
3475 3475
 		} else {
3476 3476
 			$airline_array = $this->getAllAirlineInfo("NA");
3477 3477
 		}
3478
-                $airline_name = $airline_array[0]['name'];
3479
-                $airline_icao = $airline_array[0]['icao'];
3480
-                $airline_country = $airline_array[0]['country'];
3481
-                $airline_type = $airline_array[0]['type'];
3478
+				$airline_name = $airline_array[0]['name'];
3479
+				$airline_icao = $airline_array[0]['icao'];
3480
+				$airline_country = $airline_array[0]['country'];
3481
+				$airline_type = $airline_array[0]['type'];
3482 3482
 
3483 3483
 
3484 3484
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3485
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3485
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3486 3486
 
3487 3487
 		try {
3488 3488
 			$sth = $this->db->prepare($query);
@@ -3495,19 +3495,19 @@  discard block
 block discarded – undo
3495 3495
 
3496 3496
 	}
3497 3497
 	/**
3498
-	* Update latest spotter data
3499
-	*
3500
-	* @param String $flightaware_id the ID from flightaware
3501
-	* @param String $ident the flight ident
3502
-	* @param String $arrival_airport_icao the arrival airport
3503
-	* @return String success or false
3504
-	*
3505
-	*/	
3498
+	 * Update latest spotter data
3499
+	 *
3500
+	 * @param String $flightaware_id the ID from flightaware
3501
+	 * @param String $ident the flight ident
3502
+	 * @param String $arrival_airport_icao the arrival airport
3503
+	 * @return String success or false
3504
+	 *
3505
+	 */	
3506 3506
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3507 3507
 	{
3508 3508
 		if ($groundspeed == '') $groundspeed = NULL;
3509 3509
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3510
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3510
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3511 3511
 
3512 3512
 		try {
3513 3513
 			$sth = $this->db->prepare($query);
@@ -3521,32 +3521,32 @@  discard block
 block discarded – undo
3521 3521
 	}
3522 3522
 
3523 3523
 	/**
3524
-	* Adds a new spotter data
3525
-	*
3526
-	* @param String $flightaware_id the ID from flightaware
3527
-	* @param String $ident the flight ident
3528
-	* @param String $aircraft_icao the aircraft type
3529
-	* @param String $departure_airport_icao the departure airport
3530
-	* @param String $arrival_airport_icao the arrival airport
3531
-	* @param String $latitude latitude of flight
3532
-	* @param String $longitude latitude of flight
3533
-	* @param String $waypoints waypoints of flight
3534
-	* @param String $altitude altitude of flight
3535
-	* @param String $heading heading of flight
3536
-	* @param String $groundspeed speed of flight
3537
-	* @param String $date date of flight
3538
-	* @param String $departure_airport_time departure time of flight
3539
-	* @param String $arrival_airport_time arrival time of flight
3540
-	* @param String $squawk squawk code of flight
3541
-	* @param String $route_stop route stop of flight
3542
-	* @param String $highlight highlight or not
3543
-	* @param String $ModeS ModesS code of flight
3544
-	* @param String $registration registration code of flight
3545
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3546
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3547
-	* @param String $verticalrate vertival rate of flight
3548
-	* @return String success or false
3549
-	*/
3524
+	 * Adds a new spotter data
3525
+	 *
3526
+	 * @param String $flightaware_id the ID from flightaware
3527
+	 * @param String $ident the flight ident
3528
+	 * @param String $aircraft_icao the aircraft type
3529
+	 * @param String $departure_airport_icao the departure airport
3530
+	 * @param String $arrival_airport_icao the arrival airport
3531
+	 * @param String $latitude latitude of flight
3532
+	 * @param String $longitude latitude of flight
3533
+	 * @param String $waypoints waypoints of flight
3534
+	 * @param String $altitude altitude of flight
3535
+	 * @param String $heading heading of flight
3536
+	 * @param String $groundspeed speed of flight
3537
+	 * @param String $date date of flight
3538
+	 * @param String $departure_airport_time departure time of flight
3539
+	 * @param String $arrival_airport_time arrival time of flight
3540
+	 * @param String $squawk squawk code of flight
3541
+	 * @param String $route_stop route stop of flight
3542
+	 * @param String $highlight highlight or not
3543
+	 * @param String $ModeS ModesS code of flight
3544
+	 * @param String $registration registration code of flight
3545
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3546
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3547
+	 * @param String $verticalrate vertival rate of flight
3548
+	 * @return String success or false
3549
+	 */
3550 3550
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3551 3551
 	{
3552 3552
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3761,8 +3761,8 @@  discard block
 block discarded – undo
3761 3761
     
3762 3762
 		if ($globalIVAO && $aircraft_icao != '')
3763 3763
 		{
3764
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3765
-            		else $airline_icao = '';
3764
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3765
+					else $airline_icao = '';
3766 3766
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3767 3767
 			if (!isset($image_array[0]['registration']))
3768 3768
 			{
@@ -3793,53 +3793,53 @@  discard block
 block discarded – undo
3793 3793
 	
3794 3794
 		if (count($airline_array) == 0) 
3795 3795
 		{
3796
-                        $airline_array = $this->getAllAirlineInfo('NA');
3797
-                }
3798
-                if (count($aircraft_array) == 0) 
3799
-                {
3800
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3801
-                }
3802
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3803
-                {
3804
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3805
-                }
3806
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3807
-                {
3808
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3809
-                }
3810
-                if ($registration == '') $registration = 'NA';
3811
-                if ($latitude == '' && $longitude == '') {
3812
-            		$latitude = 0;
3813
-            		$longitude = 0;
3814
-            	}
3815
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3816
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3817
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3818
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3819
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3820
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3796
+						$airline_array = $this->getAllAirlineInfo('NA');
3797
+				}
3798
+				if (count($aircraft_array) == 0) 
3799
+				{
3800
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3801
+				}
3802
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3803
+				{
3804
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3805
+				}
3806
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3807
+				{
3808
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3809
+				}
3810
+				if ($registration == '') $registration = 'NA';
3811
+				if ($latitude == '' && $longitude == '') {
3812
+					$latitude = 0;
3813
+					$longitude = 0;
3814
+				}
3815
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3816
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3817
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3818
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3819
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3820
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3821 3821
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3822 3822
 
3823
-                $airline_name = $airline_array[0]['name'];
3824
-                $airline_icao = $airline_array[0]['icao'];
3825
-                $airline_country = $airline_array[0]['country'];
3826
-                $airline_type = $airline_array[0]['type'];
3823
+				$airline_name = $airline_array[0]['name'];
3824
+				$airline_icao = $airline_array[0]['icao'];
3825
+				$airline_country = $airline_array[0]['country'];
3826
+				$airline_type = $airline_array[0]['type'];
3827 3827
 		if ($airline_type == '') {
3828 3828
 			$timeelapsed = microtime(true);
3829 3829
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3830 3830
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3831 3831
 		}
3832 3832
 		if ($airline_type == null) $airline_type = '';
3833
-                $aircraft_type = $aircraft_array[0]['type'];
3834
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3835
-                $departure_airport_name = $departure_airport_array[0]['name'];
3836
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3837
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3833
+				$aircraft_type = $aircraft_array[0]['type'];
3834
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3835
+				$departure_airport_name = $departure_airport_array[0]['name'];
3836
+			$departure_airport_city = $departure_airport_array[0]['city'];
3837
+				$departure_airport_country = $departure_airport_array[0]['country'];
3838 3838
                 
3839
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3840
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3841
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3842
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3839
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3840
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3841
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3842
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3843 3843
 
3844 3844
 		try {
3845 3845
 		        
@@ -3847,7 +3847,7 @@  discard block
 block discarded – undo
3847 3847
 			$sth->execute($query_values);
3848 3848
 			$this->db = null;
3849 3849
 		} catch (PDOException $e) {
3850
-		    return "error : ".$e->getMessage();
3850
+			return "error : ".$e->getMessage();
3851 3851
 		}
3852 3852
 		
3853 3853
 		return "success";
@@ -3856,11 +3856,11 @@  discard block
 block discarded – undo
3856 3856
 	
3857 3857
   
3858 3858
 	/**
3859
-	* Gets the aircraft ident within the last hour
3860
-	*
3861
-	* @return String the ident
3862
-	*
3863
-	*/
3859
+	 * Gets the aircraft ident within the last hour
3860
+	 *
3861
+	 * @return String the ident
3862
+	 *
3863
+	 */
3864 3864
 	public function getIdentFromLastHour($ident)
3865 3865
 	{
3866 3866
 		global $globalDBdriver, $globalTimezone;
@@ -3876,11 +3876,11 @@  discard block
 block discarded – undo
3876 3876
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3877 3877
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3878 3878
 			$query_data = array(':ident' => $ident);
3879
-    		}
3879
+			}
3880 3880
 		
3881 3881
 		$sth = $this->db->prepare($query);
3882 3882
 		$sth->execute($query_data);
3883
-    		$ident_result='';
3883
+			$ident_result='';
3884 3884
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3885 3885
 		{
3886 3886
 			$ident_result = $row['ident'];
@@ -3891,11 +3891,11 @@  discard block
 block discarded – undo
3891 3891
 	
3892 3892
 	
3893 3893
 	/**
3894
-	* Gets the aircraft data from the last 20 seconds
3895
-	*
3896
-	* @return Array the spotter data
3897
-	*
3898
-	*/
3894
+	 * Gets the aircraft data from the last 20 seconds
3895
+	 *
3896
+	 * @return Array the spotter data
3897
+	 *
3898
+	 */
3899 3899
 	public function getRealTimeData($q = '')
3900 3900
 	{
3901 3901
 		global $globalDBdriver;
@@ -3939,11 +3939,11 @@  discard block
 block discarded – undo
3939 3939
 	
3940 3940
 	
3941 3941
 	 /**
3942
-	* Gets all airlines that have flown over
3943
-	*
3944
-	* @return Array the airline list
3945
-	*
3946
-	*/
3942
+	  * Gets all airlines that have flown over
3943
+	  *
3944
+	  * @return Array the airline list
3945
+	  *
3946
+	  */
3947 3947
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3948 3948
 	{
3949 3949
 		global $globalDBdriver;
@@ -3957,7 +3957,7 @@  discard block
 block discarded – undo
3957 3957
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3958 3958
 			}
3959 3959
 		}
3960
-                if ($sincedate != '') {
3960
+				if ($sincedate != '') {
3961 3961
 			if ($globalDBdriver == 'mysql') {
3962 3962
 				$query .= " AND spotter_output.date > '".$sincedate."'";
3963 3963
 			} else {
@@ -4011,26 +4011,26 @@  discard block
 block discarded – undo
4011 4011
 	}
4012 4012
 
4013 4013
 	 /**
4014
-	* Gets all pilots that have flown over
4015
-	*
4016
-	* @return Array the pilots list
4017
-	*
4018
-	*/
4014
+	  * Gets all pilots that have flown over
4015
+	  *
4016
+	  * @return Array the pilots list
4017
+	  *
4018
+	  */
4019 4019
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4020 4020
 	{
4021 4021
 		global $globalDBdriver;
4022 4022
 		$filter_query = $this->getFilter($filters,true,true);
4023 4023
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4024 4024
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
4025
-                if ($olderthanmonths > 0) {
4026
-            		if ($globalDBdriver == 'mysql') {
4025
+				if ($olderthanmonths > 0) {
4026
+					if ($globalDBdriver == 'mysql') {
4027 4027
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4028 4028
 			} else {
4029 4029
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4030 4030
 			}
4031 4031
 		}
4032
-                if ($sincedate != '') {
4033
-            		if ($globalDBdriver == 'mysql') {
4032
+				if ($sincedate != '') {
4033
+					if ($globalDBdriver == 'mysql') {
4034 4034
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4035 4035
 			} else {
4036 4036
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4085,25 +4085,25 @@  discard block
 block discarded – undo
4085 4085
 	}
4086 4086
 	
4087 4087
 	/**
4088
-	* Gets all pilots that have flown over
4089
-	*
4090
-	* @return Array the pilots list
4091
-	*
4092
-	*/
4088
+	 * Gets all pilots that have flown over
4089
+	 *
4090
+	 * @return Array the pilots list
4091
+	 *
4092
+	 */
4093 4093
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4094 4094
 	{
4095 4095
 		global $globalDBdriver;
4096 4096
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4097 4097
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4098
-                if ($olderthanmonths > 0) {
4099
-            		if ($globalDBdriver == 'mysql') {
4098
+				if ($olderthanmonths > 0) {
4099
+					if ($globalDBdriver == 'mysql') {
4100 4100
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4101 4101
 			} else {
4102 4102
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4103 4103
 			}
4104 4104
 		}
4105
-                if ($sincedate != '') {
4106
-            		if ($globalDBdriver == 'mysql') {
4105
+				if ($sincedate != '') {
4106
+					if ($globalDBdriver == 'mysql') {
4107 4107
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4108 4108
 			} else {
4109 4109
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4132,26 +4132,26 @@  discard block
 block discarded – undo
4132 4132
 	}
4133 4133
 	
4134 4134
 	 /**
4135
-	* Gets all owner that have flown over
4136
-	*
4137
-	* @return Array the pilots list
4138
-	*
4139
-	*/
4135
+	  * Gets all owner that have flown over
4136
+	  *
4137
+	  * @return Array the pilots list
4138
+	  *
4139
+	  */
4140 4140
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4141 4141
 	{
4142 4142
 		global $globalDBdriver;
4143 4143
 		$filter_query = $this->getFilter($filters,true,true);
4144 4144
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4145 4145
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4146
-                if ($olderthanmonths > 0) {
4147
-            		if ($globalDBdriver == 'mysql') {
4146
+				if ($olderthanmonths > 0) {
4147
+					if ($globalDBdriver == 'mysql') {
4148 4148
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4149 4149
 			} else {
4150 4150
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4151 4151
 			}
4152 4152
 		}
4153
-                if ($sincedate != '') {
4154
-            		if ($globalDBdriver == 'mysql') {
4153
+				if ($sincedate != '') {
4154
+					if ($globalDBdriver == 'mysql') {
4155 4155
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4156 4156
 			} else {
4157 4157
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4202,26 +4202,26 @@  discard block
 block discarded – undo
4202 4202
 	}
4203 4203
 	
4204 4204
 	 /**
4205
-	* Gets all owner that have flown over
4206
-	*
4207
-	* @return Array the pilots list
4208
-	*
4209
-	*/
4205
+	  * Gets all owner that have flown over
4206
+	  *
4207
+	  * @return Array the pilots list
4208
+	  *
4209
+	  */
4210 4210
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4211 4211
 	{
4212 4212
 		global $globalDBdriver;
4213 4213
 		$filter_query = $this->getFilter($filters,true,true);
4214 4214
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4215 4215
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4216
-                if ($olderthanmonths > 0) {
4217
-            		if ($globalDBdriver == 'mysql') {
4216
+				if ($olderthanmonths > 0) {
4217
+					if ($globalDBdriver == 'mysql') {
4218 4218
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4219 4219
 			} else {
4220 4220
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4221 4221
 			}
4222 4222
 		}
4223
-                if ($sincedate != '') {
4224
-            		if ($globalDBdriver == 'mysql') {
4223
+				if ($sincedate != '') {
4224
+					if ($globalDBdriver == 'mysql') {
4225 4225
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4226 4226
 			} else {
4227 4227
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4248,11 +4248,11 @@  discard block
 block discarded – undo
4248 4248
 	}
4249 4249
 
4250 4250
 	/**
4251
-	* Gets all airlines that have flown over by aircraft
4252
-	*
4253
-	* @return Array the airline list
4254
-	*
4255
-	*/
4251
+	 * Gets all airlines that have flown over by aircraft
4252
+	 *
4253
+	 * @return Array the airline list
4254
+	 *
4255
+	 */
4256 4256
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4257 4257
 	{
4258 4258
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4284,11 +4284,11 @@  discard block
 block discarded – undo
4284 4284
 
4285 4285
 
4286 4286
 	/**
4287
-	* Gets all airline countries that have flown over by aircraft
4288
-	*
4289
-	* @return Array the airline country list
4290
-	*
4291
-	*/
4287
+	 * Gets all airline countries that have flown over by aircraft
4288
+	 *
4289
+	 * @return Array the airline country list
4290
+	 *
4291
+	 */
4292 4292
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4293 4293
 	{
4294 4294
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4320,11 +4320,11 @@  discard block
 block discarded – undo
4320 4320
 	
4321 4321
 	
4322 4322
 	/**
4323
-	* Gets all airlines that have flown over by airport
4324
-	*
4325
-	* @return Array the airline list
4326
-	*
4327
-	*/
4323
+	 * Gets all airlines that have flown over by airport
4324
+	 *
4325
+	 * @return Array the airline list
4326
+	 *
4327
+	 */
4328 4328
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4329 4329
 	{
4330 4330
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4355,11 +4355,11 @@  discard block
 block discarded – undo
4355 4355
 
4356 4356
 
4357 4357
 	/**
4358
-	* Gets all airline countries that have flown over by airport icao
4359
-	*
4360
-	* @return Array the airline country list
4361
-	*
4362
-	*/
4358
+	 * Gets all airline countries that have flown over by airport icao
4359
+	 *
4360
+	 * @return Array the airline country list
4361
+	 *
4362
+	 */
4363 4363
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4364 4364
 	{
4365 4365
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4389,11 +4389,11 @@  discard block
 block discarded – undo
4389 4389
 
4390 4390
 
4391 4391
 	/**
4392
-	* Gets all airlines that have flown over by aircraft manufacturer
4393
-	*
4394
-	* @return Array the airline list
4395
-	*
4396
-	*/
4392
+	 * Gets all airlines that have flown over by aircraft manufacturer
4393
+	 *
4394
+	 * @return Array the airline list
4395
+	 *
4396
+	 */
4397 4397
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4398 4398
 	{
4399 4399
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4424,11 +4424,11 @@  discard block
 block discarded – undo
4424 4424
 
4425 4425
 
4426 4426
 	/**
4427
-	* Gets all airline countries that have flown over by aircraft manufacturer
4428
-	*
4429
-	* @return Array the airline country list
4430
-	*
4431
-	*/
4427
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4428
+	 *
4429
+	 * @return Array the airline country list
4430
+	 *
4431
+	 */
4432 4432
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4433 4433
 	{
4434 4434
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4457,11 +4457,11 @@  discard block
 block discarded – undo
4457 4457
 
4458 4458
 
4459 4459
 	/**
4460
-	* Gets all airlines that have flown over by date
4461
-	*
4462
-	* @return Array the airline list
4463
-	*
4464
-	*/
4460
+	 * Gets all airlines that have flown over by date
4461
+	 *
4462
+	 * @return Array the airline list
4463
+	 *
4464
+	 */
4465 4465
 	public function countAllAirlinesByDate($date,$filters = array())
4466 4466
 	{
4467 4467
 		global $globalTimezone, $globalDBdriver;
@@ -4505,11 +4505,11 @@  discard block
 block discarded – undo
4505 4505
 	
4506 4506
 	
4507 4507
 	/**
4508
-	* Gets all airline countries that have flown over by date
4509
-	*
4510
-	* @return Array the airline country list
4511
-	*
4512
-	*/
4508
+	 * Gets all airline countries that have flown over by date
4509
+	 *
4510
+	 * @return Array the airline country list
4511
+	 *
4512
+	 */
4513 4513
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4514 4514
 	{
4515 4515
 		global $globalTimezone, $globalDBdriver;
@@ -4552,11 +4552,11 @@  discard block
 block discarded – undo
4552 4552
 
4553 4553
 
4554 4554
 	/**
4555
-	* Gets all airlines that have flown over by ident/callsign
4556
-	*
4557
-	* @return Array the airline list
4558
-	*
4559
-	*/
4555
+	 * Gets all airlines that have flown over by ident/callsign
4556
+	 *
4557
+	 * @return Array the airline list
4558
+	 *
4559
+	 */
4560 4560
 	public function countAllAirlinesByIdent($ident,$filters = array())
4561 4561
 	{
4562 4562
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4573,11 +4573,11 @@  discard block
 block discarded – undo
4573 4573
 	}
4574 4574
 
4575 4575
 	/**
4576
-	* Gets all airlines by owner
4577
-	*
4578
-	* @return Array the airline list
4579
-	*
4580
-	*/
4576
+	 * Gets all airlines by owner
4577
+	 *
4578
+	 * @return Array the airline list
4579
+	 *
4580
+	 */
4581 4581
 	public function countAllAirlinesByOwner($owner,$filters = array())
4582 4582
 	{
4583 4583
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4594,11 +4594,11 @@  discard block
 block discarded – undo
4594 4594
 	}
4595 4595
 
4596 4596
 	/**
4597
-	* Gets all airlines used by pilot
4598
-	*
4599
-	* @return Array the airline list
4600
-	*
4601
-	*/
4597
+	 * Gets all airlines used by pilot
4598
+	 *
4599
+	 * @return Array the airline list
4600
+	 *
4601
+	 */
4602 4602
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4603 4603
 	{
4604 4604
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4615,11 +4615,11 @@  discard block
 block discarded – undo
4615 4615
 	}
4616 4616
 
4617 4617
 	/**
4618
-	* Gets all airlines that have flown over by route
4619
-	*
4620
-	* @return Array the airline list
4621
-	*
4622
-	*/
4618
+	 * Gets all airlines that have flown over by route
4619
+	 *
4620
+	 * @return Array the airline list
4621
+	 *
4622
+	 */
4623 4623
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4624 4624
 	{
4625 4625
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4651,11 +4651,11 @@  discard block
 block discarded – undo
4651 4651
 	}
4652 4652
 
4653 4653
 	/**
4654
-	* Gets all airline countries that have flown over by route
4655
-	*
4656
-	* @return Array the airline country list
4657
-	*
4658
-	*/
4654
+	 * Gets all airline countries that have flown over by route
4655
+	 *
4656
+	 * @return Array the airline country list
4657
+	 *
4658
+	 */
4659 4659
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4660 4660
 	{
4661 4661
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4687,11 +4687,11 @@  discard block
 block discarded – undo
4687 4687
 
4688 4688
 
4689 4689
 	/**
4690
-	* Gets all airlines that have flown over by country
4691
-	*
4692
-	* @return Array the airline list
4693
-	*
4694
-	*/
4690
+	 * Gets all airlines that have flown over by country
4691
+	 *
4692
+	 * @return Array the airline list
4693
+	 *
4694
+	 */
4695 4695
 	public function countAllAirlinesByCountry($country,$filters = array())
4696 4696
 	{
4697 4697
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4721,11 +4721,11 @@  discard block
 block discarded – undo
4721 4721
 
4722 4722
 
4723 4723
 	/**
4724
-	* Gets all airline countries that have flown over by country
4725
-	*
4726
-	* @return Array the airline country list
4727
-	*
4728
-	*/
4724
+	 * Gets all airline countries that have flown over by country
4725
+	 *
4726
+	 * @return Array the airline country list
4727
+	 *
4728
+	 */
4729 4729
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4730 4730
 	{
4731 4731
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4754,11 +4754,11 @@  discard block
 block discarded – undo
4754 4754
 
4755 4755
 
4756 4756
 	/**
4757
-	* Gets all airlines countries
4758
-	*
4759
-	* @return Array the airline country list
4760
-	*
4761
-	*/
4757
+	 * Gets all airlines countries
4758
+	 *
4759
+	 * @return Array the airline country list
4760
+	 *
4761
+	 */
4762 4762
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4763 4763
 	{
4764 4764
 		global $globalDBdriver;
@@ -4813,11 +4813,11 @@  discard block
 block discarded – undo
4813 4813
 	}
4814 4814
 
4815 4815
 	/**
4816
-	* Gets all number of flight over countries
4817
-	*
4818
-	* @return Array the airline country list
4819
-	*
4820
-	*/
4816
+	 * Gets all number of flight over countries
4817
+	 *
4818
+	 * @return Array the airline country list
4819
+	 *
4820
+	 */
4821 4821
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4822 4822
 	{
4823 4823
 		global $globalDBdriver;
@@ -4839,15 +4839,15 @@  discard block
 block discarded – undo
4839 4839
 		$SpotterLive = new SpotterLive();
4840 4840
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4841 4841
 		$filter_query .= ' over_country IS NOT NULL';
4842
-                if ($olderthanmonths > 0) {
4842
+				if ($olderthanmonths > 0) {
4843 4843
 			if ($globalDBdriver == 'mysql') {
4844 4844
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4845 4845
 			} else {
4846 4846
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4847 4847
 			}
4848 4848
 		}
4849
-                if ($sincedate != '') {
4850
-            		if ($globalDBdriver == 'mysql') {
4849
+				if ($sincedate != '') {
4850
+					if ($globalDBdriver == 'mysql') {
4851 4851
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4852 4852
 			} else {
4853 4853
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4877,11 +4877,11 @@  discard block
 block discarded – undo
4877 4877
 	
4878 4878
 	
4879 4879
 	/**
4880
-	* Gets all aircraft types that have flown over
4881
-	*
4882
-	* @return Array the aircraft list
4883
-	*
4884
-	*/
4880
+	 * Gets all aircraft types that have flown over
4881
+	 *
4882
+	 * @return Array the aircraft list
4883
+	 *
4884
+	 */
4885 4885
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4886 4886
 	{
4887 4887
 		global $globalDBdriver;
@@ -4951,11 +4951,11 @@  discard block
 block discarded – undo
4951 4951
 	}
4952 4952
 
4953 4953
 	/**
4954
-	* Gets all aircraft types that have flown over by airline
4955
-	*
4956
-	* @return Array the aircraft list
4957
-	*
4958
-	*/
4954
+	 * Gets all aircraft types that have flown over by airline
4955
+	 *
4956
+	 * @return Array the aircraft list
4957
+	 *
4958
+	 */
4959 4959
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4960 4960
 	{
4961 4961
 		global $globalDBdriver;
@@ -5026,11 +5026,11 @@  discard block
 block discarded – undo
5026 5026
 	}
5027 5027
 
5028 5028
 	/**
5029
-	* Gets all aircraft types that have flown over by months
5030
-	*
5031
-	* @return Array the aircraft list
5032
-	*
5033
-	*/
5029
+	 * Gets all aircraft types that have flown over by months
5030
+	 *
5031
+	 * @return Array the aircraft list
5032
+	 *
5033
+	 */
5034 5034
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5035 5035
 	{
5036 5036
 		global $globalDBdriver;
@@ -5074,11 +5074,11 @@  discard block
 block discarded – undo
5074 5074
 
5075 5075
 
5076 5076
 	/**
5077
-	* Gets all aircraft registration that have flown over by aircaft icao
5078
-	*
5079
-	* @return Array the aircraft list
5080
-	*
5081
-	*/
5077
+	 * Gets all aircraft registration that have flown over by aircaft icao
5078
+	 *
5079
+	 * @return Array the aircraft list
5080
+	 *
5081
+	 */
5082 5082
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5083 5083
 	{
5084 5084
 		$Image = new Image($this->db);
@@ -5117,11 +5117,11 @@  discard block
 block discarded – undo
5117 5117
 
5118 5118
 
5119 5119
 	/**
5120
-	* Gets all aircraft types that have flown over by airline icao
5121
-	*
5122
-	* @return Array the aircraft list
5123
-	*
5124
-	*/
5120
+	 * Gets all aircraft types that have flown over by airline icao
5121
+	 *
5122
+	 * @return Array the aircraft list
5123
+	 *
5124
+	 */
5125 5125
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5126 5126
 	{
5127 5127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5150,11 +5150,11 @@  discard block
 block discarded – undo
5150 5150
 
5151 5151
 
5152 5152
 	/**
5153
-	* Gets all aircraft registration that have flown over by airline icao
5154
-	*
5155
-	* @return Array the aircraft list
5156
-	*
5157
-	*/
5153
+	 * Gets all aircraft registration that have flown over by airline icao
5154
+	 *
5155
+	 * @return Array the aircraft list
5156
+	 *
5157
+	 */
5158 5158
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5159 5159
 	{
5160 5160
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5192,11 +5192,11 @@  discard block
 block discarded – undo
5192 5192
 
5193 5193
 
5194 5194
 	/**
5195
-	* Gets all aircraft manufacturer that have flown over by airline icao
5196
-	*
5197
-	* @return Array the aircraft list
5198
-	*
5199
-	*/
5195
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5196
+	 *
5197
+	 * @return Array the aircraft list
5198
+	 *
5199
+	 */
5200 5200
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5201 5201
 	{
5202 5202
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5224,11 +5224,11 @@  discard block
 block discarded – undo
5224 5224
 
5225 5225
 
5226 5226
 	/**
5227
-	* Gets all aircraft types that have flown over by airline icao
5228
-	*
5229
-	* @return Array the aircraft list
5230
-	*
5231
-	*/
5227
+	 * Gets all aircraft types that have flown over by airline icao
5228
+	 *
5229
+	 * @return Array the aircraft list
5230
+	 *
5231
+	 */
5232 5232
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5233 5233
 	{
5234 5234
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5257,11 +5257,11 @@  discard block
 block discarded – undo
5257 5257
 
5258 5258
 
5259 5259
 	/**
5260
-	* Gets all aircraft registration that have flown over by airport icao
5261
-	*
5262
-	* @return Array the aircraft list
5263
-	*
5264
-	*/
5260
+	 * Gets all aircraft registration that have flown over by airport icao
5261
+	 *
5262
+	 * @return Array the aircraft list
5263
+	 *
5264
+	 */
5265 5265
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5266 5266
 	{
5267 5267
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5298,11 +5298,11 @@  discard block
 block discarded – undo
5298 5298
 	
5299 5299
 	
5300 5300
 	/**
5301
-	* Gets all aircraft manufacturer that have flown over by airport icao
5302
-	*
5303
-	* @return Array the aircraft list
5304
-	*
5305
-	*/
5301
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5302
+	 *
5303
+	 * @return Array the aircraft list
5304
+	 *
5305
+	 */
5306 5306
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5307 5307
 	{
5308 5308
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5328,11 +5328,11 @@  discard block
 block discarded – undo
5328 5328
 	}
5329 5329
 
5330 5330
 	/**
5331
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5332
-	*
5333
-	* @return Array the aircraft list
5334
-	*
5335
-	*/
5331
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5332
+	 *
5333
+	 * @return Array the aircraft list
5334
+	 *
5335
+	 */
5336 5336
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5337 5337
 	{
5338 5338
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5359,11 +5359,11 @@  discard block
 block discarded – undo
5359 5359
 
5360 5360
 
5361 5361
 	/**
5362
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5363
-	*
5364
-	* @return Array the aircraft list
5365
-	*
5366
-	*/
5362
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5363
+	 *
5364
+	 * @return Array the aircraft list
5365
+	 *
5366
+	 */
5367 5367
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5368 5368
 	{
5369 5369
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5399,11 +5399,11 @@  discard block
 block discarded – undo
5399 5399
 	}
5400 5400
 
5401 5401
 	/**
5402
-	* Gets all aircraft types that have flown over by date
5403
-	*
5404
-	* @return Array the aircraft list
5405
-	*
5406
-	*/
5402
+	 * Gets all aircraft types that have flown over by date
5403
+	 *
5404
+	 * @return Array the aircraft list
5405
+	 *
5406
+	 */
5407 5407
 	public function countAllAircraftTypesByDate($date,$filters = array())
5408 5408
 	{
5409 5409
 		global $globalTimezone, $globalDBdriver;
@@ -5445,11 +5445,11 @@  discard block
 block discarded – undo
5445 5445
 
5446 5446
 
5447 5447
 	/**
5448
-	* Gets all aircraft registration that have flown over by date
5449
-	*
5450
-	* @return Array the aircraft list
5451
-	*
5452
-	*/
5448
+	 * Gets all aircraft registration that have flown over by date
5449
+	 *
5450
+	 * @return Array the aircraft list
5451
+	 *
5452
+	 */
5453 5453
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5454 5454
 	{
5455 5455
 		global $globalTimezone, $globalDBdriver;
@@ -5500,11 +5500,11 @@  discard block
 block discarded – undo
5500 5500
 
5501 5501
 
5502 5502
 	/**
5503
-	* Gets all aircraft manufacturer that have flown over by date
5504
-	*
5505
-	* @return Array the aircraft manufacturer list
5506
-	*
5507
-	*/
5503
+	 * Gets all aircraft manufacturer that have flown over by date
5504
+	 *
5505
+	 * @return Array the aircraft manufacturer list
5506
+	 *
5507
+	 */
5508 5508
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5509 5509
 	{
5510 5510
 		global $globalTimezone, $globalDBdriver;
@@ -5546,11 +5546,11 @@  discard block
 block discarded – undo
5546 5546
 
5547 5547
 
5548 5548
 	/**
5549
-	* Gets all aircraft types that have flown over by ident/callsign
5550
-	*
5551
-	* @return Array the aircraft list
5552
-	*
5553
-	*/
5549
+	 * Gets all aircraft types that have flown over by ident/callsign
5550
+	 *
5551
+	 * @return Array the aircraft list
5552
+	 *
5553
+	 */
5554 5554
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5555 5555
 	{
5556 5556
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5578,11 +5578,11 @@  discard block
 block discarded – undo
5578 5578
 	}
5579 5579
 
5580 5580
 	/**
5581
-	* Gets all aircraft types that have flown over by pilot
5582
-	*
5583
-	* @return Array the aircraft list
5584
-	*
5585
-	*/
5581
+	 * Gets all aircraft types that have flown over by pilot
5582
+	 *
5583
+	 * @return Array the aircraft list
5584
+	 *
5585
+	 */
5586 5586
 	public function countAllAircraftTypesByPilot($pilot,$filters = array())
5587 5587
 	{
5588 5588
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5598,11 +5598,11 @@  discard block
 block discarded – undo
5598 5598
 	}
5599 5599
 
5600 5600
 	/**
5601
-	* Gets all aircraft types that have flown over by owner
5602
-	*
5603
-	* @return Array the aircraft list
5604
-	*
5605
-	*/
5601
+	 * Gets all aircraft types that have flown over by owner
5602
+	 *
5603
+	 * @return Array the aircraft list
5604
+	 *
5605
+	 */
5606 5606
 	public function countAllAircraftTypesByOwner($owner,$filters = array())
5607 5607
 	{
5608 5608
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5619,11 +5619,11 @@  discard block
 block discarded – undo
5619 5619
 
5620 5620
 
5621 5621
 	/**
5622
-	* Gets all aircraft registration that have flown over by ident/callsign
5623
-	*
5624
-	* @return Array the aircraft list
5625
-	*
5626
-	*/
5622
+	 * Gets all aircraft registration that have flown over by ident/callsign
5623
+	 *
5624
+	 * @return Array the aircraft list
5625
+	 *
5626
+	 */
5627 5627
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5628 5628
 	{
5629 5629
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5662,11 +5662,11 @@  discard block
 block discarded – undo
5662 5662
 	}
5663 5663
 
5664 5664
 	/**
5665
-	* Gets all aircraft registration that have flown over by owner
5666
-	*
5667
-	* @return Array the aircraft list
5668
-	*
5669
-	*/
5665
+	 * Gets all aircraft registration that have flown over by owner
5666
+	 *
5667
+	 * @return Array the aircraft list
5668
+	 *
5669
+	 */
5670 5670
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
5671 5671
 	{
5672 5672
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5706,11 +5706,11 @@  discard block
 block discarded – undo
5706 5706
 	}
5707 5707
 
5708 5708
 	/**
5709
-	* Gets all aircraft registration that have flown over by pilot
5710
-	*
5711
-	* @return Array the aircraft list
5712
-	*
5713
-	*/
5709
+	 * Gets all aircraft registration that have flown over by pilot
5710
+	 *
5711
+	 * @return Array the aircraft list
5712
+	 *
5713
+	 */
5714 5714
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array())
5715 5715
 	{
5716 5716
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5751,11 +5751,11 @@  discard block
 block discarded – undo
5751 5751
 
5752 5752
 
5753 5753
 	/**
5754
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5755
-	*
5756
-	* @return Array the aircraft manufacturer list
5757
-	*
5758
-	*/
5754
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5755
+	 *
5756
+	 * @return Array the aircraft manufacturer list
5757
+	 *
5758
+	 */
5759 5759
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5760 5760
 	{
5761 5761
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5780,11 +5780,11 @@  discard block
 block discarded – undo
5780 5780
 	}
5781 5781
 
5782 5782
 	/**
5783
-	* Gets all aircraft manufacturer that have flown over by owner
5784
-	*
5785
-	* @return Array the aircraft manufacturer list
5786
-	*
5787
-	*/
5783
+	 * Gets all aircraft manufacturer that have flown over by owner
5784
+	 *
5785
+	 * @return Array the aircraft manufacturer list
5786
+	 *
5787
+	 */
5788 5788
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
5789 5789
 	{
5790 5790
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5801,11 +5801,11 @@  discard block
 block discarded – undo
5801 5801
 	}
5802 5802
 
5803 5803
 	/**
5804
-	* Gets all aircraft manufacturer that have flown over by pilot
5805
-	*
5806
-	* @return Array the aircraft manufacturer list
5807
-	*
5808
-	*/
5804
+	 * Gets all aircraft manufacturer that have flown over by pilot
5805
+	 *
5806
+	 * @return Array the aircraft manufacturer list
5807
+	 *
5808
+	 */
5809 5809
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array())
5810 5810
 	{
5811 5811
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5823,11 +5823,11 @@  discard block
 block discarded – undo
5823 5823
 
5824 5824
 
5825 5825
 	/**
5826
-	* Gets all aircraft types that have flown over by route
5827
-	*
5828
-	* @return Array the aircraft list
5829
-	*
5830
-	*/
5826
+	 * Gets all aircraft types that have flown over by route
5827
+	 *
5828
+	 * @return Array the aircraft list
5829
+	 *
5830
+	 */
5831 5831
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5832 5832
 	{
5833 5833
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5856,11 +5856,11 @@  discard block
 block discarded – undo
5856 5856
 	}
5857 5857
 
5858 5858
 	/**
5859
-	* Gets all aircraft registration that have flown over by route
5860
-	*
5861
-	* @return Array the aircraft list
5862
-	*
5863
-	*/
5859
+	 * Gets all aircraft registration that have flown over by route
5860
+	 *
5861
+	 * @return Array the aircraft list
5862
+	 *
5863
+	 */
5864 5864
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5865 5865
 	{
5866 5866
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5902,11 +5902,11 @@  discard block
 block discarded – undo
5902 5902
 	
5903 5903
 	
5904 5904
 	/**
5905
-	* Gets all aircraft manufacturer that have flown over by route
5906
-	*
5907
-	* @return Array the aircraft manufacturer list
5908
-	*
5909
-	*/
5905
+	 * Gets all aircraft manufacturer that have flown over by route
5906
+	 *
5907
+	 * @return Array the aircraft manufacturer list
5908
+	 *
5909
+	 */
5910 5910
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5911 5911
 	{
5912 5912
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5940,11 +5940,11 @@  discard block
 block discarded – undo
5940 5940
 	
5941 5941
 	
5942 5942
 	/**
5943
-	* Gets all aircraft types that have flown over by country
5944
-	*
5945
-	* @return Array the aircraft list
5946
-	*
5947
-	*/
5943
+	 * Gets all aircraft types that have flown over by country
5944
+	 *
5945
+	 * @return Array the aircraft list
5946
+	 *
5947
+	 */
5948 5948
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5949 5949
 	{
5950 5950
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5975,11 +5975,11 @@  discard block
 block discarded – undo
5975 5975
 
5976 5976
 
5977 5977
 	/**
5978
-	* Gets all aircraft registration that have flown over by country
5979
-	*
5980
-	* @return Array the aircraft list
5981
-	*
5982
-	*/
5978
+	 * Gets all aircraft registration that have flown over by country
5979
+	 *
5980
+	 * @return Array the aircraft list
5981
+	 *
5982
+	 */
5983 5983
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5984 5984
 	{
5985 5985
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6019,11 +6019,11 @@  discard block
 block discarded – undo
6019 6019
 	
6020 6020
 	
6021 6021
 	/**
6022
-	* Gets all aircraft manufacturer that have flown over by country
6023
-	*
6024
-	* @return Array the aircraft manufacturer list
6025
-	*
6026
-	*/
6022
+	 * Gets all aircraft manufacturer that have flown over by country
6023
+	 *
6024
+	 * @return Array the aircraft manufacturer list
6025
+	 *
6026
+	 */
6027 6027
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6028 6028
 	{
6029 6029
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6054,18 +6054,18 @@  discard block
 block discarded – undo
6054 6054
 	
6055 6055
 	
6056 6056
 	/**
6057
-	* Gets all aircraft manufacturers that have flown over
6058
-	*
6059
-	* @return Array the aircraft list
6060
-	*
6061
-	*/
6057
+	 * Gets all aircraft manufacturers that have flown over
6058
+	 *
6059
+	 * @return Array the aircraft list
6060
+	 *
6061
+	 */
6062 6062
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6063 6063
 	{
6064 6064
 		global $globalDBdriver;
6065 6065
 		$filter_query = $this->getFilter($filters,true,true);
6066 6066
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6067 6067
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6068
-                $query_values = array();
6068
+				$query_values = array();
6069 6069
 		if ($year != '') {
6070 6070
 			if ($globalDBdriver == 'mysql') {
6071 6071
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6118,11 +6118,11 @@  discard block
 block discarded – undo
6118 6118
 	
6119 6119
 	
6120 6120
 	/**
6121
-	* Gets all aircraft registrations that have flown over
6122
-	*
6123
-	* @return Array the aircraft list
6124
-	*
6125
-	*/
6121
+	 * Gets all aircraft registrations that have flown over
6122
+	 *
6123
+	 * @return Array the aircraft list
6124
+	 *
6125
+	 */
6126 6126
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6127 6127
 	{
6128 6128
 		global $globalDBdriver;
@@ -6130,15 +6130,15 @@  discard block
 block discarded – undo
6130 6130
 		$filter_query = $this->getFilter($filters,true,true);
6131 6131
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6132 6132
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6133
-                if ($olderthanmonths > 0) {
6134
-            		if ($globalDBdriver == 'mysql') {
6133
+				if ($olderthanmonths > 0) {
6134
+					if ($globalDBdriver == 'mysql') {
6135 6135
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6136 6136
 			} else {
6137 6137
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6138 6138
 			}
6139 6139
 		}
6140
-                if ($sincedate != '') {
6141
-            		if ($globalDBdriver == 'mysql') {
6140
+				if ($sincedate != '') {
6141
+					if ($globalDBdriver == 'mysql') {
6142 6142
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6143 6143
 			} else {
6144 6144
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6203,11 +6203,11 @@  discard block
 block discarded – undo
6203 6203
 
6204 6204
 
6205 6205
 	/**
6206
-	* Gets all aircraft registrations that have flown over
6207
-	*
6208
-	* @return Array the aircraft list
6209
-	*
6210
-	*/
6206
+	 * Gets all aircraft registrations that have flown over
6207
+	 *
6208
+	 * @return Array the aircraft list
6209
+	 *
6210
+	 */
6211 6211
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6212 6212
 	{
6213 6213
 		global $globalDBdriver;
@@ -6215,15 +6215,15 @@  discard block
 block discarded – undo
6215 6215
 		$Image = new Image($this->db);
6216 6216
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6217 6217
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6218
-                if ($olderthanmonths > 0) {
6219
-            		if ($globalDBdriver == 'mysql') {
6218
+				if ($olderthanmonths > 0) {
6219
+					if ($globalDBdriver == 'mysql') {
6220 6220
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6221 6221
 			} else {
6222 6222
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6223 6223
 			}
6224 6224
 		}
6225
-                if ($sincedate != '') {
6226
-            		if ($globalDBdriver == 'mysql') {
6225
+				if ($sincedate != '') {
6226
+					if ($globalDBdriver == 'mysql') {
6227 6227
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6228 6228
 			} else {
6229 6229
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6232,7 +6232,7 @@  discard block
 block discarded – undo
6232 6232
 
6233 6233
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6234 6234
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6235
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6235
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6236 6236
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6237 6237
 		
6238 6238
 		$sth = $this->db->prepare($query);
@@ -6264,26 +6264,26 @@  discard block
 block discarded – undo
6264 6264
 	
6265 6265
 	
6266 6266
 	/**
6267
-	* Gets all departure airports of the airplanes that have flown over
6268
-	*
6269
-	* @return Array the airport list
6270
-	*
6271
-	*/
6267
+	 * Gets all departure airports of the airplanes that have flown over
6268
+	 *
6269
+	 * @return Array the airport list
6270
+	 *
6271
+	 */
6272 6272
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6273 6273
 	{
6274 6274
 		global $globalDBdriver;
6275 6275
 		$filter_query = $this->getFilter($filters,true,true);
6276 6276
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6277 6277
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6278
-                if ($olderthanmonths > 0) {
6279
-            		if ($globalDBdriver == 'mysql') {
6278
+				if ($olderthanmonths > 0) {
6279
+					if ($globalDBdriver == 'mysql') {
6280 6280
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6281 6281
 			} else {
6282 6282
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6283 6283
 			}
6284
-                }
6285
-                if ($sincedate != '') {
6286
-            		if ($globalDBdriver == 'mysql') {
6284
+				}
6285
+				if ($sincedate != '') {
6286
+					if ($globalDBdriver == 'mysql') {
6287 6287
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6288 6288
 			} else {
6289 6289
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6317,7 +6317,7 @@  discard block
 block discarded – undo
6317 6317
 				$query_values = array_merge($query_values,array(':day' => $day));
6318 6318
 			}
6319 6319
 		}
6320
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6320
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6321 6321
 				ORDER BY airport_departure_icao_count DESC";
6322 6322
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6323 6323
 
@@ -6340,35 +6340,35 @@  discard block
 block discarded – undo
6340 6340
 	}
6341 6341
 
6342 6342
 	/**
6343
-	* Gets all departure airports of the airplanes that have flown over
6344
-	*
6345
-	* @return Array the airport list
6346
-	*
6347
-	*/
6343
+	 * Gets all departure airports of the airplanes that have flown over
6344
+	 *
6345
+	 * @return Array the airport list
6346
+	 *
6347
+	 */
6348 6348
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6349 6349
 	{
6350 6350
 		global $globalDBdriver;
6351 6351
 		$filter_query = $this->getFilter($filters,true,true);
6352 6352
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6353 6353
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6354
-                if ($olderthanmonths > 0) {
6355
-            		if ($globalDBdriver == 'mysql') {
6354
+				if ($olderthanmonths > 0) {
6355
+					if ($globalDBdriver == 'mysql') {
6356 6356
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6357 6357
 			} else {
6358 6358
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6359 6359
 			}
6360
-                }
6361
-                if ($sincedate != '') {
6362
-            		if ($globalDBdriver == 'mysql') {
6360
+				}
6361
+				if ($sincedate != '') {
6362
+					if ($globalDBdriver == 'mysql') {
6363 6363
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6364 6364
 			} else {
6365 6365
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6366 6366
 			}
6367 6367
 		}
6368 6368
 
6369
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6370
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6371
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6369
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6370
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6371
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6372 6372
 				ORDER BY airport_departure_icao_count DESC";
6373 6373
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6374 6374
       
@@ -6393,26 +6393,26 @@  discard block
 block discarded – undo
6393 6393
 	}
6394 6394
 
6395 6395
 	/**
6396
-	* Gets all detected departure airports of the airplanes that have flown over
6397
-	*
6398
-	* @return Array the airport list
6399
-	*
6400
-	*/
6396
+	 * Gets all detected departure airports of the airplanes that have flown over
6397
+	 *
6398
+	 * @return Array the airport list
6399
+	 *
6400
+	 */
6401 6401
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6402 6402
 	{
6403 6403
 		global $globalDBdriver;
6404 6404
 		$filter_query = $this->getFilter($filters,true,true);
6405 6405
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6406 6406
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
6407
-                if ($olderthanmonths > 0) {
6408
-            		if ($globalDBdriver == 'mysql') {
6407
+				if ($olderthanmonths > 0) {
6408
+					if ($globalDBdriver == 'mysql') {
6409 6409
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6410 6410
 			} else {
6411 6411
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6412 6412
 			}
6413
-                }
6414
-                if ($sincedate != '') {
6415
-            		if ($globalDBdriver == 'mysql') {
6413
+				}
6414
+				if ($sincedate != '') {
6415
+					if ($globalDBdriver == 'mysql') {
6416 6416
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6417 6417
 			} else {
6418 6418
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6446,10 +6446,10 @@  discard block
 block discarded – undo
6446 6446
 				$query_values = array_merge($query_values,array(':day' => $day));
6447 6447
 			}
6448 6448
 		}
6449
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6449
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6450 6450
 				ORDER BY airport_departure_icao_count DESC";
6451 6451
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6452
-    		//echo $query;
6452
+			//echo $query;
6453 6453
 		$sth = $this->db->prepare($query);
6454 6454
 		$sth->execute($query_values);
6455 6455
       
@@ -6470,35 +6470,35 @@  discard block
 block discarded – undo
6470 6470
 	}
6471 6471
 	
6472 6472
 	/**
6473
-	* Gets all detected departure airports of the airplanes that have flown over
6474
-	*
6475
-	* @return Array the airport list
6476
-	*
6477
-	*/
6473
+	 * Gets all detected departure airports of the airplanes that have flown over
6474
+	 *
6475
+	 * @return Array the airport list
6476
+	 *
6477
+	 */
6478 6478
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6479 6479
 	{
6480 6480
 		global $globalDBdriver;
6481 6481
 		$filter_query = $this->getFilter($filters,true,true);
6482 6482
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6483 6483
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
6484
-                if ($olderthanmonths > 0) {
6485
-            		if ($globalDBdriver == 'mysql') {
6484
+				if ($olderthanmonths > 0) {
6485
+					if ($globalDBdriver == 'mysql') {
6486 6486
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6487 6487
 			} else {
6488 6488
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6489 6489
 			}
6490
-                }
6491
-                if ($sincedate != '') {
6492
-            		if ($globalDBdriver == 'mysql') {
6490
+				}
6491
+				if ($sincedate != '') {
6492
+					if ($globalDBdriver == 'mysql') {
6493 6493
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6494 6494
 			} else {
6495 6495
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6496 6496
 			}
6497 6497
 		}
6498 6498
 
6499
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6500
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6501
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6499
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6500
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6501
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6502 6502
 				ORDER BY airport_departure_icao_count DESC";
6503 6503
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6504 6504
       
@@ -6523,11 +6523,11 @@  discard block
 block discarded – undo
6523 6523
 	}	
6524 6524
 	
6525 6525
 	/**
6526
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6527
-	*
6528
-	* @return Array the airport list
6529
-	*
6530
-	*/
6526
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6527
+	 *
6528
+	 * @return Array the airport list
6529
+	 *
6530
+	 */
6531 6531
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6532 6532
 	{
6533 6533
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6561,11 +6561,11 @@  discard block
 block discarded – undo
6561 6561
 	
6562 6562
 	
6563 6563
 	/**
6564
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6565
-	*
6566
-	* @return Array the airport list
6567
-	*
6568
-	*/
6564
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6565
+	 *
6566
+	 * @return Array the airport list
6567
+	 *
6568
+	 */
6569 6569
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6570 6570
 	{
6571 6571
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6596,11 +6596,11 @@  discard block
 block discarded – undo
6596 6596
 	
6597 6597
 	
6598 6598
 	/**
6599
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6600
-	*
6601
-	* @return Array the airport list
6602
-	*
6603
-	*/
6599
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6600
+	 *
6601
+	 * @return Array the airport list
6602
+	 *
6603
+	 */
6604 6604
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6605 6605
 	{
6606 6606
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6633,11 +6633,11 @@  discard block
 block discarded – undo
6633 6633
 	
6634 6634
 	
6635 6635
 	/**
6636
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6637
-	*
6638
-	* @return Array the airport list
6639
-	*
6640
-	*/
6636
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6637
+	 *
6638
+	 * @return Array the airport list
6639
+	 *
6640
+	 */
6641 6641
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6642 6642
 	{
6643 6643
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6667,11 +6667,11 @@  discard block
 block discarded – undo
6667 6667
 	
6668 6668
 	
6669 6669
 	/**
6670
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6671
-	*
6672
-	* @return Array the airport list
6673
-	*
6674
-	*/
6670
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6671
+	 *
6672
+	 * @return Array the airport list
6673
+	 *
6674
+	 */
6675 6675
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6676 6676
 	{
6677 6677
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6704,11 +6704,11 @@  discard block
 block discarded – undo
6704 6704
 	
6705 6705
 	
6706 6706
 	/**
6707
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6708
-	*
6709
-	* @return Array the airport list
6710
-	*
6711
-	*/
6707
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6708
+	 *
6709
+	 * @return Array the airport list
6710
+	 *
6711
+	 */
6712 6712
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6713 6713
 	{
6714 6714
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6738,11 +6738,11 @@  discard block
 block discarded – undo
6738 6738
 	
6739 6739
 	
6740 6740
 	/**
6741
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6742
-	*
6743
-	* @return Array the airport list
6744
-	*
6745
-	*/
6741
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6742
+	 *
6743
+	 * @return Array the airport list
6744
+	 *
6745
+	 */
6746 6746
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6747 6747
 	{
6748 6748
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6775,11 +6775,11 @@  discard block
 block discarded – undo
6775 6775
 	
6776 6776
 	
6777 6777
 	/**
6778
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6779
-	*
6780
-	* @return Array the airport list
6781
-	*
6782
-	*/
6778
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6779
+	 *
6780
+	 * @return Array the airport list
6781
+	 *
6782
+	 */
6783 6783
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6784 6784
 	{
6785 6785
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6810,11 +6810,11 @@  discard block
 block discarded – undo
6810 6810
 	
6811 6811
 	
6812 6812
 	/**
6813
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6814
-	*
6815
-	* @return Array the airport list
6816
-	*
6817
-	*/
6813
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6814
+	 *
6815
+	 * @return Array the airport list
6816
+	 *
6817
+	 */
6818 6818
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6819 6819
 	{
6820 6820
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6847,11 +6847,11 @@  discard block
 block discarded – undo
6847 6847
 	
6848 6848
 	
6849 6849
 	/**
6850
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6851
-	*
6852
-	* @return Array the airport list
6853
-	*
6854
-	*/
6850
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6851
+	 *
6852
+	 * @return Array the airport list
6853
+	 *
6854
+	 */
6855 6855
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6856 6856
 	{
6857 6857
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6881,11 +6881,11 @@  discard block
 block discarded – undo
6881 6881
 	
6882 6882
 	
6883 6883
 	/**
6884
-	* Gets all departure airports of the airplanes that have flown over based on a date
6885
-	*
6886
-	* @return Array the airport list
6887
-	*
6888
-	*/
6884
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6885
+	 *
6886
+	 * @return Array the airport list
6887
+	 *
6888
+	 */
6889 6889
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6890 6890
 	{
6891 6891
 		global $globalTimezone, $globalDBdriver;
@@ -6931,11 +6931,11 @@  discard block
 block discarded – undo
6931 6931
 	
6932 6932
 	
6933 6933
 	/**
6934
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6935
-	*
6936
-	* @return Array the airport list
6937
-	*
6938
-	*/
6934
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6935
+	 *
6936
+	 * @return Array the airport list
6937
+	 *
6938
+	 */
6939 6939
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6940 6940
 	{
6941 6941
 		global $globalTimezone, $globalDBdriver;
@@ -6978,11 +6978,11 @@  discard block
 block discarded – undo
6978 6978
 	
6979 6979
 	
6980 6980
 	/**
6981
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6982
-	*
6983
-	* @return Array the airport list
6984
-	*
6985
-	*/
6981
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6982
+	 *
6983
+	 * @return Array the airport list
6984
+	 *
6985
+	 */
6986 6986
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6987 6987
 	{
6988 6988
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7014,11 +7014,11 @@  discard block
 block discarded – undo
7014 7014
 	}
7015 7015
 	
7016 7016
 	/**
7017
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7018
-	*
7019
-	* @return Array the airport list
7020
-	*
7021
-	*/
7017
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7018
+	 *
7019
+	 * @return Array the airport list
7020
+	 *
7021
+	 */
7022 7022
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7023 7023
 	{
7024 7024
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7050,11 +7050,11 @@  discard block
 block discarded – undo
7050 7050
 	}
7051 7051
 	
7052 7052
 	/**
7053
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7054
-	*
7055
-	* @return Array the airport list
7056
-	*
7057
-	*/
7053
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7054
+	 *
7055
+	 * @return Array the airport list
7056
+	 *
7057
+	 */
7058 7058
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7059 7059
 	{
7060 7060
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7087,11 +7087,11 @@  discard block
 block discarded – undo
7087 7087
 	
7088 7088
 	
7089 7089
 	/**
7090
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7091
-	*
7092
-	* @return Array the airport list
7093
-	*
7094
-	*/
7090
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7091
+	 *
7092
+	 * @return Array the airport list
7093
+	 *
7094
+	 */
7095 7095
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7096 7096
 	{
7097 7097
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7120,11 +7120,11 @@  discard block
 block discarded – undo
7120 7120
 	}
7121 7121
 	
7122 7122
 	/**
7123
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7124
-	*
7125
-	* @return Array the airport list
7126
-	*
7127
-	*/
7123
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7124
+	 *
7125
+	 * @return Array the airport list
7126
+	 *
7127
+	 */
7128 7128
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7129 7129
 	{
7130 7130
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7140,11 +7140,11 @@  discard block
 block discarded – undo
7140 7140
 	}
7141 7141
 	
7142 7142
 	/**
7143
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7144
-	*
7145
-	* @return Array the airport list
7146
-	*
7147
-	*/
7143
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7144
+	 *
7145
+	 * @return Array the airport list
7146
+	 *
7147
+	 */
7148 7148
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7149 7149
 	{
7150 7150
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7162,11 +7162,11 @@  discard block
 block discarded – undo
7162 7162
 	
7163 7163
 	
7164 7164
 	/**
7165
-	* Gets all departure airports of the airplanes that have flown over based on a country
7166
-	*
7167
-	* @return Array the airport list
7168
-	*
7169
-	*/
7165
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7166
+	 *
7167
+	 * @return Array the airport list
7168
+	 *
7169
+	 */
7170 7170
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7171 7171
 	{
7172 7172
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7200,11 +7200,11 @@  discard block
 block discarded – undo
7200 7200
 
7201 7201
 
7202 7202
 	/**
7203
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7204
-	*
7205
-	* @return Array the airport list
7206
-	*
7207
-	*/
7203
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7204
+	 *
7205
+	 * @return Array the airport list
7206
+	 *
7207
+	 */
7208 7208
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7209 7209
 	{
7210 7210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7234,31 +7234,31 @@  discard block
 block discarded – undo
7234 7234
 	
7235 7235
 
7236 7236
 	/**
7237
-	* Gets all arrival airports of the airplanes that have flown over
7238
-	*
7239
-	* @param Boolean $limit Limit result to 10 or not
7240
-	* @param Integer $olderthanmonths Only show result older than x months
7241
-	* @param String $sincedate Only show result since x date
7242
-	* @param Boolean $icaoaskey Show result by ICAO
7243
-	* @param Array $filters Filter used here
7244
-	* @return Array the airport list
7245
-	*
7246
-	*/
7237
+	 * Gets all arrival airports of the airplanes that have flown over
7238
+	 *
7239
+	 * @param Boolean $limit Limit result to 10 or not
7240
+	 * @param Integer $olderthanmonths Only show result older than x months
7241
+	 * @param String $sincedate Only show result since x date
7242
+	 * @param Boolean $icaoaskey Show result by ICAO
7243
+	 * @param Array $filters Filter used here
7244
+	 * @return Array the airport list
7245
+	 *
7246
+	 */
7247 7247
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7248 7248
 	{
7249 7249
 		global $globalDBdriver;
7250 7250
 		$filter_query = $this->getFilter($filters,true,true);
7251 7251
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7252 7252
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7253
-                if ($olderthanmonths > 0) {
7254
-            		if ($globalDBdriver == 'mysql') {
7253
+				if ($olderthanmonths > 0) {
7254
+					if ($globalDBdriver == 'mysql') {
7255 7255
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7256 7256
 			} else {
7257 7257
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7258 7258
 			}
7259 7259
 		}
7260
-                if ($sincedate != '') {
7261
-            		if ($globalDBdriver == 'mysql') {
7260
+				if ($sincedate != '') {
7261
+					if ($globalDBdriver == 'mysql') {
7262 7262
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7263 7263
 			} else {
7264 7264
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7292,7 +7292,7 @@  discard block
 block discarded – undo
7292 7292
 				$query_values = array_merge($query_values,array(':day' => $day));
7293 7293
 			}
7294 7294
 		}
7295
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7295
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7296 7296
 					ORDER BY airport_arrival_icao_count DESC";
7297 7297
 		if ($limit) $query .= " LIMIT 10";
7298 7298
       
@@ -7321,35 +7321,35 @@  discard block
 block discarded – undo
7321 7321
 	}
7322 7322
 
7323 7323
 	/**
7324
-	* Gets all arrival airports of the airplanes that have flown over
7325
-	*
7326
-	* @return Array the airport list
7327
-	*
7328
-	*/
7324
+	 * Gets all arrival airports of the airplanes that have flown over
7325
+	 *
7326
+	 * @return Array the airport list
7327
+	 *
7328
+	 */
7329 7329
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7330 7330
 	{
7331 7331
 		global $globalDBdriver;
7332 7332
 		$filter_query = $this->getFilter($filters,true,true);
7333 7333
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7334 7334
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7335
-                if ($olderthanmonths > 0) {
7336
-            		if ($globalDBdriver == 'mysql') {
7335
+				if ($olderthanmonths > 0) {
7336
+					if ($globalDBdriver == 'mysql') {
7337 7337
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7338 7338
 			} else {
7339 7339
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7340 7340
 			}
7341 7341
 		}
7342
-                if ($sincedate != '') {
7343
-            		if ($globalDBdriver == 'mysql') {
7342
+				if ($sincedate != '') {
7343
+					if ($globalDBdriver == 'mysql') {
7344 7344
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7345 7345
 			} else {
7346 7346
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7347 7347
 			}
7348 7348
 		}
7349 7349
 
7350
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7351
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7352
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7350
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7351
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7352
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7353 7353
 					ORDER BY airport_arrival_icao_count DESC";
7354 7354
 		if ($limit) $query .= " LIMIT 10";
7355 7355
       
@@ -7380,26 +7380,26 @@  discard block
 block discarded – undo
7380 7380
 
7381 7381
 
7382 7382
 	/**
7383
-	* Gets all detected arrival airports of the airplanes that have flown over
7384
-	*
7385
-	* @return Array the airport list
7386
-	*
7387
-	*/
7383
+	 * Gets all detected arrival airports of the airplanes that have flown over
7384
+	 *
7385
+	 * @return Array the airport list
7386
+	 *
7387
+	 */
7388 7388
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7389 7389
 	{
7390 7390
 		global $globalDBdriver;
7391 7391
 		$filter_query = $this->getFilter($filters,true,true);
7392 7392
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7393 7393
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
7394
-                if ($olderthanmonths > 0) {
7395
-            		if ($globalDBdriver == 'mysql') {
7394
+				if ($olderthanmonths > 0) {
7395
+					if ($globalDBdriver == 'mysql') {
7396 7396
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7397 7397
 			} else {
7398 7398
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7399 7399
 			}
7400 7400
 		}
7401
-                if ($sincedate != '') {
7402
-            		if ($globalDBdriver == 'mysql') {
7401
+				if ($sincedate != '') {
7402
+					if ($globalDBdriver == 'mysql') {
7403 7403
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7404 7404
 			} else {
7405 7405
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7433,7 +7433,7 @@  discard block
 block discarded – undo
7433 7433
 				$query_values = array_merge($query_values,array(':day' => $day));
7434 7434
 			}
7435 7435
 		}
7436
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7436
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7437 7437
 					ORDER BY airport_arrival_icao_count DESC";
7438 7438
 		if ($limit) $query .= " LIMIT 10";
7439 7439
       
@@ -7461,35 +7461,35 @@  discard block
 block discarded – undo
7461 7461
 	}
7462 7462
 	
7463 7463
 	/**
7464
-	* Gets all detected arrival airports of the airplanes that have flown over
7465
-	*
7466
-	* @return Array the airport list
7467
-	*
7468
-	*/
7464
+	 * Gets all detected arrival airports of the airplanes that have flown over
7465
+	 *
7466
+	 * @return Array the airport list
7467
+	 *
7468
+	 */
7469 7469
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7470 7470
 	{
7471 7471
 		global $globalDBdriver;
7472 7472
 		$filter_query = $this->getFilter($filters,true,true);
7473 7473
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7474 7474
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
7475
-                if ($olderthanmonths > 0) {
7476
-            		if ($globalDBdriver == 'mysql') {
7475
+				if ($olderthanmonths > 0) {
7476
+					if ($globalDBdriver == 'mysql') {
7477 7477
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7478 7478
 			} else {
7479 7479
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7480 7480
 			}
7481 7481
 		}
7482
-                if ($sincedate != '') {
7483
-            		if ($globalDBdriver == 'mysql') {
7482
+				if ($sincedate != '') {
7483
+					if ($globalDBdriver == 'mysql') {
7484 7484
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7485 7485
 			} else {
7486 7486
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7487 7487
 			}
7488 7488
 		}
7489 7489
 
7490
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7491
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7492
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7490
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7491
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7492
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7493 7493
 					ORDER BY airport_arrival_icao_count DESC";
7494 7494
 		if ($limit) $query .= " LIMIT 10";
7495 7495
       
@@ -7519,11 +7519,11 @@  discard block
 block discarded – undo
7519 7519
 	}	
7520 7520
 	
7521 7521
 	/**
7522
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7523
-	*
7524
-	* @return Array the airport list
7525
-	*
7526
-	*/
7522
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7523
+	 *
7524
+	 * @return Array the airport list
7525
+	 *
7526
+	 */
7527 7527
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7528 7528
 	{
7529 7529
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7555,11 +7555,11 @@  discard block
 block discarded – undo
7555 7555
 	
7556 7556
 	
7557 7557
 	/**
7558
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7559
-	*
7560
-	* @return Array the airport list
7561
-	*
7562
-	*/
7558
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7559
+	 *
7560
+	 * @return Array the airport list
7561
+	 *
7562
+	 */
7563 7563
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7564 7564
 	{
7565 7565
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7590,11 +7590,11 @@  discard block
 block discarded – undo
7590 7590
 	
7591 7591
 	
7592 7592
 	/**
7593
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7594
-	*
7595
-	* @return Array the airport list
7596
-	*
7597
-	*/
7593
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7594
+	 *
7595
+	 * @return Array the airport list
7596
+	 *
7597
+	 */
7598 7598
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7599 7599
 	{
7600 7600
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7628,11 +7628,11 @@  discard block
 block discarded – undo
7628 7628
 	
7629 7629
 	
7630 7630
 	/**
7631
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7632
-	*
7633
-	* @return Array the airport list
7634
-	*
7635
-	*/
7631
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7632
+	 *
7633
+	 * @return Array the airport list
7634
+	 *
7635
+	 */
7636 7636
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7637 7637
 	{
7638 7638
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7662,11 +7662,11 @@  discard block
 block discarded – undo
7662 7662
 	
7663 7663
 	
7664 7664
 	/**
7665
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7666
-	*
7667
-	* @return Array the airport list
7668
-	*
7669
-	*/
7665
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7666
+	 *
7667
+	 * @return Array the airport list
7668
+	 *
7669
+	 */
7670 7670
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7671 7671
 	{
7672 7672
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7700,11 +7700,11 @@  discard block
 block discarded – undo
7700 7700
 	
7701 7701
 	
7702 7702
 	/**
7703
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7704
-	*
7705
-	* @return Array the airport list
7706
-	*
7707
-	*/
7703
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7704
+	 *
7705
+	 * @return Array the airport list
7706
+	 *
7707
+	 */
7708 7708
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7709 7709
 	{
7710 7710
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7735,11 +7735,11 @@  discard block
 block discarded – undo
7735 7735
 	
7736 7736
 	
7737 7737
 	/**
7738
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
7739
-	*
7740
-	* @return Array the airport list
7741
-	*
7742
-	*/
7738
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
7739
+	 *
7740
+	 * @return Array the airport list
7741
+	 *
7742
+	 */
7743 7743
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7744 7744
 	{
7745 7745
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7772,11 +7772,11 @@  discard block
 block discarded – undo
7772 7772
 	
7773 7773
 	
7774 7774
 	/**
7775
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7776
-	*
7777
-	* @return Array the airport list
7778
-	*
7779
-	*/
7775
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7776
+	 *
7777
+	 * @return Array the airport list
7778
+	 *
7779
+	 */
7780 7780
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7781 7781
 	{
7782 7782
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7806,11 +7806,11 @@  discard block
 block discarded – undo
7806 7806
 	
7807 7807
 	
7808 7808
 	/**
7809
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7810
-	*
7811
-	* @return Array the airport list
7812
-	*
7813
-	*/
7809
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7810
+	 *
7811
+	 * @return Array the airport list
7812
+	 *
7813
+	 */
7814 7814
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7815 7815
 	{
7816 7816
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7844,11 +7844,11 @@  discard block
 block discarded – undo
7844 7844
 	
7845 7845
 	
7846 7846
 	/**
7847
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7848
-	*
7849
-	* @return Array the airport list
7850
-	*
7851
-	*/
7847
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7848
+	 *
7849
+	 * @return Array the airport list
7850
+	 *
7851
+	 */
7852 7852
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7853 7853
 	{
7854 7854
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7879,11 +7879,11 @@  discard block
 block discarded – undo
7879 7879
 	
7880 7880
 	
7881 7881
 	/**
7882
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7883
-	*
7884
-	* @return Array the airport list
7885
-	*
7886
-	*/
7882
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7883
+	 *
7884
+	 * @return Array the airport list
7885
+	 *
7886
+	 */
7887 7887
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7888 7888
 	{
7889 7889
 		global $globalTimezone, $globalDBdriver;
@@ -7929,11 +7929,11 @@  discard block
 block discarded – undo
7929 7929
 	
7930 7930
 	
7931 7931
 	/**
7932
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7933
-	*
7934
-	* @return Array the airport list
7935
-	*
7936
-	*/
7932
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7933
+	 *
7934
+	 * @return Array the airport list
7935
+	 *
7936
+	 */
7937 7937
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7938 7938
 	{
7939 7939
 		global $globalTimezone, $globalDBdriver;
@@ -7976,11 +7976,11 @@  discard block
 block discarded – undo
7976 7976
 	
7977 7977
 	
7978 7978
 	/**
7979
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7980
-	*
7981
-	* @return Array the airport list
7982
-	*
7983
-	*/
7979
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7980
+	 *
7981
+	 * @return Array the airport list
7982
+	 *
7983
+	 */
7984 7984
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7985 7985
 	{
7986 7986
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8012,11 +8012,11 @@  discard block
 block discarded – undo
8012 8012
 	}
8013 8013
 	
8014 8014
 	/**
8015
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8016
-	*
8017
-	* @return Array the airport list
8018
-	*
8019
-	*/
8015
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8016
+	 *
8017
+	 * @return Array the airport list
8018
+	 *
8019
+	 */
8020 8020
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8021 8021
 	{
8022 8022
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8047,11 +8047,11 @@  discard block
 block discarded – undo
8047 8047
 	}
8048 8048
 
8049 8049
 	/**
8050
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8051
-	*
8052
-	* @return Array the airport list
8053
-	*
8054
-	*/
8050
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8051
+	 *
8052
+	 * @return Array the airport list
8053
+	 *
8054
+	 */
8055 8055
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8056 8056
 	{
8057 8057
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8082,11 +8082,11 @@  discard block
 block discarded – undo
8082 8082
 	}
8083 8083
 	
8084 8084
 	/**
8085
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8086
-	*
8087
-	* @return Array the airport list
8088
-	*
8089
-	*/
8085
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8086
+	 *
8087
+	 * @return Array the airport list
8088
+	 *
8089
+	 */
8090 8090
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8091 8091
 	{
8092 8092
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8115,11 +8115,11 @@  discard block
 block discarded – undo
8115 8115
 	}
8116 8116
 	
8117 8117
 	/**
8118
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8119
-	*
8120
-	* @return Array the airport list
8121
-	*
8122
-	*/
8118
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8119
+	 *
8120
+	 * @return Array the airport list
8121
+	 *
8122
+	 */
8123 8123
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8124 8124
 	{
8125 8125
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8135,11 +8135,11 @@  discard block
 block discarded – undo
8135 8135
 	}
8136 8136
 	
8137 8137
 	/**
8138
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8139
-	*
8140
-	* @return Array the airport list
8141
-	*
8142
-	*/
8138
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8139
+	 *
8140
+	 * @return Array the airport list
8141
+	 *
8142
+	 */
8143 8143
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8144 8144
 	{
8145 8145
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8157,11 +8157,11 @@  discard block
 block discarded – undo
8157 8157
 	
8158 8158
 	
8159 8159
 	/**
8160
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8161
-	*
8162
-	* @return Array the airport list
8163
-	*
8164
-	*/
8160
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8161
+	 *
8162
+	 * @return Array the airport list
8163
+	 *
8164
+	 */
8165 8165
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8166 8166
 	{
8167 8167
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8194,11 +8194,11 @@  discard block
 block discarded – undo
8194 8194
 	
8195 8195
 	
8196 8196
 	/**
8197
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8198
-	*
8199
-	* @return Array the airport list
8200
-	*
8201
-	*/
8197
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8198
+	 *
8199
+	 * @return Array the airport list
8200
+	 *
8201
+	 */
8202 8202
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8203 8203
 	{
8204 8204
 		global $globalDBdriver;
@@ -8230,11 +8230,11 @@  discard block
 block discarded – undo
8230 8230
 
8231 8231
 
8232 8232
 	/**
8233
-	* Counts all airport departure countries
8234
-	*
8235
-	* @return Array the airport departure list
8236
-	*
8237
-	*/
8233
+	 * Counts all airport departure countries
8234
+	 *
8235
+	 * @return Array the airport departure list
8236
+	 *
8237
+	 */
8238 8238
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8239 8239
 	{
8240 8240
 		global $globalDBdriver;
@@ -8293,11 +8293,11 @@  discard block
 block discarded – undo
8293 8293
 	
8294 8294
 	
8295 8295
 	/**
8296
-	* Counts all airport arrival countries
8297
-	*
8298
-	* @return Array the airport arrival list
8299
-	*
8300
-	*/
8296
+	 * Counts all airport arrival countries
8297
+	 *
8298
+	 * @return Array the airport arrival list
8299
+	 *
8300
+	 */
8301 8301
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8302 8302
 	{
8303 8303
 		global $globalDBdriver;
@@ -8359,11 +8359,11 @@  discard block
 block discarded – undo
8359 8359
 
8360 8360
 
8361 8361
 	/**
8362
-	* Gets all route combinations
8363
-	*
8364
-	* @return Array the route list
8365
-	*
8366
-	*/
8362
+	 * Gets all route combinations
8363
+	 *
8364
+	 * @return Array the route list
8365
+	 *
8366
+	 */
8367 8367
 	public function countAllRoutes($filters = array())
8368 8368
 	{
8369 8369
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8402,11 +8402,11 @@  discard block
 block discarded – undo
8402 8402
 	
8403 8403
 	
8404 8404
 	/**
8405
-	* Gets all route combinations based on an aircraft
8406
-	*
8407
-	* @return Array the route list
8408
-	*
8409
-	*/
8405
+	 * Gets all route combinations based on an aircraft
8406
+	 *
8407
+	 * @return Array the route list
8408
+	 *
8409
+	 */
8410 8410
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8411 8411
 	{
8412 8412
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8442,11 +8442,11 @@  discard block
 block discarded – undo
8442 8442
 	
8443 8443
 	
8444 8444
 	/**
8445
-	* Gets all route combinations based on an aircraft registration
8446
-	*
8447
-	* @return Array the route list
8448
-	*
8449
-	*/
8445
+	 * Gets all route combinations based on an aircraft registration
8446
+	 *
8447
+	 * @return Array the route list
8448
+	 *
8449
+	 */
8450 8450
 	public function countAllRoutesByRegistration($registration, $filters = array())
8451 8451
 	{
8452 8452
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8484,11 +8484,11 @@  discard block
 block discarded – undo
8484 8484
 	
8485 8485
 	
8486 8486
 	/**
8487
-	* Gets all route combinations based on an airline
8488
-	*
8489
-	* @return Array the route list
8490
-	*
8491
-	*/
8487
+	 * Gets all route combinations based on an airline
8488
+	 *
8489
+	 * @return Array the route list
8490
+	 *
8491
+	 */
8492 8492
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8493 8493
 	{
8494 8494
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8526,11 +8526,11 @@  discard block
 block discarded – undo
8526 8526
 	
8527 8527
 	
8528 8528
 	/**
8529
-	* Gets all route combinations based on an airport
8530
-	*
8531
-	* @return Array the route list
8532
-	*
8533
-	*/
8529
+	 * Gets all route combinations based on an airport
8530
+	 *
8531
+	 * @return Array the route list
8532
+	 *
8533
+	 */
8534 8534
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8535 8535
 	{
8536 8536
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8567,11 +8567,11 @@  discard block
 block discarded – undo
8567 8567
 	
8568 8568
 	
8569 8569
 	/**
8570
-	* Gets all route combinations based on an country
8571
-	*
8572
-	* @return Array the route list
8573
-	*
8574
-	*/
8570
+	 * Gets all route combinations based on an country
8571
+	 *
8572
+	 * @return Array the route list
8573
+	 *
8574
+	 */
8575 8575
 	public function countAllRoutesByCountry($country, $filters = array())
8576 8576
 	{
8577 8577
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8607,11 +8607,11 @@  discard block
 block discarded – undo
8607 8607
 
8608 8608
 
8609 8609
 	/**
8610
-	* Gets all route combinations based on an date
8611
-	*
8612
-	* @return Array the route list
8613
-	*
8614
-	*/
8610
+	 * Gets all route combinations based on an date
8611
+	 *
8612
+	 * @return Array the route list
8613
+	 *
8614
+	 */
8615 8615
 	public function countAllRoutesByDate($date, $filters = array())
8616 8616
 	{
8617 8617
 		global $globalTimezone, $globalDBdriver;
@@ -8661,11 +8661,11 @@  discard block
 block discarded – undo
8661 8661
 	
8662 8662
 	
8663 8663
 	/**
8664
-	* Gets all route combinations based on an ident/callsign
8665
-	*
8666
-	* @return Array the route list
8667
-	*
8668
-	*/
8664
+	 * Gets all route combinations based on an ident/callsign
8665
+	 *
8666
+	 * @return Array the route list
8667
+	 *
8668
+	 */
8669 8669
 	public function countAllRoutesByIdent($ident, $filters = array())
8670 8670
 	{
8671 8671
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8701,11 +8701,11 @@  discard block
 block discarded – undo
8701 8701
 	}
8702 8702
 	
8703 8703
 	/**
8704
-	* Gets all route combinations based on an owner
8705
-	*
8706
-	* @return Array the route list
8707
-	*
8708
-	*/
8704
+	 * Gets all route combinations based on an owner
8705
+	 *
8706
+	 * @return Array the route list
8707
+	 *
8708
+	 */
8709 8709
 	public function countAllRoutesByOwner($owner,$filters = array())
8710 8710
 	{
8711 8711
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8741,11 +8741,11 @@  discard block
 block discarded – undo
8741 8741
 	}
8742 8742
 	
8743 8743
 	/**
8744
-	* Gets all route combinations based on a pilot
8745
-	*
8746
-	* @return Array the route list
8747
-	*
8748
-	*/
8744
+	 * Gets all route combinations based on a pilot
8745
+	 *
8746
+	 * @return Array the route list
8747
+	 *
8748
+	 */
8749 8749
 	public function countAllRoutesByPilot($pilot,$filters = array())
8750 8750
 	{
8751 8751
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8782,11 +8782,11 @@  discard block
 block discarded – undo
8782 8782
 	
8783 8783
 	
8784 8784
 	/**
8785
-	* Gets all route combinations based on an manufacturer
8786
-	*
8787
-	* @return Array the route list
8788
-	*
8789
-	*/
8785
+	 * Gets all route combinations based on an manufacturer
8786
+	 *
8787
+	 * @return Array the route list
8788
+	 *
8789
+	 */
8790 8790
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8791 8791
 	{
8792 8792
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8824,11 +8824,11 @@  discard block
 block discarded – undo
8824 8824
 	
8825 8825
 	
8826 8826
 	/**
8827
-	* Gets all route combinations with waypoints
8828
-	*
8829
-	* @return Array the route list
8830
-	*
8831
-	*/
8827
+	 * Gets all route combinations with waypoints
8828
+	 *
8829
+	 * @return Array the route list
8830
+	 *
8831
+	 */
8832 8832
 	public function countAllRoutesWithWaypoints($filters = array())
8833 8833
 	{
8834 8834
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8865,11 +8865,11 @@  discard block
 block discarded – undo
8865 8865
 	}
8866 8866
 	
8867 8867
 	/**
8868
-	* Gets all callsigns that have flown over
8869
-	*
8870
-	* @return Array the callsign list
8871
-	*
8872
-	*/
8868
+	 * Gets all callsigns that have flown over
8869
+	 *
8870
+	 * @return Array the callsign list
8871
+	 *
8872
+	 */
8873 8873
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8874 8874
 	{
8875 8875
 		global $globalDBdriver;
@@ -8935,11 +8935,11 @@  discard block
 block discarded – undo
8935 8935
 	}
8936 8936
 
8937 8937
 	/**
8938
-	* Gets all callsigns that have flown over
8939
-	*
8940
-	* @return Array the callsign list
8941
-	*
8942
-	*/
8938
+	 * Gets all callsigns that have flown over
8939
+	 *
8940
+	 * @return Array the callsign list
8941
+	 *
8942
+	 */
8943 8943
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8944 8944
 	{
8945 8945
 		global $globalDBdriver;
@@ -8980,11 +8980,11 @@  discard block
 block discarded – undo
8980 8980
 
8981 8981
 
8982 8982
 	/**
8983
-	* Counts all dates
8984
-	*
8985
-	* @return Array the date list
8986
-	*
8987
-	*/
8983
+	 * Counts all dates
8984
+	 *
8985
+	 * @return Array the date list
8986
+	 *
8987
+	 */
8988 8988
 	public function countAllDates($filters = array())
8989 8989
 	{
8990 8990
 		global $globalTimezone, $globalDBdriver;
@@ -9029,11 +9029,11 @@  discard block
 block discarded – undo
9029 9029
 	}
9030 9030
 	
9031 9031
 	/**
9032
-	* Counts all dates
9033
-	*
9034
-	* @return Array the date list
9035
-	*
9036
-	*/
9032
+	 * Counts all dates
9033
+	 *
9034
+	 * @return Array the date list
9035
+	 *
9036
+	 */
9037 9037
 	public function countAllDatesByAirlines($filters = array())
9038 9038
 	{
9039 9039
 		global $globalTimezone, $globalDBdriver;
@@ -9078,11 +9078,11 @@  discard block
 block discarded – undo
9078 9078
 	}	
9079 9079
 	
9080 9080
 	/**
9081
-	* Counts all dates during the last 7 days
9082
-	*
9083
-	* @return Array the date list
9084
-	*
9085
-	*/
9081
+	 * Counts all dates during the last 7 days
9082
+	 *
9083
+	 * @return Array the date list
9084
+	 *
9085
+	 */
9086 9086
 	public function countAllDatesLast7Days($filters = array())
9087 9087
 	{
9088 9088
 		global $globalTimezone, $globalDBdriver;
@@ -9104,7 +9104,7 @@  discard block
 block discarded – undo
9104 9104
 			$query .= " GROUP BY date_name 
9105 9105
 								ORDER BY date_name ASC";
9106 9106
 			$query_data = array(':offset' => $offset);
9107
-    		}
9107
+			}
9108 9108
 		
9109 9109
 		$sth = $this->db->prepare($query);
9110 9110
 		$sth->execute($query_data);
@@ -9124,11 +9124,11 @@  discard block
 block discarded – undo
9124 9124
 	}
9125 9125
 
9126 9126
 	/**
9127
-	* Counts all dates during the last month
9128
-	*
9129
-	* @return Array the date list
9130
-	*
9131
-	*/
9127
+	 * Counts all dates during the last month
9128
+	 *
9129
+	 * @return Array the date list
9130
+	 *
9131
+	 */
9132 9132
 	public function countAllDatesLastMonth($filters = array())
9133 9133
 	{
9134 9134
 		global $globalTimezone, $globalDBdriver;
@@ -9150,7 +9150,7 @@  discard block
 block discarded – undo
9150 9150
 			$query .= " GROUP BY date_name 
9151 9151
 								ORDER BY date_name ASC";
9152 9152
 			$query_data = array(':offset' => $offset);
9153
-    		}
9153
+			}
9154 9154
 		
9155 9155
 		$sth = $this->db->prepare($query);
9156 9156
 		$sth->execute($query_data);
@@ -9171,11 +9171,11 @@  discard block
 block discarded – undo
9171 9171
 
9172 9172
 
9173 9173
 	/**
9174
-	* Counts all dates during the last month
9175
-	*
9176
-	* @return Array the date list
9177
-	*
9178
-	*/
9174
+	 * Counts all dates during the last month
9175
+	 *
9176
+	 * @return Array the date list
9177
+	 *
9178
+	 */
9179 9179
 	public function countAllDatesLastMonthByAirlines($filters = array())
9180 9180
 	{
9181 9181
 		global $globalTimezone, $globalDBdriver;
@@ -9198,7 +9198,7 @@  discard block
 block discarded – undo
9198 9198
 								GROUP BY spotter_output.airline_icao, date_name 
9199 9199
 								ORDER BY date_name ASC";
9200 9200
 			$query_data = array(':offset' => $offset);
9201
-    		}
9201
+			}
9202 9202
 		
9203 9203
 		$sth = $this->db->prepare($query);
9204 9204
 		$sth->execute($query_data);
@@ -9220,11 +9220,11 @@  discard block
 block discarded – undo
9220 9220
 	
9221 9221
 
9222 9222
 	/**
9223
-	* Counts all month
9224
-	*
9225
-	* @return Array the month list
9226
-	*
9227
-	*/
9223
+	 * Counts all month
9224
+	 *
9225
+	 * @return Array the month list
9226
+	 *
9227
+	 */
9228 9228
 	public function countAllMonths($filters = array())
9229 9229
 	{
9230 9230
 		global $globalTimezone, $globalDBdriver;
@@ -9266,11 +9266,11 @@  discard block
 block discarded – undo
9266 9266
 	}
9267 9267
 
9268 9268
 	/**
9269
-	* Counts all month
9270
-	*
9271
-	* @return Array the month list
9272
-	*
9273
-	*/
9269
+	 * Counts all month
9270
+	 *
9271
+	 * @return Array the month list
9272
+	 *
9273
+	 */
9274 9274
 	public function countAllMonthsByAirlines($filters = array())
9275 9275
 	{
9276 9276
 		global $globalTimezone, $globalDBdriver;
@@ -9315,11 +9315,11 @@  discard block
 block discarded – undo
9315 9315
 	}
9316 9316
 
9317 9317
 	/**
9318
-	* Counts all military month
9319
-	*
9320
-	* @return Array the month list
9321
-	*
9322
-	*/
9318
+	 * Counts all military month
9319
+	 *
9320
+	 * @return Array the month list
9321
+	 *
9322
+	 */
9323 9323
 	public function countAllMilitaryMonths($filters = array())
9324 9324
 	{
9325 9325
 		global $globalTimezone, $globalDBdriver;
@@ -9360,11 +9360,11 @@  discard block
 block discarded – undo
9360 9360
 	}
9361 9361
 	
9362 9362
 	/**
9363
-	* Counts all month owners
9364
-	*
9365
-	* @return Array the month list
9366
-	*
9367
-	*/
9363
+	 * Counts all month owners
9364
+	 *
9365
+	 * @return Array the month list
9366
+	 *
9367
+	 */
9368 9368
 	public function countAllMonthsOwners($filters = array())
9369 9369
 	{
9370 9370
 		global $globalTimezone, $globalDBdriver;
@@ -9406,11 +9406,11 @@  discard block
 block discarded – undo
9406 9406
 	}
9407 9407
 	
9408 9408
 	/**
9409
-	* Counts all month owners
9410
-	*
9411
-	* @return Array the month list
9412
-	*
9413
-	*/
9409
+	 * Counts all month owners
9410
+	 *
9411
+	 * @return Array the month list
9412
+	 *
9413
+	 */
9414 9414
 	public function countAllMonthsOwnersByAirlines($filters = array())
9415 9415
 	{
9416 9416
 		global $globalTimezone, $globalDBdriver;
@@ -9453,11 +9453,11 @@  discard block
 block discarded – undo
9453 9453
 	}
9454 9454
 
9455 9455
 	/**
9456
-	* Counts all month pilot
9457
-	*
9458
-	* @return Array the month list
9459
-	*
9460
-	*/
9456
+	 * Counts all month pilot
9457
+	 *
9458
+	 * @return Array the month list
9459
+	 *
9460
+	 */
9461 9461
 	public function countAllMonthsPilots($filters = array())
9462 9462
 	{
9463 9463
 		global $globalTimezone, $globalDBdriver;
@@ -9499,11 +9499,11 @@  discard block
 block discarded – undo
9499 9499
 	}
9500 9500
 	
9501 9501
 	/**
9502
-	* Counts all month pilot
9503
-	*
9504
-	* @return Array the month list
9505
-	*
9506
-	*/
9502
+	 * Counts all month pilot
9503
+	 *
9504
+	 * @return Array the month list
9505
+	 *
9506
+	 */
9507 9507
 	public function countAllMonthsPilotsByAirlines($filters = array())
9508 9508
 	{
9509 9509
 		global $globalTimezone, $globalDBdriver;
@@ -9546,11 +9546,11 @@  discard block
 block discarded – undo
9546 9546
 	}
9547 9547
 
9548 9548
 	/**
9549
-	* Counts all month airline
9550
-	*
9551
-	* @return Array the month list
9552
-	*
9553
-	*/
9549
+	 * Counts all month airline
9550
+	 *
9551
+	 * @return Array the month list
9552
+	 *
9553
+	 */
9554 9554
 	public function countAllMonthsAirlines($filters = array())
9555 9555
 	{
9556 9556
 		global $globalTimezone, $globalDBdriver;
@@ -9592,11 +9592,11 @@  discard block
 block discarded – undo
9592 9592
 	}
9593 9593
 	
9594 9594
 	/**
9595
-	* Counts all month aircraft
9596
-	*
9597
-	* @return Array the month list
9598
-	*
9599
-	*/
9595
+	 * Counts all month aircraft
9596
+	 *
9597
+	 * @return Array the month list
9598
+	 *
9599
+	 */
9600 9600
 	public function countAllMonthsAircrafts($filters = array())
9601 9601
 	{
9602 9602
 		global $globalTimezone, $globalDBdriver;
@@ -9639,11 +9639,11 @@  discard block
 block discarded – undo
9639 9639
 	
9640 9640
 
9641 9641
 	/**
9642
-	* Counts all month aircraft
9643
-	*
9644
-	* @return Array the month list
9645
-	*
9646
-	*/
9642
+	 * Counts all month aircraft
9643
+	 *
9644
+	 * @return Array the month list
9645
+	 *
9646
+	 */
9647 9647
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9648 9648
 	{
9649 9649
 		global $globalTimezone, $globalDBdriver;
@@ -9686,11 +9686,11 @@  discard block
 block discarded – undo
9686 9686
 	}
9687 9687
 
9688 9688
 	/**
9689
-	* Counts all month real arrival
9690
-	*
9691
-	* @return Array the month list
9692
-	*
9693
-	*/
9689
+	 * Counts all month real arrival
9690
+	 *
9691
+	 * @return Array the month list
9692
+	 *
9693
+	 */
9694 9694
 	public function countAllMonthsRealArrivals($filters = array())
9695 9695
 	{
9696 9696
 		global $globalTimezone, $globalDBdriver;
@@ -9733,11 +9733,11 @@  discard block
 block discarded – undo
9733 9733
 	
9734 9734
 
9735 9735
 	/**
9736
-	* Counts all month real arrival
9737
-	*
9738
-	* @return Array the month list
9739
-	*
9740
-	*/
9736
+	 * Counts all month real arrival
9737
+	 *
9738
+	 * @return Array the month list
9739
+	 *
9740
+	 */
9741 9741
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9742 9742
 	{
9743 9743
 		global $globalTimezone, $globalDBdriver;
@@ -9781,11 +9781,11 @@  discard block
 block discarded – undo
9781 9781
 	
9782 9782
 
9783 9783
 	/**
9784
-	* Counts all dates during the last year
9785
-	*
9786
-	* @return Array the date list
9787
-	*
9788
-	*/
9784
+	 * Counts all dates during the last year
9785
+	 *
9786
+	 * @return Array the date list
9787
+	 *
9788
+	 */
9789 9789
 	public function countAllMonthsLastYear($filters)
9790 9790
 	{
9791 9791
 		global $globalTimezone, $globalDBdriver;
@@ -9807,7 +9807,7 @@  discard block
 block discarded – undo
9807 9807
 			$query .= " GROUP BY year_name, month_name
9808 9808
 								ORDER BY year_name, month_name ASC";
9809 9809
 			$query_data = array(':offset' => $offset);
9810
-    		}
9810
+			}
9811 9811
 		
9812 9812
 		$sth = $this->db->prepare($query);
9813 9813
 		$sth->execute($query_data);
@@ -9830,11 +9830,11 @@  discard block
 block discarded – undo
9830 9830
 	
9831 9831
 	
9832 9832
 	/**
9833
-	* Counts all hours
9834
-	*
9835
-	* @return Array the hour list
9836
-	*
9837
-	*/
9833
+	 * Counts all hours
9834
+	 *
9835
+	 * @return Array the hour list
9836
+	 *
9837
+	 */
9838 9838
 	public function countAllHours($orderby,$filters = array())
9839 9839
 	{
9840 9840
 		global $globalTimezone, $globalDBdriver;
@@ -9895,11 +9895,11 @@  discard block
 block discarded – undo
9895 9895
 	}
9896 9896
 	
9897 9897
 	/**
9898
-	* Counts all hours
9899
-	*
9900
-	* @return Array the hour list
9901
-	*
9902
-	*/
9898
+	 * Counts all hours
9899
+	 *
9900
+	 * @return Array the hour list
9901
+	 *
9902
+	 */
9903 9903
 	public function countAllHoursByAirlines($orderby, $filters = array())
9904 9904
 	{
9905 9905
 		global $globalTimezone, $globalDBdriver;
@@ -9962,11 +9962,11 @@  discard block
 block discarded – undo
9962 9962
 
9963 9963
 
9964 9964
 	/**
9965
-	* Counts all hours by airline
9966
-	*
9967
-	* @return Array the hour list
9968
-	*
9969
-	*/
9965
+	 * Counts all hours by airline
9966
+	 *
9967
+	 * @return Array the hour list
9968
+	 *
9969
+	 */
9970 9970
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9971 9971
 	{
9972 9972
 		global $globalTimezone, $globalDBdriver;
@@ -10012,11 +10012,11 @@  discard block
 block discarded – undo
10012 10012
 	
10013 10013
 	
10014 10014
 	/**
10015
-	* Counts all hours by aircraft
10016
-	*
10017
-	* @return Array the hour list
10018
-	*
10019
-	*/
10015
+	 * Counts all hours by aircraft
10016
+	 *
10017
+	 * @return Array the hour list
10018
+	 *
10019
+	 */
10020 10020
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10021 10021
 	{
10022 10022
 		global $globalTimezone, $globalDBdriver;
@@ -10059,11 +10059,11 @@  discard block
 block discarded – undo
10059 10059
 	
10060 10060
 	
10061 10061
 	/**
10062
-	* Counts all hours by aircraft registration
10063
-	*
10064
-	* @return Array the hour list
10065
-	*
10066
-	*/
10062
+	 * Counts all hours by aircraft registration
10063
+	 *
10064
+	 * @return Array the hour list
10065
+	 *
10066
+	 */
10067 10067
 	public function countAllHoursByRegistration($registration, $filters = array())
10068 10068
 	{
10069 10069
 		global $globalTimezone, $globalDBdriver;
@@ -10106,11 +10106,11 @@  discard block
 block discarded – undo
10106 10106
 	
10107 10107
 	
10108 10108
 	/**
10109
-	* Counts all hours by airport
10110
-	*
10111
-	* @return Array the hour list
10112
-	*
10113
-	*/
10109
+	 * Counts all hours by airport
10110
+	 *
10111
+	 * @return Array the hour list
10112
+	 *
10113
+	 */
10114 10114
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10115 10115
 	{
10116 10116
 		global $globalTimezone, $globalDBdriver;
@@ -10154,11 +10154,11 @@  discard block
 block discarded – undo
10154 10154
 	
10155 10155
 	
10156 10156
 	/**
10157
-	* Counts all hours by manufacturer
10158
-	*
10159
-	* @return Array the hour list
10160
-	*
10161
-	*/
10157
+	 * Counts all hours by manufacturer
10158
+	 *
10159
+	 * @return Array the hour list
10160
+	 *
10161
+	 */
10162 10162
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10163 10163
 	{
10164 10164
 		global $globalTimezone, $globalDBdriver;
@@ -10202,11 +10202,11 @@  discard block
 block discarded – undo
10202 10202
 	
10203 10203
 	
10204 10204
 	/**
10205
-	* Counts all hours by date
10206
-	*
10207
-	* @return Array the hour list
10208
-	*
10209
-	*/
10205
+	 * Counts all hours by date
10206
+	 *
10207
+	 * @return Array the hour list
10208
+	 *
10209
+	 */
10210 10210
 	public function countAllHoursByDate($date, $filters = array())
10211 10211
 	{
10212 10212
 		global $globalTimezone, $globalDBdriver;
@@ -10250,11 +10250,11 @@  discard block
 block discarded – undo
10250 10250
 	
10251 10251
 	
10252 10252
 	/**
10253
-	* Counts all hours by a ident/callsign
10254
-	*
10255
-	* @return Array the hour list
10256
-	*
10257
-	*/
10253
+	 * Counts all hours by a ident/callsign
10254
+	 *
10255
+	 * @return Array the hour list
10256
+	 *
10257
+	 */
10258 10258
 	public function countAllHoursByIdent($ident, $filters = array())
10259 10259
 	{
10260 10260
 		global $globalTimezone, $globalDBdriver;
@@ -10297,11 +10297,11 @@  discard block
 block discarded – undo
10297 10297
 	}
10298 10298
 	
10299 10299
 	/**
10300
-	* Counts all hours by a owner
10301
-	*
10302
-	* @return Array the hour list
10303
-	*
10304
-	*/
10300
+	 * Counts all hours by a owner
10301
+	 *
10302
+	 * @return Array the hour list
10303
+	 *
10304
+	 */
10305 10305
 	public function countAllHoursByOwner($owner, $filters = array())
10306 10306
 	{
10307 10307
 		global $globalTimezone, $globalDBdriver;
@@ -10344,11 +10344,11 @@  discard block
 block discarded – undo
10344 10344
 	}
10345 10345
 	
10346 10346
 	/**
10347
-	* Counts all hours by a pilot
10348
-	*
10349
-	* @return Array the hour list
10350
-	*
10351
-	*/
10347
+	 * Counts all hours by a pilot
10348
+	 *
10349
+	 * @return Array the hour list
10350
+	 *
10351
+	 */
10352 10352
 	public function countAllHoursByPilot($pilot, $filters = array())
10353 10353
 	{
10354 10354
 		global $globalTimezone, $globalDBdriver;
@@ -10393,11 +10393,11 @@  discard block
 block discarded – undo
10393 10393
 	
10394 10394
 	
10395 10395
 	/**
10396
-	* Counts all hours by route
10397
-	*
10398
-	* @return Array the hour list
10399
-	*
10400
-	*/
10396
+	 * Counts all hours by route
10397
+	 *
10398
+	 * @return Array the hour list
10399
+	 *
10400
+	 */
10401 10401
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10402 10402
 	{
10403 10403
 		global $globalTimezone, $globalDBdriver;
@@ -10441,11 +10441,11 @@  discard block
 block discarded – undo
10441 10441
 	
10442 10442
 	
10443 10443
 	/**
10444
-	* Counts all hours by country
10445
-	*
10446
-	* @return Array the hour list
10447
-	*
10448
-	*/
10444
+	 * Counts all hours by country
10445
+	 *
10446
+	 * @return Array the hour list
10447
+	 *
10448
+	 */
10449 10449
 	public function countAllHoursByCountry($country, $filters = array())
10450 10450
 	{
10451 10451
 		global $globalTimezone, $globalDBdriver;
@@ -10490,11 +10490,11 @@  discard block
 block discarded – undo
10490 10490
 
10491 10491
 
10492 10492
 	/**
10493
-	* Counts all aircraft that have flown over
10494
-	*
10495
-	* @return Integer the number of aircrafts
10496
-	*
10497
-	*/
10493
+	 * Counts all aircraft that have flown over
10494
+	 *
10495
+	 * @return Integer the number of aircrafts
10496
+	 *
10497
+	 */
10498 10498
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10499 10499
 	{
10500 10500
 		global $globalDBdriver;
@@ -10527,11 +10527,11 @@  discard block
 block discarded – undo
10527 10527
 	}
10528 10528
 
10529 10529
 	/**
10530
-	* Counts all flight that really arrival
10531
-	*
10532
-	* @return Integer the number of aircrafts
10533
-	*
10534
-	*/
10530
+	 * Counts all flight that really arrival
10531
+	 *
10532
+	 * @return Integer the number of aircrafts
10533
+	 *
10534
+	 */
10535 10535
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10536 10536
 	{
10537 10537
 		global $globalDBdriver;
@@ -10564,11 +10564,11 @@  discard block
 block discarded – undo
10564 10564
 	}
10565 10565
 
10566 10566
 	/**
10567
-	* Counts all pilots that have flown over
10568
-	*
10569
-	* @return Integer the number of pilots
10570
-	*
10571
-	*/
10567
+	 * Counts all pilots that have flown over
10568
+	 *
10569
+	 * @return Integer the number of pilots
10570
+	 *
10571
+	 */
10572 10572
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10573 10573
 	{
10574 10574
 		global $globalDBdriver;
@@ -10600,11 +10600,11 @@  discard block
 block discarded – undo
10600 10600
 	}
10601 10601
 
10602 10602
 	/**
10603
-	* Counts all owners that have flown over
10604
-	*
10605
-	* @return Integer the number of owners
10606
-	*
10607
-	*/
10603
+	 * Counts all owners that have flown over
10604
+	 *
10605
+	 * @return Integer the number of owners
10606
+	 *
10607
+	 */
10608 10608
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10609 10609
 	{
10610 10610
 		global $globalDBdriver;
@@ -10637,11 +10637,11 @@  discard block
 block discarded – undo
10637 10637
 	
10638 10638
 	
10639 10639
 	/**
10640
-	* Counts all flights that have flown over
10641
-	*
10642
-	* @return Integer the number of flights
10643
-	*
10644
-	*/
10640
+	 * Counts all flights that have flown over
10641
+	 *
10642
+	 * @return Integer the number of flights
10643
+	 *
10644
+	 */
10645 10645
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
10646 10646
 	{
10647 10647
 		global $globalDBdriver;
@@ -10676,11 +10676,11 @@  discard block
 block discarded – undo
10676 10676
 	}
10677 10677
 	
10678 10678
 	/**
10679
-	* Counts all military flights that have flown over
10680
-	*
10681
-	* @return Integer the number of flights
10682
-	*
10683
-	*/
10679
+	 * Counts all military flights that have flown over
10680
+	 *
10681
+	 * @return Integer the number of flights
10682
+	 *
10683
+	 */
10684 10684
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10685 10685
 	{
10686 10686
 		global $globalDBdriver;
@@ -10715,11 +10715,11 @@  discard block
 block discarded – undo
10715 10715
 	
10716 10716
 	
10717 10717
 	/**
10718
-	* Counts all airlines that have flown over
10719
-	*
10720
-	* @return Integer the number of airlines
10721
-	*
10722
-	*/
10718
+	 * Counts all airlines that have flown over
10719
+	 *
10720
+	 * @return Integer the number of airlines
10721
+	 *
10722
+	 */
10723 10723
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10724 10724
 	{
10725 10725
 		global $globalDBdriver;
@@ -10746,8 +10746,8 @@  discard block
 block discarded – undo
10746 10746
 				$query_values = array_merge($query_values,array(':month' => $month));
10747 10747
 			}
10748 10748
 		}
10749
-                if ($query == '') $queryi .= $this->getFilter($filters);
10750
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10749
+				if ($query == '') $queryi .= $this->getFilter($filters);
10750
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10751 10751
 
10752 10752
 
10753 10753
 		$sth = $this->db->prepare($queryi);
@@ -10757,11 +10757,11 @@  discard block
 block discarded – undo
10757 10757
 
10758 10758
   
10759 10759
 	/**
10760
-	* Counts all hours of today
10761
-	*
10762
-	* @return Array the hour list
10763
-	*
10764
-	*/
10760
+	 * Counts all hours of today
10761
+	 *
10762
+	 * @return Array the hour list
10763
+	 *
10764
+	 */
10765 10765
 	public function countAllHoursFromToday($filters = array())
10766 10766
 	{
10767 10767
 		global $globalTimezone, $globalDBdriver;
@@ -10801,11 +10801,11 @@  discard block
 block discarded – undo
10801 10801
 	}
10802 10802
     
10803 10803
 	/**
10804
-	* Gets all the spotter information based on calculated upcoming flights
10805
-	*
10806
-	* @return Array the spotter information
10807
-	*
10808
-	*/
10804
+	 * Gets all the spotter information based on calculated upcoming flights
10805
+	 *
10806
+	 * @return Array the spotter information
10807
+	 *
10808
+	 */
10809 10809
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10810 10810
 	{
10811 10811
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -10880,12 +10880,12 @@  discard block
 block discarded – undo
10880 10880
 	}
10881 10881
     
10882 10882
     
10883
-     /**
10884
-	* Gets the Barrie Spotter ID based on the FlightAware ID
10885
-	*
10886
-	* @return Integer the Barrie Spotter ID
10883
+	 /**
10884
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
10885
+	  *
10886
+	  * @return Integer the Barrie Spotter ID
10887 10887
 q	*
10888
-	*/
10888
+	  */
10889 10889
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10890 10890
 	{
10891 10891
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -10906,13 +10906,13 @@  discard block
 block discarded – undo
10906 10906
   
10907 10907
  
10908 10908
 	/**
10909
-	* Parses a date string
10910
-	*
10911
-	* @param String $dateString the date string
10912
-	* @param String $timezone the timezone of a user
10913
-	* @return Array the time information
10914
-	*
10915
-	*/
10909
+	 * Parses a date string
10910
+	 *
10911
+	 * @param String $dateString the date string
10912
+	 * @param String $timezone the timezone of a user
10913
+	 * @return Array the time information
10914
+	 *
10915
+	 */
10916 10916
 	public function parseDateString($dateString, $timezone = '')
10917 10917
 	{
10918 10918
 		$time_array = array();
@@ -10948,12 +10948,12 @@  discard block
 block discarded – undo
10948 10948
 	
10949 10949
 	
10950 10950
 	/**
10951
-	* Parses the direction degrees to working
10952
-	*
10953
-	* @param Float $direction the direction in degrees
10954
-	* @return Array the direction information
10955
-	*
10956
-	*/
10951
+	 * Parses the direction degrees to working
10952
+	 *
10953
+	 * @param Float $direction the direction in degrees
10954
+	 * @return Array the direction information
10955
+	 *
10956
+	 */
10957 10957
 	public function parseDirection($direction = 0)
10958 10958
 	{
10959 10959
 		if ($direction == '') $direction = 0;
@@ -11032,12 +11032,12 @@  discard block
 block discarded – undo
11032 11032
 	
11033 11033
 	
11034 11034
 	/**
11035
-	* Gets the aircraft registration
11036
-	*
11037
-	* @param String $flightaware_id the flight aware id
11038
-	* @return String the aircraft registration
11039
-	*
11040
-	*/
11035
+	 * Gets the aircraft registration
11036
+	 *
11037
+	 * @param String $flightaware_id the flight aware id
11038
+	 * @return String the aircraft registration
11039
+	 *
11040
+	 */
11041 11041
 	
11042 11042
 	public function getAircraftRegistration($flightaware_id)
11043 11043
 	{
@@ -11066,12 +11066,12 @@  discard block
 block discarded – undo
11066 11066
 
11067 11067
 
11068 11068
 	/**
11069
-	* Gets the aircraft registration from ModeS
11070
-	*
11071
-	* @param String $aircraft_modes the flight ModeS in hex
11072
-	* @return String the aircraft registration
11073
-	*
11074
-	*/
11069
+	 * Gets the aircraft registration from ModeS
11070
+	 *
11071
+	 * @param String $aircraft_modes the flight ModeS in hex
11072
+	 * @return String the aircraft registration
11073
+	 *
11074
+	 */
11075 11075
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11076 11076
 	{
11077 11077
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11084,19 +11084,19 @@  discard block
 block discarded – undo
11084 11084
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11085 11085
 		$sth->closeCursor();
11086 11086
 		if (count($row) > 0) {
11087
-		    //return $row['Registration'];
11088
-		    return $row['registration'];
11087
+			//return $row['Registration'];
11088
+			return $row['registration'];
11089 11089
 		} else return '';
11090 11090
 	
11091 11091
 	}
11092 11092
 
11093 11093
 	/**
11094
-	* Gets the aircraft type from ModeS
11095
-	*
11096
-	* @param String $aircraft_modes the flight ModeS in hex
11097
-	* @return String the aircraft type
11098
-	*
11099
-	*/
11094
+	 * Gets the aircraft type from ModeS
11095
+	 *
11096
+	 * @param String $aircraft_modes the flight ModeS in hex
11097
+	 * @return String the aircraft type
11098
+	 *
11099
+	 */
11100 11100
 	public function getAircraftTypeBymodeS($aircraft_modes)
11101 11101
 	{
11102 11102
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11109,19 +11109,19 @@  discard block
 block discarded – undo
11109 11109
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11110 11110
 		$sth->closeCursor();
11111 11111
 		if (count($row) > 0) {
11112
-		    if ($row['type_flight'] == null) return '';
11113
-		    else return $row['type_flight'];
11112
+			if ($row['type_flight'] == null) return '';
11113
+			else return $row['type_flight'];
11114 11114
 		} else return '';
11115 11115
 	
11116 11116
 	}
11117 11117
 
11118 11118
 	/**
11119
-	* Gets Country from latitude/longitude
11120
-	*
11121
-	* @param Float $latitude latitute of the flight
11122
-	* @param Float $longitude longitute of the flight
11123
-	* @return String the countrie
11124
-	*/
11119
+	 * Gets Country from latitude/longitude
11120
+	 *
11121
+	 * @param Float $latitude latitute of the flight
11122
+	 * @param Float $longitude longitute of the flight
11123
+	 * @return String the countrie
11124
+	 */
11125 11125
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11126 11126
 	{
11127 11127
 		global $globalDBdriver, $globalDebug;
@@ -11158,11 +11158,11 @@  discard block
 block discarded – undo
11158 11158
 	}
11159 11159
 
11160 11160
 	/**
11161
-	* Gets Country from iso2
11162
-	*
11163
-	* @param String $iso2 ISO2 country code
11164
-	* @return String the countrie
11165
-	*/
11161
+	 * Gets Country from iso2
11162
+	 *
11163
+	 * @param String $iso2 ISO2 country code
11164
+	 * @return String the countrie
11165
+	 */
11166 11166
 	public function getCountryFromISO2($iso2)
11167 11167
 	{
11168 11168
 		global $globalDBdriver, $globalDebug;
@@ -11190,12 +11190,12 @@  discard block
 block discarded – undo
11190 11190
 	}
11191 11191
 
11192 11192
 	/**
11193
-	* converts the registration code using the country prefix
11194
-	*
11195
-	* @param String $registration the aircraft registration
11196
-	* @return String the aircraft registration
11197
-	*
11198
-	*/
11193
+	 * converts the registration code using the country prefix
11194
+	 *
11195
+	 * @param String $registration the aircraft registration
11196
+	 * @return String the aircraft registration
11197
+	 *
11198
+	 */
11199 11199
 	public function convertAircraftRegistration($registration)
11200 11200
 	{
11201 11201
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11247,12 +11247,12 @@  discard block
 block discarded – undo
11247 11247
 	}
11248 11248
 
11249 11249
 	/**
11250
-	* Country from the registration code
11251
-	*
11252
-	* @param String $registration the aircraft registration
11253
-	* @return String the country
11254
-	*
11255
-	*/
11250
+	 * Country from the registration code
11251
+	 *
11252
+	 * @param String $registration the aircraft registration
11253
+	 * @return String the country
11254
+	 *
11255
+	 */
11256 11256
 	public function countryFromAircraftRegistration($registration)
11257 11257
 	{
11258 11258
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11271,8 +11271,8 @@  discard block
 block discarded – undo
11271 11271
 				$country = $row['country'];
11272 11272
 			}
11273 11273
 		} else {
11274
-    			$registration_1 = substr($registration, 0, 1);
11275
-		        $registration_2 = substr($registration, 0, 2);
11274
+				$registration_1 = substr($registration, 0, 1);
11275
+				$registration_2 = substr($registration, 0, 2);
11276 11276
 
11277 11277
 			$country = '';
11278 11278
 			//first get the prefix based on two characters
@@ -11308,12 +11308,12 @@  discard block
 block discarded – undo
11308 11308
 	}
11309 11309
 
11310 11310
 	/**
11311
-	* Registration prefix from the registration code
11312
-	*
11313
-	* @param String $registration the aircraft registration
11314
-	* @return String the registration prefix
11315
-	*
11316
-	*/
11311
+	 * Registration prefix from the registration code
11312
+	 *
11313
+	 * @param String $registration the aircraft registration
11314
+	 * @return String the registration prefix
11315
+	 *
11316
+	 */
11317 11317
 	public function registrationPrefixFromAircraftRegistration($registration)
11318 11318
 	{
11319 11319
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11332,8 +11332,8 @@  discard block
 block discarded – undo
11332 11332
 				//$country = $row['country'];
11333 11333
 			}
11334 11334
 		} else {
11335
-    			$registration_1 = substr($registration, 0, 1);
11336
-		        $registration_2 = substr($registration, 0, 2);
11335
+				$registration_1 = substr($registration, 0, 1);
11336
+				$registration_2 = substr($registration, 0, 2);
11337 11337
 
11338 11338
 			//first get the prefix based on two characters
11339 11339
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11369,12 +11369,12 @@  discard block
 block discarded – undo
11369 11369
 
11370 11370
 
11371 11371
 	/**
11372
-	* Country from the registration code
11373
-	*
11374
-	* @param String $registration the aircraft registration
11375
-	* @return String the country
11376
-	*
11377
-	*/
11372
+	 * Country from the registration code
11373
+	 *
11374
+	 * @param String $registration the aircraft registration
11375
+	 * @return String the country
11376
+	 *
11377
+	 */
11378 11378
 	public function countryFromAircraftRegistrationCode($registration)
11379 11379
 	{
11380 11380
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11391,11 +11391,11 @@  discard block
 block discarded – undo
11391 11391
 	}
11392 11392
 	
11393 11393
 	/**
11394
-	* Set a new highlight value for a flight
11395
-	*
11396
-	* @param String $flightaware_id flightaware_id from spotter_output table
11397
-	* @param String $highlight New highlight value
11398
-	*/
11394
+	 * Set a new highlight value for a flight
11395
+	 *
11396
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11397
+	 * @param String $highlight New highlight value
11398
+	 */
11399 11399
 	public function setHighlightFlight($flightaware_id,$highlight) {
11400 11400
 		
11401 11401
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11404,12 +11404,12 @@  discard block
 block discarded – undo
11404 11404
 	}
11405 11405
 
11406 11406
 	/**
11407
-	* Set a new highlight value for a flight by Registration
11408
-	*
11409
-	* @param String $registration Registration of the aircraft
11410
-	* @param String $date Date of spotted aircraft
11411
-	* @param String $highlight New highlight value
11412
-	*/
11407
+	 * Set a new highlight value for a flight by Registration
11408
+	 *
11409
+	 * @param String $registration Registration of the aircraft
11410
+	 * @param String $date Date of spotted aircraft
11411
+	 * @param String $highlight New highlight value
11412
+	 */
11413 11413
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11414 11414
 		if ($date == '') {
11415 11415
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11423,12 +11423,12 @@  discard block
 block discarded – undo
11423 11423
 	}
11424 11424
 	
11425 11425
 	/**
11426
-	* Gets the short url from bit.ly
11427
-	*
11428
-	* @param String $url the full url
11429
-	* @return String the bit.ly url
11430
-	*
11431
-	*/
11426
+	 * Gets the short url from bit.ly
11427
+	 *
11428
+	 * @param String $url the full url
11429
+	 * @return String the bit.ly url
11430
+	 *
11431
+	 */
11432 11432
 	public function getBitlyURL($url)
11433 11433
 	{
11434 11434
 		global $globalBitlyAccessToken;
@@ -11717,11 +11717,11 @@  discard block
 block discarded – undo
11717 11717
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
11718 11718
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
11719 11719
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
11720
-                } else {
11720
+				} else {
11721 11721
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
11722 11722
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
11723 11723
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
11724
-    		}
11724
+			}
11725 11725
 		$sth = $this->db->prepare($query);
11726 11726
 		$sth->execute();
11727 11727
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1261 added lines, -1261 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 spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $aircraft_correct_icaotype = array('CL64' => 'CL60',
9 9
 					'F9LX' => 'F900',
10 10
 					'K35T' => 'K35R',
@@ -59,45 +59,45 @@  discard block
 block discarded – undo
59 59
 	* @param Array $filter the filter
60 60
 	* @return Array the SQL part
61 61
 	*/
62
-	public function getFilter($filter = array(),$where = false,$and = false) {
62
+	public function getFilter($filter = array(), $where = false, $and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
64 64
 		$filters = array();
65 65
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
66 66
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
67 67
 				$filters = $globalStatsFilters[$globalFilterName];
68 68
 			} else {
69
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
69
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
73 73
 		$filter_query_join = '';
74 74
 		$filter_query_where = '';
75
-		foreach($filters as $flt) {
75
+		foreach ($filters as $flt) {
76 76
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
77 77
 				if ($flt['airlines'][0] != '') {
78 78
 					if (isset($flt['source'])) {
79
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
79
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
80 80
 					} else {
81
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
81
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
82 82
 					}
83 83
 				}
84 84
 			}
85 85
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
86 86
 				if (isset($flt['source'])) {
87
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
87
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
88 88
 				} else {
89
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
89
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
90 90
 				}
91 91
 			}
92 92
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
93 93
 				if (isset($flt['source'])) {
94
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
94
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
95 95
 				}
96 96
 			}
97 97
 		}
98 98
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
99 99
 			if ($filter['airlines'][0] != '') {
100
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
100
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
101 101
 			}
102 102
 		}
103 103
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
108 108
 		}
109 109
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
110
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
110
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
111 111
 			}
112 112
 		if (isset($filter['source']) && !empty($filter['source'])) {
113
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
113
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
114 114
 		}
115 115
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
116 116
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119 119
 			if ($filter_query_where == '') {
120
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
120
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
121 121
 			} else {
122
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
122
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
123 123
 			}
124 124
 		}
125 125
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	* @return Array the spotter information
138 138
 	*
139 139
 	*/
140
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
140
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
143 143
 		$Image = new Image($this->db);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			$sth = $this->db->prepare($query.$limitQuery);
168 168
 			$sth->execute($params);
169 169
 		} catch (PDOException $e) {
170
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
170
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
171 171
 			exit();
172 172
 		}
173 173
 		
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$spotter_array = array();
178 178
 		
179 179
 
180
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
180
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
181 181
 		{
182 182
 			$num_rows++;
183 183
 			$temp_array = array();
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			if (isset($row['route_stop'])) {
223 223
 				$temp_array['route_stop'] = $row['route_stop'];
224 224
 				if ($row['route_stop'] != '') {
225
-					$allroute = explode(' ',$row['route_stop']);
225
+					$allroute = explode(' ', $row['route_stop']);
226 226
 			
227 227
 					foreach ($allroute as $route) {
228 228
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 				{
278 278
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
279 279
 				} else {
280
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
280
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
281 281
 				}
282 282
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
283
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
284
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
283
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
284
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
285 285
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
286 286
 			}
287 287
 			
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
316 316
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
317 317
 					if (is_numeric(substr($row['ident'], 2, 1))) {
318
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
318
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
319 319
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
320
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
320
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
321 321
 					} else {
322 322
 						$airline_array = $this->getAllAirlineInfo('NA');
323 323
 					}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				}
355 355
 			}
356 356
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
357
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
357
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
358 358
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
359 359
 				if (count($acars_array) > 0) {
360 360
 					$temp_array['acars'] = $acars_array;
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
372 372
 			}
373 373
 
374
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
374
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
375 375
 			{
376 376
 				if ($globalIVAO) {
377
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
378
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
377
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
378
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
379 379
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
380 380
 				if (count($image_array) > 0) {
381 381
 					$temp_array['image'] = $image_array[0]['image'];
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
400 400
 			}
401 401
 			
402
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
402
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
403 403
 				if ($schedules === true) {
404 404
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
405 405
 					//print_r($schedule_array);
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
 			if (isset($row['squawk'])) {
482 482
 				$temp_array['squawk'] = $row['squawk'];
483 483
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
484
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
485
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
484
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
485
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
486 486
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
487
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
488
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
489
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
487
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
488
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
489
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
490 490
 			}
491 491
     			
492 492
 			$temp_array['query_number_rows'] = $num_rows;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	* @return Array the spotter information
506 506
 	*
507 507
 	*/
508
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
508
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
509 509
 	{
510 510
 		global $globalTimezone, $globalDBdriver;
511 511
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
 		$query_values = array();
517 517
 		$additional_query = '';
518
-		$filter_query = $this->getFilter($filters,true,true);
518
+		$filter_query = $this->getFilter($filters, true, true);
519 519
 		if ($q != "")
520 520
 		{
521 521
 			if (!is_string($q))
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 				return false;
524 524
 			} else {
525 525
 				$q_array = explode(" ", $q);
526
-				foreach ($q_array as $q_item){
527
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
526
+				foreach ($q_array as $q_item) {
527
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
528 528
 					$additional_query .= " AND (";
529 529
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
530 530
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -556,37 +556,37 @@  discard block
 block discarded – undo
556 556
 
557 557
 		if ($registration != "")
558 558
 		{
559
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
559
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
560 560
 			if (!is_string($registration))
561 561
 			{
562 562
 				return false;
563 563
 			} else {
564 564
 				$additional_query .= " AND spotter_output.registration = :registration";
565
-				$query_values = array_merge($query_values,array(':registration' => $registration));
565
+				$query_values = array_merge($query_values, array(':registration' => $registration));
566 566
 			}
567 567
 		}
568 568
 
569 569
 		if ($aircraft_icao != "")
570 570
 		{
571
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
571
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
572 572
 			if (!is_string($aircraft_icao))
573 573
 			{
574 574
 				return false;
575 575
 			} else {
576 576
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
577
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
577
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
578 578
 			}
579 579
 		}
580 580
 
581 581
 		if ($aircraft_manufacturer != "")
582 582
 		{
583
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
583
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
584 584
 			if (!is_string($aircraft_manufacturer))
585 585
 			{
586 586
 				return false;
587 587
 			} else {
588 588
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
589
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
589
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
590 590
 			}
591 591
 		}
592 592
 
@@ -602,25 +602,25 @@  discard block
 block discarded – undo
602 602
 
603 603
 		if ($airline_icao != "")
604 604
 		{
605
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
605
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
606 606
 			if (!is_string($airline_icao))
607 607
 			{
608 608
 				return false;
609 609
 			} else {
610 610
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
611
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
611
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
612 612
 			}
613 613
 		}
614 614
 
615 615
 		if ($airline_country != "")
616 616
 		{
617
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
617
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
618 618
 			if (!is_string($airline_country))
619 619
 			{
620 620
 				return false;
621 621
 			} else {
622 622
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
623
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
623
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
624 624
 			}
625 625
 		}
626 626
 
@@ -647,31 +647,31 @@  discard block
 block discarded – undo
647 647
 
648 648
 		if ($airport != "")
649 649
 		{
650
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
650
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
651 651
 			if (!is_string($airport))
652 652
 			{
653 653
 				return false;
654 654
 			} else {
655 655
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
656
-				$query_values = array_merge($query_values,array(':airport' => $airport));
656
+				$query_values = array_merge($query_values, array(':airport' => $airport));
657 657
 			}
658 658
 		}
659 659
 
660 660
 		if ($airport_country != "")
661 661
 		{
662
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
662
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
663 663
 			if (!is_string($airport_country))
664 664
 			{
665 665
 				return false;
666 666
 			} else {
667 667
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
668
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
668
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
669 669
 			}
670 670
 		}
671 671
     
672 672
 		if ($callsign != "")
673 673
 		{
674
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
674
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
675 675
 			if (!is_string($callsign))
676 676
 			{
677 677
 				return false;
@@ -679,79 +679,79 @@  discard block
 block discarded – undo
679 679
 				$translate = $Translation->ident2icao($callsign);
680 680
 				if ($translate != $callsign) {
681 681
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
682
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
682
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
683 683
 				} else {
684 684
 					$additional_query .= " AND spotter_output.ident = :callsign";
685
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
685
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
686 686
 				}
687 687
 			}
688 688
 		}
689 689
 
690 690
 		if ($owner != "")
691 691
 		{
692
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
692
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
693 693
 			if (!is_string($owner))
694 694
 			{
695 695
 				return false;
696 696
 			} else {
697 697
 				$additional_query .= " AND spotter_output.owner_name = :owner";
698
-				$query_values = array_merge($query_values,array(':owner' => $owner));
698
+				$query_values = array_merge($query_values, array(':owner' => $owner));
699 699
 			}
700 700
 		}
701 701
 
702 702
 		if ($pilot_name != "")
703 703
 		{
704
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
704
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
705 705
 			if (!is_string($pilot_name))
706 706
 			{
707 707
 				return false;
708 708
 			} else {
709 709
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
710
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
710
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
711 711
 			}
712 712
 		}
713 713
 
714 714
 		if ($pilot_id != "")
715 715
 		{
716
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
716
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
717 717
 			if (!is_string($pilot_id))
718 718
 			{
719 719
 				return false;
720 720
 			} else {
721 721
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
722
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
722
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
723 723
 			}
724 724
 		}
725 725
 
726 726
 		if ($departure_airport_route != "")
727 727
 		{
728
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
728
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
729 729
 			if (!is_string($departure_airport_route))
730 730
 			{
731 731
 				return false;
732 732
 			} else {
733 733
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
734
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
734
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
735 735
 			}
736 736
 		}
737 737
 
738 738
 		if ($arrival_airport_route != "")
739 739
 		{
740
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
740
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
741 741
 			if (!is_string($arrival_airport_route))
742 742
 			{
743 743
 				return false;
744 744
 			} else {
745 745
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
746
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
746
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
747 747
 			}
748 748
 		}
749 749
 
750 750
 		if ($altitude != "")
751 751
 		{
752 752
 			$altitude_array = explode(",", $altitude);
753
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
754
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
753
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
754
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
755 755
 
756 756
 			if ($altitude_array[1] != "")
757 757
 			{                
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 		if ($date_posted != "")
768 768
 		{
769 769
 			$date_array = explode(",", $date_posted);
770
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
771
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
770
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
771
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
772 772
 
773 773
 			if ($globalTimezone != '') {
774 774
 				date_default_timezone_set($globalTimezone);
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 		{
800 800
 			$limit_array = explode(",", $limit);
801 801
 			
802
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
803
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
802
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
803
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
804 804
 			
805 805
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
806 806
 			{
@@ -829,23 +829,23 @@  discard block
 block discarded – undo
829 829
 
830 830
 
831 831
 		if ($origLat != "" && $origLon != "" && $dist != "") {
832
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
832
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
833 833
 
834 834
 			if ($globalDBdriver == 'mysql') {
835
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
835
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
836 836
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
837 837
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
838 838
 			} else {
839
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
839
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
840 840
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
841 841
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
842 842
 			}
843 843
 		} else {		
844
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
844
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
845 845
 					".$additional_query."
846 846
 					".$orderby_query;
847 847
 		}
848
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
848
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
849 849
 		return $spotter_array;
850 850
 	}
851 851
 	
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 		{
869 869
 			$limit_array = explode(",", $limit);
870 870
 			
871
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
872
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
871
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
872
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
873 873
 			
874 874
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
875 875
 			{
@@ -886,9 +886,9 @@  discard block
 block discarded – undo
886 886
 			$orderby_query = " ORDER BY spotter_output.date DESC";
887 887
 		}
888 888
 
889
-		$query  = $global_query.$filter_query." ".$orderby_query;
889
+		$query = $global_query.$filter_query." ".$orderby_query;
890 890
 
891
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
891
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
892 892
 
893 893
 		return $spotter_array;
894 894
 	}
@@ -934,34 +934,34 @@  discard block
 block discarded – undo
934 934
 			{
935 935
 				return false;
936 936
 			} else {
937
-				if ($interval == "30m"){
937
+				if ($interval == "30m") {
938 938
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
939
-				} else if ($interval == "1h"){
939
+				} else if ($interval == "1h") {
940 940
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
941
-				} else if ($interval == "3h"){
941
+				} else if ($interval == "3h") {
942 942
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
943
-				} else if ($interval == "6h"){
943
+				} else if ($interval == "6h") {
944 944
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
945
-				} else if ($interval == "12h"){
945
+				} else if ($interval == "12h") {
946 946
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
947
-				} else if ($interval == "24h"){
947
+				} else if ($interval == "24h") {
948 948
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
949
-				} else if ($interval == "7d"){
949
+				} else if ($interval == "7d") {
950 950
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
951
-				} else if ($interval == "30d"){
951
+				} else if ($interval == "30d") {
952 952
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
953 953
 				} 
954 954
 			}
955 955
 		}
956 956
 
957
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
957
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
958 958
                    WHERE spotter_output.latitude <> '' 
959 959
 				   AND spotter_output.longitude <> '' 
960 960
                    ".$additional_query."
961 961
                    HAVING distance < :radius  
962 962
 				   ORDER BY distance";
963 963
 
964
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
964
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
965 965
 
966 966
 		return $spotter_array;
967 967
 	}
@@ -973,21 +973,21 @@  discard block
 block discarded – undo
973 973
 	* @return Array the spotter information
974 974
 	*
975 975
 	*/
976
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
976
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
977 977
 	{
978 978
 		global $global_query;
979 979
 		
980 980
 		date_default_timezone_set('UTC');
981 981
 
982
-		$filter_query = $this->getFilter($filter,true,true);
982
+		$filter_query = $this->getFilter($filter, true, true);
983 983
 
984 984
 		$limit_query = '';
985 985
 		if ($limit != "")
986 986
 		{
987 987
 			$limit_array = explode(",", $limit);
988 988
 			
989
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
990
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
989
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
990
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
991 991
 			
992 992
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
993 993
 			{
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1005 1005
 		}
1006 1006
 
1007
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1007
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1008 1008
 
1009 1009
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1010 1010
 
@@ -1023,15 +1023,15 @@  discard block
 block discarded – undo
1023 1023
 		global $global_query;
1024 1024
 		
1025 1025
 		date_default_timezone_set('UTC');
1026
-		$filter_query = $this->getFilter($filter,true,true);
1026
+		$filter_query = $this->getFilter($filter, true, true);
1027 1027
 
1028 1028
 		$limit_query = '';
1029 1029
 		if ($limit != "")
1030 1030
 		{
1031 1031
 			$limit_array = explode(",", $limit);
1032 1032
 			
1033
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1034
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1033
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1034
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1035 1035
 			
1036 1036
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1037 1037
 			{
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1049 1049
 		}
1050 1050
 
1051
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1051
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1052 1052
 
1053 1053
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1054 1054
 
@@ -1062,20 +1062,20 @@  discard block
 block discarded – undo
1062 1062
 	* @return Array the spotter information
1063 1063
 	*
1064 1064
 	*/
1065
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1065
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
1068 1068
 		
1069 1069
 		date_default_timezone_set('UTC');
1070
-		$filter_query = $this->getFilter($filter,true,true);
1070
+		$filter_query = $this->getFilter($filter, true, true);
1071 1071
 		
1072 1072
 		$limit_query = '';
1073 1073
 		if ($limit != "")
1074 1074
 		{
1075 1075
 			$limit_array = explode(",", $limit);
1076 1076
 			
1077
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1078
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1077
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1078
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1079 1079
 			
1080 1080
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1081 1081
 			{
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1093 1093
 		}
1094 1094
 
1095
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1095
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1096 1096
 
1097 1097
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1098 1098
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 		
1113 1113
 		date_default_timezone_set('UTC');
1114 1114
 		
1115
-		$filter_query = $this->getFilter($filter,true,true);
1115
+		$filter_query = $this->getFilter($filter, true, true);
1116 1116
 		
1117 1117
 		$limit_query = '';
1118 1118
 		
@@ -1120,8 +1120,8 @@  discard block
 block discarded – undo
1120 1120
 		{
1121 1121
 			$limit_array = explode(",", $limit);
1122 1122
 			
1123
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1124
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1123
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1124
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1125 1125
 			
1126 1126
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1127 1127
 			{
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1139 1139
 		}
1140 1140
 
1141
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1141
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1142 1142
 
1143 1143
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1144 1144
 
@@ -1157,14 +1157,14 @@  discard block
 block discarded – undo
1157 1157
 		global $global_query;
1158 1158
 		
1159 1159
 		date_default_timezone_set('UTC');
1160
-		$filter_query = $this->getFilter($filter,true,true);
1160
+		$filter_query = $this->getFilter($filter, true, true);
1161 1161
 		$limit_query = '';
1162 1162
 		if ($limit != "")
1163 1163
 		{
1164 1164
 			$limit_array = explode(",", $limit);
1165 1165
 			
1166
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1167
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1166
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1167
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1168 1168
 			
1169 1169
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1170 1170
 			{
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1182 1182
 		}
1183 1183
 
1184
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1184
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1185 1185
 
1186 1186
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1187 1187
 
@@ -1205,9 +1205,9 @@  discard block
 block discarded – undo
1205 1205
 		$query_values = array(':id' => $id);
1206 1206
 
1207 1207
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1208
-		$query  = $global_query." WHERE ".$additional_query." ";
1208
+		$query = $global_query." WHERE ".$additional_query." ";
1209 1209
 
1210
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1210
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1211 1211
 
1212 1212
 		return $spotter_array;
1213 1213
 	}
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 		{
1246 1246
 			$limit_array = explode(",", $limit);
1247 1247
 			
1248
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1249
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1248
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1249
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1250 1250
 			
1251 1251
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1252 1252
 			{
@@ -1300,8 +1300,8 @@  discard block
 block discarded – undo
1300 1300
 		{
1301 1301
 			$limit_array = explode(",", $limit);
1302 1302
 			
1303
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1304
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1303
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1304
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1305 1305
 			
1306 1306
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1307 1307
 			{
@@ -1350,8 +1350,8 @@  discard block
 block discarded – undo
1350 1350
 		{
1351 1351
 			$limit_array = explode(",", $limit);
1352 1352
 			
1353
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1354
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1353
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1354
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1355 1355
 			
1356 1356
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1357 1357
 			{
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 		$query_values = array();
1393 1393
 		$limit_query = '';
1394 1394
 		$additional_query = '';
1395
-		$filter_query = $this->getFilter($filter,true,true);
1395
+		$filter_query = $this->getFilter($filter, true, true);
1396 1396
 		
1397 1397
 		if ($aircraft_type != "")
1398 1398
 		{
@@ -1409,8 +1409,8 @@  discard block
 block discarded – undo
1409 1409
 		{
1410 1410
 			$limit_array = explode(",", $limit);
1411 1411
 			
1412
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1413
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1412
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1413
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1414 1414
 			
1415 1415
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1416 1416
 			{
@@ -1466,8 +1466,8 @@  discard block
 block discarded – undo
1466 1466
 		{
1467 1467
 			$limit_array = explode(",", $limit);
1468 1468
 			
1469
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1470
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1469
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1470
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1471 1471
 			
1472 1472
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1473 1473
 			{
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 		} else {
1484 1484
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1485 1485
 		}
1486
-		$filter_query = $this->getFilter($filter,true,true);
1486
+		$filter_query = $this->getFilter($filter, true, true);
1487 1487
 
1488 1488
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1489 1489
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 	* @return Array the spotter information
1503 1503
 	*
1504 1504
 	*/
1505
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1505
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1506 1506
 	{
1507 1507
 		global $global_query;
1508 1508
 		
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 		$query_values = array();
1512 1512
 		$limit_query = '';
1513 1513
 		$additional_query = '';
1514
-		$filter_query = $this->getFilter($filters,true,true);
1514
+		$filter_query = $this->getFilter($filters, true, true);
1515 1515
 		
1516 1516
 		if ($airline != "")
1517 1517
 		{
@@ -1528,8 +1528,8 @@  discard block
 block discarded – undo
1528 1528
 		{
1529 1529
 			$limit_array = explode(",", $limit);
1530 1530
 			
1531
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1532
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1531
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1532
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1533 1533
 			
1534 1534
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1535 1535
 			{
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 	* @return Array the spotter information
1560 1560
 	*
1561 1561
 	*/
1562
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1562
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1563 1563
 	{
1564 1564
 		global $global_query;
1565 1565
 		
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 		$query_values = array();
1568 1568
 		$limit_query = '';
1569 1569
 		$additional_query = '';
1570
-		$filter_query = $this->getFilter($filters,true,true);
1570
+		$filter_query = $this->getFilter($filters, true, true);
1571 1571
 		
1572 1572
 		if ($airport != "")
1573 1573
 		{
@@ -1584,8 +1584,8 @@  discard block
 block discarded – undo
1584 1584
 		{
1585 1585
 			$limit_array = explode(",", $limit);
1586 1586
 			
1587
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1588
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1587
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1588
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1589 1589
 			
1590 1590
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1591 1591
 			{
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 	* @return Array the spotter information
1618 1618
 	*
1619 1619
 	*/
1620
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1620
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1621 1621
 	{
1622 1622
 		global $global_query, $globalTimezone, $globalDBdriver;
1623 1623
 		
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 		$limit_query = '';
1626 1626
 		$additional_query = '';
1627 1627
 
1628
-		$filter_query = $this->getFilter($filter,true,true);
1628
+		$filter_query = $this->getFilter($filter, true, true);
1629 1629
 		
1630 1630
 		if ($date != "")
1631 1631
 		{
@@ -1654,8 +1654,8 @@  discard block
 block discarded – undo
1654 1654
 		{
1655 1655
 			$limit_array = explode(",", $limit);
1656 1656
 			
1657
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1658
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1657
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1658
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1659 1659
 			
1660 1660
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1661 1661
 			{
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 	* @return Array the spotter information
1686 1686
 	*
1687 1687
 	*/
1688
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1688
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1689 1689
 	{
1690 1690
 		global $global_query;
1691 1691
 		
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 		$query_values = array();
1695 1695
 		$limit_query = '';
1696 1696
 		$additional_query = '';
1697
-		$filter_query = $this->getFilter($filters,true,true);
1697
+		$filter_query = $this->getFilter($filters, true, true);
1698 1698
 		if ($country != "")
1699 1699
 		{
1700 1700
 			if (!is_string($country))
@@ -1711,8 +1711,8 @@  discard block
 block discarded – undo
1711 1711
 		{
1712 1712
 			$limit_array = explode(",", $limit);
1713 1713
 			
1714
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1715
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1714
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1715
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1716 1716
 			
1717 1717
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1718 1718
 			{
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 		$query_values = array();
1753 1753
 		$additional_query = '';
1754 1754
 		$limit_query = '';
1755
-		$filter_query = $this->getFilter($filters,true,true);
1755
+		$filter_query = $this->getFilter($filters, true, true);
1756 1756
 		
1757 1757
 		if ($aircraft_manufacturer != "")
1758 1758
 		{
@@ -1769,8 +1769,8 @@  discard block
 block discarded – undo
1769 1769
 		{
1770 1770
 			$limit_array = explode(",", $limit);
1771 1771
 			
1772
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1773
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1772
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1773
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1774 1774
 			
1775 1775
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1776 1776
 			{
@@ -1812,14 +1812,14 @@  discard block
 block discarded – undo
1812 1812
 		$query_values = array();
1813 1813
 		$additional_query = '';
1814 1814
 		$limit_query = '';
1815
-		$filter_query = $this->getFilter($filters,true,true);
1815
+		$filter_query = $this->getFilter($filters, true, true);
1816 1816
 		if ($departure_airport_icao != "")
1817 1817
 		{
1818 1818
 			if (!is_string($departure_airport_icao))
1819 1819
 			{
1820 1820
 				return false;
1821 1821
 			} else {
1822
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1822
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1823 1823
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1824 1824
 				//$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao";
1825 1825
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1832,10 +1832,10 @@  discard block
 block discarded – undo
1832 1832
 			{
1833 1833
 				return false;
1834 1834
 			} else {
1835
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1835
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1836 1836
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1837 1837
 				//$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)";
1838
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1838
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1839 1839
 			}
1840 1840
 		}
1841 1841
 		
@@ -1843,8 +1843,8 @@  discard block
 block discarded – undo
1843 1843
 		{
1844 1844
 			$limit_array = explode(",", $limit);
1845 1845
 			
1846
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1847
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1846
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1847
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1848 1848
 			
1849 1849
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1850 1850
 			{
@@ -1883,15 +1883,15 @@  discard block
 block discarded – undo
1883 1883
 		global $global_query;
1884 1884
 		
1885 1885
 		date_default_timezone_set('UTC');
1886
-		$filter_query = $this->getFilter($filter,true,true);
1886
+		$filter_query = $this->getFilter($filter, true, true);
1887 1887
 		$limit_query = '';
1888 1888
 		
1889 1889
 		if ($limit != "")
1890 1890
 		{
1891 1891
 			$limit_array = explode(",", $limit);
1892 1892
 			
1893
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1894
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1893
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1894
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1895 1895
 			
1896 1896
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1897 1897
 			{
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1909 1909
 		}
1910 1910
 
1911
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1911
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1912 1912
 
1913 1913
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1914 1914
 
@@ -1921,19 +1921,19 @@  discard block
 block discarded – undo
1921 1921
 	* @return String the highlight text
1922 1922
 	*
1923 1923
 	*/
1924
-	public function getHighlightByRegistration($registration,$filter = array())
1924
+	public function getHighlightByRegistration($registration, $filter = array())
1925 1925
 	{
1926 1926
 		global $global_query;
1927 1927
 		
1928 1928
 		date_default_timezone_set('UTC');
1929
-		$filter_query = $this->getFilter($filter,true,true);
1930
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1929
+		$filter_query = $this->getFilter($filter, true, true);
1930
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1931 1931
 		
1932
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1932
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1933 1933
 		$sth = $this->db->prepare($query);
1934 1934
 		$sth->execute(array(':registration' => $registration));
1935 1935
 
1936
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1936
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1937 1937
 		{
1938 1938
 			$highlight = $row['highlight'];
1939 1939
 		}
@@ -1949,14 +1949,14 @@  discard block
 block discarded – undo
1949 1949
 	* @return String usage
1950 1950
 	*
1951 1951
 	*/
1952
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1952
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1953 1953
 	{
1954 1954
 		
1955
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1956
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1955
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1956
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1957 1957
 
1958 1958
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1959
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1959
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1960 1960
 		
1961 1961
 		$sth = $this->db->prepare($query);
1962 1962
 		$sth->execute($query_values);
@@ -1978,9 +1978,9 @@  discard block
 block discarded – undo
1978 1978
 	public function getAirportIcao($airport_iata = '')
1979 1979
 	{
1980 1980
 		
1981
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1981
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1982 1982
 
1983
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1983
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1984 1984
 		$query_values = array(':airport' => $airport_iata);
1985 1985
 		
1986 1986
 		$sth = $this->db->prepare($query);
@@ -2002,12 +2002,12 @@  discard block
 block discarded – undo
2002 2002
 	* @return Float distance to the airport
2003 2003
 	*
2004 2004
 	*/
2005
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2005
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2006 2006
 	{
2007 2007
 		
2008
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2008
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2009 2009
 
2010
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2010
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2011 2011
 		$query_values = array(':airport' => $airport_icao);
2012 2012
 		$sth = $this->db->prepare($query);
2013 2013
 		$sth->execute($query_values);
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 			$airport_latitude = $row['latitude'];
2018 2018
 			$airport_longitude = $row['longitude'];
2019 2019
 			$Common = new Common();
2020
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2020
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2021 2021
 		} else return '';
2022 2022
 	}
2023 2023
 	
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 	public function getAllAirportInfo($airport = '')
2032 2032
 	{
2033 2033
 		
2034
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2034
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2035 2035
 
2036 2036
 		$query_values = array();
2037 2037
 		if ($airport == 'NA') {
2038
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
2038
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
2039 2039
 		} elseif ($airport == '') {
2040 2040
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
2041 2041
 		} else {
@@ -2083,14 +2083,14 @@  discard block
 block discarded – undo
2083 2083
 	{
2084 2084
 		$lst_countries = '';
2085 2085
 		foreach ($countries as $country) {
2086
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2086
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2087 2087
 			if ($lst_countries == '') {
2088 2088
 				$lst_countries = "'".$country."'";
2089 2089
 			} else {
2090 2090
 				$lst_countries .= ",'".$country."'";
2091 2091
 			}
2092 2092
 		}
2093
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2093
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2094 2094
 		
2095 2095
 		$sth = $this->db->prepare($query);
2096 2096
 		$sth->execute();
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 		$airport_array = array();
2099 2099
 		$temp_array = array();
2100 2100
 		
2101
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2101
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2102 2102
 		{
2103 2103
 			$temp_array['name'] = $row['name'];
2104 2104
 			$temp_array['city'] = $row['city'];
@@ -2126,10 +2126,10 @@  discard block
 block discarded – undo
2126 2126
 	{
2127 2127
 		global $globalDBdriver;
2128 2128
 		if (is_array($coord)) {
2129
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2130
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2131
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2132
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2129
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2130
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2131
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2132
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2133 2133
 		} else return array();
2134 2134
 		if ($globalDBdriver == 'mysql') {
2135 2135
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
     
2142 2142
 		$airport_array = array();
2143 2143
 		
2144
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2144
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2145 2145
 		{
2146 2146
 			$temp_array = $row;
2147 2147
 
@@ -2161,13 +2161,13 @@  discard block
 block discarded – undo
2161 2161
 	public function getAllWaypointsInfobyCoord($coord)
2162 2162
 	{
2163 2163
 		if (is_array($coord)) {
2164
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2165
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2166
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2167
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2164
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2165
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2166
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2167
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2168 2168
 		} else return array();
2169 2169
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2170
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2170
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2171 2171
 		//$query  = "SELECT waypoints.* FROM waypoints";
2172 2172
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
2173 2173
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -2179,7 +2179,7 @@  discard block
 block discarded – undo
2179 2179
     
2180 2180
 		$waypoints_array = array();
2181 2181
 		
2182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2183 2183
 		{
2184 2184
 			$temp_array = $row;
2185 2185
 
@@ -2201,10 +2201,10 @@  discard block
 block discarded – undo
2201 2201
 	{
2202 2202
 		global $globalUseRealAirlines;
2203 2203
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2204
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2204
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2205 2205
 		if ($airline_icao == 'NA') {
2206 2206
 			$airline_array = array();
2207
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2207
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2208 2208
 			return $airline_array;
2209 2209
 		} else {
2210 2210
 			if (strlen($airline_icao) == 2) {
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
 			if ($fromsource === NULL) {
2226 2226
 				$sth->execute(array(':airline_icao' => $airline_icao));
2227 2227
 			} else {
2228
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2228
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2229 2229
 			}
2230 2230
                         /*
2231 2231
 			$airline_array = array();
@@ -2270,13 +2270,13 @@  discard block
 block discarded – undo
2270 2270
 	{
2271 2271
 		global $globalUseRealAirlines;
2272 2272
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2273
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2274
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2273
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2274
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2275 2275
 		$sth = $this->db->prepare($query);
2276 2276
 		if ($fromsource === NULL) {
2277 2277
 			$sth->execute(array(':airline_name' => $airline_name));
2278 2278
 		} else {
2279
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2279
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2280 2280
 		}
2281 2281
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2282 2282
 		if (empty($result) && $fromsource !== NULL) {
@@ -2301,12 +2301,12 @@  discard block
 block discarded – undo
2301 2301
 	*/
2302 2302
 	public function getAllAircraftInfo($aircraft_type)
2303 2303
 	{
2304
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2304
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2305 2305
 
2306 2306
 		if ($aircraft_type == 'NA') {
2307
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2307
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2308 2308
 		}
2309
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2309
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2310 2310
 		
2311 2311
 		$sth = $this->db->prepare($query);
2312 2312
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 	*/
2339 2339
 	public function getAircraftIcao($aircraft_type)
2340 2340
 	{
2341
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2341
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2342 2342
 		$all_aircraft = array('737-300' => 'B733',
2343 2343
 				'777-200' => 'B772',
2344 2344
 				'777-200ER' => 'B772',
@@ -2350,10 +2350,10 @@  discard block
 block discarded – undo
2350 2350
 				'A380' => 'A388');
2351 2351
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2352 2352
 
2353
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2353
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2354 2354
 		$aircraft_type = strtoupper($aircraft_type);
2355 2355
 		$sth = $this->db->prepare($query);
2356
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2356
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2357 2357
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2358 2358
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2359 2359
 		else return '';
@@ -2368,9 +2368,9 @@  discard block
 block discarded – undo
2368 2368
 	*/
2369 2369
 	public function getAllAircraftType($aircraft_modes)
2370 2370
 	{
2371
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2371
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2372 2372
 
2373
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2373
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2374 2374
 		
2375 2375
 		$sth = $this->db->prepare($query);
2376 2376
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2393,9 +2393,9 @@  discard block
 block discarded – undo
2393 2393
 	*/
2394 2394
 	public function getAllAircraftTypeByRegistration($registration)
2395 2395
 	{
2396
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2396
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2397 2397
 
2398
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2398
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2399 2399
 		
2400 2400
 		$sth = $this->db->prepare($query);
2401 2401
 		$sth->execute(array(':registration' => $registration));
@@ -2416,9 +2416,9 @@  discard block
 block discarded – undo
2416 2416
 	*/
2417 2417
 	public function getAllIDByRegistration($registration)
2418 2418
 	{
2419
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2419
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2420 2420
 
2421
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2421
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2422 2422
 		
2423 2423
 		$sth = $this->db->prepare($query);
2424 2424
 		$sth->execute(array(':registration' => $registration));
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
 		$idarray = array();
2427 2427
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2428 2428
 			$date = $row['date'];
2429
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2429
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2430 2430
 		}
2431 2431
 		return $idarray;
2432 2432
 	}
@@ -2440,8 +2440,8 @@  discard block
 block discarded – undo
2440 2440
 	*/
2441 2441
 	public function getOperator($operator)
2442 2442
 	{
2443
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2444
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2443
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2444
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2445 2445
 		
2446 2446
 		$sth = $this->db->prepare($query);
2447 2447
 		$sth->execute(array(':operator' => $operator));
@@ -2462,9 +2462,9 @@  discard block
 block discarded – undo
2462 2462
 	*/
2463 2463
 	public function getRouteInfo($callsign)
2464 2464
 	{
2465
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2465
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2466 2466
                 if ($callsign == '') return array();
2467
-		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2467
+		$query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2468 2468
 		
2469 2469
 		$sth = $this->db->prepare($query);
2470 2470
 		$sth->execute(array(':callsign' => $callsign));
@@ -2485,9 +2485,9 @@  discard block
 block discarded – undo
2485 2485
 	*/
2486 2486
 	public function getAircraftInfoByRegistration($registration)
2487 2487
 	{
2488
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2488
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2489 2489
 
2490
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2490
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2491 2491
 		
2492 2492
 		$sth = $this->db->prepare($query);
2493 2493
 		$sth->execute(array(':registration' => $registration));
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
 		$aircraft_array = array();
2496 2496
 		$temp_array = array();
2497 2497
 		
2498
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2498
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2499 2499
 		{
2500 2500
 			$temp_array['airline_icao'] = $row['airline_icao'];
2501 2501
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 	*/
2518 2518
 	public function getAircraftOwnerByRegistration($registration)
2519 2519
 	{
2520
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2520
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2521 2521
 		$Connection = new Connection($this->db);
2522 2522
 		if ($Connection->tableExists('aircraft_owner')) {
2523 2523
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
 	public function getAllFlightsforSitemap()
2540 2540
 	{
2541 2541
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2542
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2542
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2543 2543
 		
2544 2544
 		$sth = $this->db->prepare($query);
2545 2545
 		$sth->execute();
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
 		$manufacturer_array = array();
2587 2587
 		$temp_array = array();
2588 2588
 		
2589
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2589
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2590 2590
 		{
2591 2591
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2592 2592
 
@@ -2623,7 +2623,7 @@  discard block
 block discarded – undo
2623 2623
 		$aircraft_array = array();
2624 2624
 		$temp_array = array();
2625 2625
 		
2626
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2626
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2627 2627
 		{
2628 2628
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2629 2629
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2644,8 +2644,8 @@  discard block
 block discarded – undo
2644 2644
 	*/
2645 2645
 	public function getAllAircraftRegistrations($filters = array())
2646 2646
 	{
2647
-		$filter_query = $this->getFilter($filters,true,true);
2648
-		$query  = "SELECT DISTINCT spotter_output.registration 
2647
+		$filter_query = $this->getFilter($filters, true, true);
2648
+		$query = "SELECT DISTINCT spotter_output.registration 
2649 2649
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2650 2650
 				ORDER BY spotter_output.registration ASC";
2651 2651
 
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
 		$aircraft_array = array();
2656 2656
 		$temp_array = array();
2657 2657
 		
2658
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2658
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2659 2659
 		{
2660 2660
 			$temp_array['registration'] = $row['registration'];
2661 2661
 
@@ -2672,11 +2672,11 @@  discard block
 block discarded – undo
2672 2672
 	* @return Array list of source name
2673 2673
 	*
2674 2674
 	*/
2675
-	public function getAllSourceName($type = '',$filters = array())
2675
+	public function getAllSourceName($type = '', $filters = array())
2676 2676
 	{
2677
-		$filter_query = $this->getFilter($filters,true,true);
2677
+		$filter_query = $this->getFilter($filters, true, true);
2678 2678
 		$query_values = array();
2679
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2679
+		$query = "SELECT DISTINCT spotter_output.source_name 
2680 2680
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2681 2681
 		if ($type != '') {
2682 2682
 			$query_values = array(':type' => $type);
@@ -2691,7 +2691,7 @@  discard block
 block discarded – undo
2691 2691
 		$source_array = array();
2692 2692
 		$temp_array = array();
2693 2693
 		
2694
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2694
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2695 2695
 		{
2696 2696
 			$temp_array['source_name'] = $row['source_name'];
2697 2697
 			$source_array[] = $temp_array;
@@ -2707,11 +2707,11 @@  discard block
 block discarded – undo
2707 2707
 	* @return Array list of airline names
2708 2708
 	*
2709 2709
 	*/
2710
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2710
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2711 2711
 	{
2712
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2713
-		$filter_query = $this->getFilter($filters,true,true);
2714
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2712
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2713
+		$filter_query = $this->getFilter($filters, true, true);
2714
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2715 2715
 		if ($airline_type == '' || $airline_type == 'all') {
2716 2716
 			/*
2717 2717
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2730,7 +2730,7 @@  discard block
 block discarded – undo
2730 2730
 				$query_data = array(':forsource' => $forsource);
2731 2731
 			}
2732 2732
 		} else {
2733
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2733
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2734 2734
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2735 2735
 					AND spotter_output.airline_type = :airline_type 
2736 2736
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
 		$airline_array = array();
2744 2744
 		$temp_array = array();
2745 2745
 		
2746
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2746
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2747 2747
 		{
2748 2748
 			$temp_array['airline_icao'] = $row['airline_icao'];
2749 2749
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2760,10 +2760,10 @@  discard block
 block discarded – undo
2760 2760
 	* @return Array list of alliance names
2761 2761
 	*
2762 2762
 	*/
2763
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2763
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2764 2764
 	{
2765
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766
-		$filter_query = $this->getFilter($filters,true,true);
2765
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2766
+		$filter_query = $this->getFilter($filters, true, true);
2767 2767
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2768 2768
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2769 2769
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2791,8 +2791,8 @@  discard block
 block discarded – undo
2791 2791
 	*/
2792 2792
 	public function getAllAirlineCountries($filters = array())
2793 2793
 	{
2794
-		$filter_query = $this->getFilter($filters,true,true);
2795
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2794
+		$filter_query = $this->getFilter($filters, true, true);
2795
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2796 2796
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2797 2797
 				ORDER BY spotter_output.airline_country ASC";
2798 2798
 		
@@ -2803,7 +2803,7 @@  discard block
 block discarded – undo
2803 2803
 		$airline_array = array();
2804 2804
 		$temp_array = array();
2805 2805
 		
2806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2807 2807
 		{
2808 2808
 			$temp_array['airline_country'] = $row['airline_country'];
2809 2809
 
@@ -2823,9 +2823,9 @@  discard block
 block discarded – undo
2823 2823
 	*/
2824 2824
 	public function getAllAirportNames($filters = array())
2825 2825
 	{
2826
-		$filter_query = $this->getFilter($filters,true,true);
2826
+		$filter_query = $this->getFilter($filters, true, true);
2827 2827
 		$airport_array = array();
2828
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2828
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2829 2829
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2830 2830
 				ORDER BY spotter_output.departure_airport_city ASC";
2831 2831
 		
@@ -2834,7 +2834,7 @@  discard block
 block discarded – undo
2834 2834
 		$sth->execute();
2835 2835
 
2836 2836
 		$temp_array = array();
2837
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2837
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2838 2838
 		{
2839 2839
 			$temp_array['airport_icao'] = $row['airport_icao'];
2840 2840
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2844,14 +2844,14 @@  discard block
 block discarded – undo
2844 2844
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2845 2845
 		}
2846 2846
 
2847
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2847
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2848 2848
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2849 2849
 								ORDER BY spotter_output.arrival_airport_city ASC";
2850 2850
 					
2851 2851
 		$sth = $this->db->prepare($query);
2852 2852
 		$sth->execute();
2853 2853
 
2854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2855 2855
 			{
2856 2856
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2857 2857
 		//	{
@@ -2875,8 +2875,8 @@  discard block
 block discarded – undo
2875 2875
 	*/
2876 2876
 	public function getAllOwnerNames($filters = array())
2877 2877
 	{
2878
-		$filter_query = $this->getFilter($filters,true,true);
2879
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2878
+		$filter_query = $this->getFilter($filters, true, true);
2879
+		$query = "SELECT DISTINCT spotter_output.owner_name
2880 2880
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2881 2881
 				ORDER BY spotter_output.owner_name ASC";
2882 2882
 		
@@ -2893,8 +2893,8 @@  discard block
 block discarded – undo
2893 2893
 	*/
2894 2894
 	public function getAllPilotNames($filters = array())
2895 2895
 	{
2896
-		$filter_query = $this->getFilter($filters,true,true);
2897
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2896
+		$filter_query = $this->getFilter($filters, true, true);
2897
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2898 2898
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2899 2899
 				ORDER BY spotter_output.pilot_name ASC";
2900 2900
 		
@@ -2927,21 +2927,21 @@  discard block
 block discarded – undo
2927 2927
    
2928 2928
 		$temp_array = array();
2929 2929
 		
2930
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2930
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2931 2931
 		{
2932 2932
 			$temp_array['airport_country'] = $row['airport_country'];
2933 2933
 
2934 2934
 			$airport_array[$row['airport_country']] = $temp_array;
2935 2935
 		}
2936
-		$filter_query = $this->getFilter($filters,true,true);
2937
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2936
+		$filter_query = $this->getFilter($filters, true, true);
2937
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2938 2938
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2939 2939
 								ORDER BY spotter_output.arrival_airport_country ASC";
2940 2940
 					
2941 2941
 		$sth = $this->db->prepare($query);
2942 2942
 		$sth->execute();
2943 2943
 		
2944
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2944
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2945 2945
 		{
2946 2946
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2947 2947
 			{
@@ -2964,9 +2964,9 @@  discard block
 block discarded – undo
2964 2964
 	*/
2965 2965
 	public function getAllCountries($filters = array())
2966 2966
 	{
2967
-		$Connection= new Connection($this->db);
2967
+		$Connection = new Connection($this->db);
2968 2968
 		if ($Connection->tableExists('countries')) {
2969
-			$query  = "SELECT countries.name AS airport_country
2969
+			$query = "SELECT countries.name AS airport_country
2970 2970
 				FROM countries
2971 2971
 				ORDER BY countries.name ASC";
2972 2972
 			$sth = $this->db->prepare($query);
@@ -2975,14 +2975,14 @@  discard block
 block discarded – undo
2975 2975
 			$temp_array = array();
2976 2976
 			$country_array = array();
2977 2977
 		
2978
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2978
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2979 2979
 			{
2980 2980
 				$temp_array['country'] = $row['airport_country'];
2981 2981
 				$country_array[$row['airport_country']] = $temp_array;
2982 2982
 			}
2983 2983
 		} else {
2984
-			$filter_query = $this->getFilter($filters,true,true);
2985
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2984
+			$filter_query = $this->getFilter($filters, true, true);
2985
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2986 2986
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2987 2987
 								ORDER BY spotter_output.departure_airport_country ASC";
2988 2988
 
@@ -2991,20 +2991,20 @@  discard block
 block discarded – undo
2991 2991
    
2992 2992
 			$temp_array = array();
2993 2993
 			$country_array = array();
2994
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2994
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2995 2995
 			{
2996 2996
 				$temp_array['country'] = $row['airport_country'];
2997 2997
 				$country_array[$row['airport_country']] = $temp_array;
2998 2998
 			}
2999 2999
 
3000
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3000
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3001 3001
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3002 3002
 								ORDER BY spotter_output.arrival_airport_country ASC";
3003 3003
 					
3004 3004
 		$sth = $this->db->prepare($query);
3005 3005
 		$sth->execute();
3006 3006
 		
3007
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3007
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3008 3008
 		{
3009 3009
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3010 3010
 			{
@@ -3014,14 +3014,14 @@  discard block
 block discarded – undo
3014 3014
 			}
3015 3015
 		}
3016 3016
 		
3017
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3017
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3018 3018
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3019 3019
 								ORDER BY spotter_output.airline_country ASC";
3020 3020
 					
3021 3021
 		$sth = $this->db->prepare($query);
3022 3022
 		$sth->execute();
3023 3023
 		
3024
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3024
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3025 3025
 		{
3026 3026
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3027 3027
 			{
@@ -3045,8 +3045,8 @@  discard block
 block discarded – undo
3045 3045
 	*/
3046 3046
 	public function getAllIdents($filters = array())
3047 3047
 	{
3048
-		$filter_query = $this->getFilter($filters,true,true);
3049
-		$query  = "SELECT DISTINCT spotter_output.ident
3048
+		$filter_query = $this->getFilter($filters, true, true);
3049
+		$query = "SELECT DISTINCT spotter_output.ident
3050 3050
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3051 3051
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3052 3052
 
@@ -3056,7 +3056,7 @@  discard block
 block discarded – undo
3056 3056
 		$ident_array = array();
3057 3057
 		$temp_array = array();
3058 3058
 		
3059
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3059
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3060 3060
 		{
3061 3061
 			$temp_array['ident'] = $row['ident'];
3062 3062
 			$ident_array[] = $temp_array;
@@ -3070,9 +3070,9 @@  discard block
 block discarded – undo
3070 3070
 	* @return Array number, icao, name and city of airports
3071 3071
 	*/
3072 3072
 
3073
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3073
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3074 3074
 		global $globalTimezone, $globalDBdriver;
3075
-		$filter_query = $this->getFilter($filters,true,true);
3075
+		$filter_query = $this->getFilter($filters, true, true);
3076 3076
 		if ($globalTimezone != '') {
3077 3077
 			date_default_timezone_set($globalTimezone);
3078 3078
 			$datetime = new DateTime();
@@ -3137,7 +3137,7 @@  discard block
 block discarded – undo
3137 3137
 
3138 3138
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3139 3139
 		global $globalTimezone, $globalDBdriver;
3140
-		$filter_query = $this->getFilter($filters,true,true);
3140
+		$filter_query = $this->getFilter($filters, true, true);
3141 3141
 		if ($globalTimezone != '') {
3142 3142
 			date_default_timezone_set($globalTimezone);
3143 3143
 			$datetime = new DateTime();
@@ -3221,7 +3221,7 @@  discard block
 block discarded – undo
3221 3221
 
3222 3222
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3223 3223
 		global $globalTimezone, $globalDBdriver;
3224
-		$filter_query = $this->getFilter($filters,true,true);
3224
+		$filter_query = $this->getFilter($filters, true, true);
3225 3225
 		if ($globalTimezone != '') {
3226 3226
 			date_default_timezone_set($globalTimezone);
3227 3227
 			$datetime = new DateTime();
@@ -3254,9 +3254,9 @@  discard block
 block discarded – undo
3254 3254
 	* @return Array number, icao, name and city of airports
3255 3255
 	*/
3256 3256
 
3257
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3257
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3258 3258
 		global $globalTimezone, $globalDBdriver;
3259
-		$filter_query = $this->getFilter($filters,true,true);
3259
+		$filter_query = $this->getFilter($filters, true, true);
3260 3260
 		if ($globalTimezone != '') {
3261 3261
 			date_default_timezone_set($globalTimezone);
3262 3262
 			$datetime = new DateTime();
@@ -3388,12 +3388,12 @@  discard block
 block discarded – undo
3388 3388
 		} else $offset = '+00:00';
3389 3389
 
3390 3390
 		if ($globalDBdriver == 'mysql') {
3391
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3391
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3392 3392
 								FROM spotter_output
3393 3393
 								WHERE spotter_output.date <> '' 
3394 3394
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3395 3395
 		} else {
3396
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3396
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3397 3397
 								FROM spotter_output
3398 3398
 								WHERE spotter_output.date <> '' 
3399 3399
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3405,7 +3405,7 @@  discard block
 block discarded – undo
3405 3405
 		$date_array = array();
3406 3406
 		$temp_array = array();
3407 3407
 		
3408
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3408
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3409 3409
 		{
3410 3410
 			$temp_array['date'] = $row['date'];
3411 3411
 
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
 	*/
3426 3426
 	public function getAllRoutes()
3427 3427
 	{
3428
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3428
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3429 3429
 				FROM spotter_output
3430 3430
 				WHERE spotter_output.ident <> '' 
3431 3431
 				GROUP BY route
@@ -3436,7 +3436,7 @@  discard block
 block discarded – undo
3436 3436
 
3437 3437
 		$routes_array = array();
3438 3438
 		$temp_array = array();
3439
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3439
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3440 3440
 		{
3441 3441
 			$temp_array['route'] = $row['route'];
3442 3442
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3455,21 +3455,21 @@  discard block
 block discarded – undo
3455 3455
 	* @return String success or false
3456 3456
 	*
3457 3457
 	*/	
3458
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3458
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3459 3459
 	{
3460 3460
 		if (!is_numeric(substr($ident, 0, 3)))
3461 3461
 		{
3462 3462
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3463
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3463
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3464 3464
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3465
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3465
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3466 3466
 			} else {
3467 3467
 				$airline_array = $this->getAllAirlineInfo("NA");
3468 3468
 			}
3469 3469
 			if (count($airline_array) == 0) {
3470 3470
 				$airline_array = $this->getAllAirlineInfo("NA");
3471 3471
 			}
3472
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3472
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3473 3473
 				$airline_array = $this->getAllAirlineInfo("NA");
3474 3474
 			}
3475 3475
 		} else {
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
 
3483 3483
 
3484 3484
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3485
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3485
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type);
3486 3486
 
3487 3487
 		try {
3488 3488
 			$sth = $this->db->prepare($query);
@@ -3503,11 +3503,11 @@  discard block
 block discarded – undo
3503 3503
 	* @return String success or false
3504 3504
 	*
3505 3505
 	*/	
3506
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3506
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3507 3507
 	{
3508 3508
 		if ($groundspeed == '') $groundspeed = NULL;
3509 3509
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3510
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3510
+                $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3511 3511
 
3512 3512
 		try {
3513 3513
 			$sth = $this->db->prepare($query);
@@ -3547,7 +3547,7 @@  discard block
 block discarded – undo
3547 3547
 	* @param String $verticalrate vertival rate of flight
3548 3548
 	* @return String success or false
3549 3549
 	*/
3550
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3550
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '')
3551 3551
 	{
3552 3552
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3553 3553
 		
@@ -3571,13 +3571,13 @@  discard block
 block discarded – undo
3571 3571
 				if ($ModeS != '') {
3572 3572
 					$timeelapsed = microtime(true);
3573 3573
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3574
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3574
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3575 3575
 				} else {
3576
-					$myhex = explode('-',$flightaware_id);
3576
+					$myhex = explode('-', $flightaware_id);
3577 3577
 					if (count($myhex) > 0) {
3578 3578
 						$timeelapsed = microtime(true);
3579 3579
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3580
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3580
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3581 3581
 					}
3582 3582
 				}
3583 3583
 			}
@@ -3599,24 +3599,24 @@  discard block
 block discarded – undo
3599 3599
 				{
3600 3600
 					$timeelapsed = microtime(true);
3601 3601
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3602
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3602
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3603 3603
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3604
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3604
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3605 3605
 					} else {
3606 3606
 						$airline_array = $this->getAllAirlineInfo("NA");
3607 3607
 					}
3608 3608
 					if (count($airline_array) == 0) {
3609 3609
 						$airline_array = $this->getAllAirlineInfo("NA");
3610 3610
 					}
3611
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3611
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3612 3612
 						$airline_array = $this->getAllAirlineInfo("NA");
3613 3613
 					}
3614
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3614
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3615 3615
 
3616 3616
 				} else {
3617 3617
 					$timeelapsed = microtime(true);
3618 3618
 					$airline_array = $this->getAllAirlineInfo("NA");
3619
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3619
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3620 3620
 				}
3621 3621
 			}
3622 3622
 		} else $airline_array = array();
@@ -3633,27 +3633,27 @@  discard block
 block discarded – undo
3633 3633
 				{
3634 3634
 					$timeelapsed = microtime(true);
3635 3635
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3636
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3636
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3637 3637
 				} else {
3638 3638
 					$timeelapsed = microtime(true);
3639 3639
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3640
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3640
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3641 3641
 				}
3642 3642
 			}
3643 3643
 		} else {
3644 3644
 			if ($ModeS != '') {
3645 3645
 				$timeelapsed = microtime(true);
3646 3646
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3647
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3647
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3648 3648
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3649 3649
 				{
3650 3650
 					$timeelapsed = microtime(true);
3651 3651
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3652
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3652
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3653 3653
 				} else {
3654 3654
 					$timeelapsed = microtime(true);
3655 3655
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3656
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3656
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3657 3657
 				}
3658 3658
 			}
3659 3659
 		}
@@ -3669,7 +3669,7 @@  discard block
 block discarded – undo
3669 3669
 			} else {
3670 3670
 				$timeelapsed = microtime(true);
3671 3671
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3672
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3672
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3673 3673
 			}
3674 3674
 		}
3675 3675
 		
@@ -3684,7 +3684,7 @@  discard block
 block discarded – undo
3684 3684
 			} else {
3685 3685
 				$timeelapsed = microtime(true);
3686 3686
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3687
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3687
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3688 3688
 			}
3689 3689
 		}
3690 3690
 
@@ -3747,7 +3747,7 @@  discard block
 block discarded – undo
3747 3747
 		{
3748 3748
 			$timeelapsed = microtime(true);
3749 3749
 			$image_array = $Image->getSpotterImage($registration);
3750
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3750
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3751 3751
 			if (!isset($image_array[0]['registration']))
3752 3752
 			{
3753 3753
 				//echo "Add image !!!! \n";
@@ -3755,7 +3755,7 @@  discard block
 block discarded – undo
3755 3755
 			}
3756 3756
 			$timeelapsed = microtime(true);
3757 3757
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3758
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3758
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3759 3759
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3760 3760
 		}
3761 3761
     
@@ -3763,33 +3763,33 @@  discard block
 block discarded – undo
3763 3763
 		{
3764 3764
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3765 3765
             		else $airline_icao = '';
3766
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3766
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3767 3767
 			if (!isset($image_array[0]['registration']))
3768 3768
 			{
3769 3769
 				//echo "Add image !!!! \n";
3770
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3770
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3771 3771
 			}
3772 3772
 		}
3773 3773
     
3774
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3775
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3776
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3777
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3778
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3779
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3780
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3781
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3782
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3783
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3784
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3785
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3786
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3787
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3788
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3789
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3790
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3791
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3792
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3774
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3775
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3776
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3777
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3778
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3779
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3780
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3781
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3782
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3783
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3784
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3785
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3786
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3787
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3788
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3789
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3790
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3791
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3792
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3793 3793
 	
3794 3794
 		if (count($airline_array) == 0) 
3795 3795
 		{
@@ -3817,7 +3817,7 @@  discard block
 block discarded – undo
3817 3817
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3818 3818
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3819 3819
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3820
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3820
+                $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3821 3821
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3822 3822
 
3823 3823
                 $airline_name = $airline_array[0]['name'];
@@ -3827,7 +3827,7 @@  discard block
 block discarded – undo
3827 3827
 		if ($airline_type == '') {
3828 3828
 			$timeelapsed = microtime(true);
3829 3829
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3830
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3830
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3831 3831
 		}
3832 3832
 		if ($airline_type == null) $airline_type = '';
3833 3833
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3839,7 +3839,7 @@  discard block
 block discarded – undo
3839 3839
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3840 3840
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3841 3841
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3842
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3842
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3843 3843
 
3844 3844
 		try {
3845 3845
 		        
@@ -3865,13 +3865,13 @@  discard block
 block discarded – undo
3865 3865
 	{
3866 3866
 		global $globalDBdriver, $globalTimezone;
3867 3867
 		if ($globalDBdriver == 'mysql') {
3868
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3868
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3869 3869
 								WHERE spotter_output.ident = :ident 
3870 3870
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3871 3871
 								AND spotter_output.date < UTC_TIMESTAMP()";
3872 3872
 			$query_data = array(':ident' => $ident);
3873 3873
 		} else {
3874
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3874
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3875 3875
 								WHERE spotter_output.ident = :ident 
3876 3876
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3877 3877
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3880,8 +3880,8 @@  discard block
 block discarded – undo
3880 3880
 		
3881 3881
 		$sth = $this->db->prepare($query);
3882 3882
 		$sth->execute($query_data);
3883
-    		$ident_result='';
3884
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3883
+    		$ident_result = '';
3884
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3885 3885
 		{
3886 3886
 			$ident_result = $row['ident'];
3887 3887
 		}
@@ -3907,8 +3907,8 @@  discard block
 block discarded – undo
3907 3907
 				return false;
3908 3908
 			} else {
3909 3909
 				$q_array = explode(" ", $q);
3910
-				foreach ($q_array as $q_item){
3911
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3910
+				foreach ($q_array as $q_item) {
3911
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3912 3912
 					$additional_query .= " AND (";
3913 3913
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3914 3914
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3923,11 +3923,11 @@  discard block
 block discarded – undo
3923 3923
 			}
3924 3924
 		}
3925 3925
 		if ($globalDBdriver == 'mysql') {
3926
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3926
+			$query = "SELECT spotter_output.* FROM spotter_output 
3927 3927
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3928 3928
 				AND spotter_output.date < UTC_TIMESTAMP()";
3929 3929
 		} else {
3930
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3930
+			$query = "SELECT spotter_output.* FROM spotter_output 
3931 3931
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3932 3932
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3933 3933
 		}
@@ -3944,11 +3944,11 @@  discard block
 block discarded – undo
3944 3944
 	* @return Array the airline list
3945 3945
 	*
3946 3946
 	*/
3947
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3947
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3948 3948
 	{
3949 3949
 		global $globalDBdriver;
3950
-		$filter_query = $this->getFilter($filters,true,true);
3951
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3950
+		$filter_query = $this->getFilter($filters, true, true);
3951
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3952 3952
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
3953 3953
 		if ($olderthanmonths > 0) {
3954 3954
 			if ($globalDBdriver == 'mysql') {
@@ -3968,28 +3968,28 @@  discard block
 block discarded – undo
3968 3968
 		if ($year != '') {
3969 3969
 			if ($globalDBdriver == 'mysql') {
3970 3970
 				$query .= " AND YEAR(spotter_output.date) = :year";
3971
-				$query_values = array_merge($query_values,array(':year' => $year));
3971
+				$query_values = array_merge($query_values, array(':year' => $year));
3972 3972
 			} else {
3973 3973
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
3974
-				$query_values = array_merge($query_values,array(':year' => $year));
3974
+				$query_values = array_merge($query_values, array(':year' => $year));
3975 3975
 			}
3976 3976
 		}
3977 3977
 		if ($month != '') {
3978 3978
 			if ($globalDBdriver == 'mysql') {
3979 3979
 				$query .= " AND MONTH(spotter_output.date) = :month";
3980
-				$query_values = array_merge($query_values,array(':month' => $month));
3980
+				$query_values = array_merge($query_values, array(':month' => $month));
3981 3981
 			} else {
3982 3982
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
3983
-				$query_values = array_merge($query_values,array(':month' => $month));
3983
+				$query_values = array_merge($query_values, array(':month' => $month));
3984 3984
 			}
3985 3985
 		}
3986 3986
 		if ($day != '') {
3987 3987
 			if ($globalDBdriver == 'mysql') {
3988 3988
 				$query .= " AND DAY(spotter_output.date) = :day";
3989
-				$query_values = array_merge($query_values,array(':day' => $day));
3989
+				$query_values = array_merge($query_values, array(':day' => $day));
3990 3990
 			} else {
3991 3991
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
3992
-				$query_values = array_merge($query_values,array(':day' => $day));
3992
+				$query_values = array_merge($query_values, array(':day' => $day));
3993 3993
 			}
3994 3994
 		}
3995 3995
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -3999,7 +3999,7 @@  discard block
 block discarded – undo
3999 3999
 		$sth->execute($query_values);
4000 4000
 		$airline_array = array();
4001 4001
 		$temp_array = array();
4002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4003 4003
 		{
4004 4004
 			$temp_array['airline_name'] = $row['airline_name'];
4005 4005
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4016,11 +4016,11 @@  discard block
 block discarded – undo
4016 4016
 	* @return Array the pilots list
4017 4017
 	*
4018 4018
 	*/
4019
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4019
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4020 4020
 	{
4021 4021
 		global $globalDBdriver;
4022
-		$filter_query = $this->getFilter($filters,true,true);
4023
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4022
+		$filter_query = $this->getFilter($filters, true, true);
4023
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4024 4024
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
4025 4025
                 if ($olderthanmonths > 0) {
4026 4026
             		if ($globalDBdriver == 'mysql') {
@@ -4040,28 +4040,28 @@  discard block
 block discarded – undo
4040 4040
 		if ($year != '') {
4041 4041
 			if ($globalDBdriver == 'mysql') {
4042 4042
 				$query .= " AND YEAR(spotter_output.date) = :year";
4043
-				$query_values = array_merge($query_values,array(':year' => $year));
4043
+				$query_values = array_merge($query_values, array(':year' => $year));
4044 4044
 			} else {
4045 4045
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4046
-				$query_values = array_merge($query_values,array(':year' => $year));
4046
+				$query_values = array_merge($query_values, array(':year' => $year));
4047 4047
 			}
4048 4048
 		}
4049 4049
 		if ($month != '') {
4050 4050
 			if ($globalDBdriver == 'mysql') {
4051 4051
 				$query .= " AND MONTH(spotter_output.date) = :month";
4052
-				$query_values = array_merge($query_values,array(':month' => $month));
4052
+				$query_values = array_merge($query_values, array(':month' => $month));
4053 4053
 			} else {
4054 4054
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4055
-				$query_values = array_merge($query_values,array(':month' => $month));
4055
+				$query_values = array_merge($query_values, array(':month' => $month));
4056 4056
 			}
4057 4057
 		}
4058 4058
 		if ($day != '') {
4059 4059
 			if ($globalDBdriver == 'mysql') {
4060 4060
 				$query .= " AND DAY(spotter_output.date) = :day";
4061
-				$query_values = array_merge($query_values,array(':day' => $day));
4061
+				$query_values = array_merge($query_values, array(':day' => $day));
4062 4062
 			} else {
4063 4063
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4064
-				$query_values = array_merge($query_values,array(':day' => $day));
4064
+				$query_values = array_merge($query_values, array(':day' => $day));
4065 4065
 			}
4066 4066
 		}
4067 4067
 		
@@ -4073,7 +4073,7 @@  discard block
 block discarded – undo
4073 4073
 		$sth->execute($query_values);
4074 4074
 		$airline_array = array();
4075 4075
 		$temp_array = array();
4076
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4076
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4077 4077
 		{
4078 4078
 			$temp_array['pilot_name'] = $row['pilot_name'];
4079 4079
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4093,7 +4093,7 @@  discard block
 block discarded – undo
4093 4093
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4094 4094
 	{
4095 4095
 		global $globalDBdriver;
4096
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4096
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4097 4097
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4098 4098
                 if ($olderthanmonths > 0) {
4099 4099
             		if ($globalDBdriver == 'mysql') {
@@ -4119,7 +4119,7 @@  discard block
 block discarded – undo
4119 4119
 		$airline_array = array();
4120 4120
 		$temp_array = array();
4121 4121
         
4122
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4122
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4123 4123
 		{
4124 4124
 			$temp_array['pilot_name'] = $row['pilot_name'];
4125 4125
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4137,11 +4137,11 @@  discard block
 block discarded – undo
4137 4137
 	* @return Array the pilots list
4138 4138
 	*
4139 4139
 	*/
4140
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4140
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4141 4141
 	{
4142 4142
 		global $globalDBdriver;
4143
-		$filter_query = $this->getFilter($filters,true,true);
4144
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4143
+		$filter_query = $this->getFilter($filters, true, true);
4144
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4145 4145
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4146 4146
                 if ($olderthanmonths > 0) {
4147 4147
             		if ($globalDBdriver == 'mysql') {
@@ -4161,28 +4161,28 @@  discard block
 block discarded – undo
4161 4161
 		if ($year != '') {
4162 4162
 			if ($globalDBdriver == 'mysql') {
4163 4163
 				$query .= " AND YEAR(spotter_output.date) = :year";
4164
-				$query_values = array_merge($query_values,array(':year' => $year));
4164
+				$query_values = array_merge($query_values, array(':year' => $year));
4165 4165
 			} else {
4166 4166
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4167
-				$query_values = array_merge($query_values,array(':year' => $year));
4167
+				$query_values = array_merge($query_values, array(':year' => $year));
4168 4168
 			}
4169 4169
 		}
4170 4170
 		if ($month != '') {
4171 4171
 			if ($globalDBdriver == 'mysql') {
4172 4172
 				$query .= " AND MONTH(spotter_output.date) = :month";
4173
-				$query_values = array_merge($query_values,array(':month' => $month));
4173
+				$query_values = array_merge($query_values, array(':month' => $month));
4174 4174
 			} else {
4175 4175
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4176
-				$query_values = array_merge($query_values,array(':month' => $month));
4176
+				$query_values = array_merge($query_values, array(':month' => $month));
4177 4177
 			}
4178 4178
 		}
4179 4179
 		if ($day != '') {
4180 4180
 			if ($globalDBdriver == 'mysql') {
4181 4181
 				$query .= " AND DAY(spotter_output.date) = :day";
4182
-				$query_values = array_merge($query_values,array(':day' => $day));
4182
+				$query_values = array_merge($query_values, array(':day' => $day));
4183 4183
 			} else {
4184 4184
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4185
-				$query_values = array_merge($query_values,array(':day' => $day));
4185
+				$query_values = array_merge($query_values, array(':day' => $day));
4186 4186
 			}
4187 4187
 		}
4188 4188
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4192,7 +4192,7 @@  discard block
 block discarded – undo
4192 4192
 		$sth->execute($query_values);
4193 4193
 		$airline_array = array();
4194 4194
 		$temp_array = array();
4195
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4195
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4196 4196
 		{
4197 4197
 			$temp_array['owner_name'] = $row['owner_name'];
4198 4198
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4207,11 +4207,11 @@  discard block
 block discarded – undo
4207 4207
 	* @return Array the pilots list
4208 4208
 	*
4209 4209
 	*/
4210
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4210
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4211 4211
 	{
4212 4212
 		global $globalDBdriver;
4213
-		$filter_query = $this->getFilter($filters,true,true);
4214
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4213
+		$filter_query = $this->getFilter($filters, true, true);
4214
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4215 4215
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4216 4216
                 if ($olderthanmonths > 0) {
4217 4217
             		if ($globalDBdriver == 'mysql') {
@@ -4237,7 +4237,7 @@  discard block
 block discarded – undo
4237 4237
 		$airline_array = array();
4238 4238
 		$temp_array = array();
4239 4239
         
4240
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4240
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4241 4241
 		{
4242 4242
 			$temp_array['owner_name'] = $row['owner_name'];
4243 4243
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4253,11 +4253,11 @@  discard block
 block discarded – undo
4253 4253
 	* @return Array the airline list
4254 4254
 	*
4255 4255
 	*/
4256
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4256
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4257 4257
 	{
4258
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4259
-		$filter_query = $this->getFilter($filters,true,true);
4260
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4258
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4259
+		$filter_query = $this->getFilter($filters, true, true);
4260
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4261 4261
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4262 4262
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4263 4263
 			    ORDER BY airline_count DESC";
@@ -4269,7 +4269,7 @@  discard block
 block discarded – undo
4269 4269
 		$airline_array = array();
4270 4270
 		$temp_array = array();
4271 4271
         
4272
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4272
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4273 4273
 		{
4274 4274
 			$temp_array['airline_name'] = $row['airline_name'];
4275 4275
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4289,11 +4289,11 @@  discard block
 block discarded – undo
4289 4289
 	* @return Array the airline country list
4290 4290
 	*
4291 4291
 	*/
4292
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4292
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4293 4293
 	{
4294
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4295
-		$filter_query = $this->getFilter($filters,true,true);
4296
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4294
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4295
+		$filter_query = $this->getFilter($filters, true, true);
4296
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4297 4297
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4298 4298
                     GROUP BY spotter_output.airline_country
4299 4299
 					ORDER BY airline_country_count DESC
@@ -4306,7 +4306,7 @@  discard block
 block discarded – undo
4306 4306
 		$airline_country_array = array();
4307 4307
 		$temp_array = array();
4308 4308
         
4309
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4309
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4310 4310
 		{
4311 4311
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4312 4312
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4325,11 +4325,11 @@  discard block
 block discarded – undo
4325 4325
 	* @return Array the airline list
4326 4326
 	*
4327 4327
 	*/
4328
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4328
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4329 4329
 	{
4330
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4331
-		$filter_query = $this->getFilter($filters,true,true);
4332
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4330
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4331
+		$filter_query = $this->getFilter($filters, true, true);
4332
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4333 4333
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
4334 4334
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4335 4335
 		    ORDER BY airline_count DESC";
@@ -4341,7 +4341,7 @@  discard block
 block discarded – undo
4341 4341
 		$airline_array = array();
4342 4342
 		$temp_array = array();
4343 4343
         
4344
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4344
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4345 4345
 		{
4346 4346
 			$temp_array['airline_name'] = $row['airline_name'];
4347 4347
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4360,11 +4360,11 @@  discard block
 block discarded – undo
4360 4360
 	* @return Array the airline country list
4361 4361
 	*
4362 4362
 	*/
4363
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4363
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4364 4364
 	{
4365
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4366
-		$filter_query = $this->getFilter($filters,true,true);
4367
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4365
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4366
+		$filter_query = $this->getFilter($filters, true, true);
4367
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4368 4368
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
4369 4369
 					GROUP BY spotter_output.airline_country
4370 4370
 					ORDER BY airline_country_count DESC
@@ -4377,7 +4377,7 @@  discard block
 block discarded – undo
4377 4377
 		$airline_country_array = array();
4378 4378
 		$temp_array = array();
4379 4379
         
4380
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4380
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4381 4381
 		{
4382 4382
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4383 4383
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4394,11 +4394,11 @@  discard block
 block discarded – undo
4394 4394
 	* @return Array the airline list
4395 4395
 	*
4396 4396
 	*/
4397
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4397
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4398 4398
 	{
4399
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4400
-		$filter_query = $this->getFilter($filters,true,true);
4401
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4399
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4400
+		$filter_query = $this->getFilter($filters, true, true);
4401
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4402 4402
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4403 4403
 					GROUP BY spotter_output.airline_name
4404 4404
 					ORDER BY airline_count DESC";
@@ -4409,7 +4409,7 @@  discard block
 block discarded – undo
4409 4409
 		$airline_array = array();
4410 4410
 		$temp_array = array();
4411 4411
         
4412
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4412
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4413 4413
 		{
4414 4414
 			$temp_array['airline_name'] = $row['airline_name'];
4415 4415
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4429,11 +4429,11 @@  discard block
 block discarded – undo
4429 4429
 	* @return Array the airline country list
4430 4430
 	*
4431 4431
 	*/
4432
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4432
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4433 4433
 	{
4434
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4435
-		$filter_query = $this->getFilter($filters,true,true);
4436
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4434
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4435
+		$filter_query = $this->getFilter($filters, true, true);
4436
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4437 4437
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4438 4438
 					GROUP BY spotter_output.airline_country
4439 4439
 					ORDER BY airline_country_count DESC
@@ -4446,7 +4446,7 @@  discard block
 block discarded – undo
4446 4446
 		$airline_country_array = array();
4447 4447
 		$temp_array = array();
4448 4448
         
4449
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4449
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4450 4450
 		{
4451 4451
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4452 4452
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4462,11 +4462,11 @@  discard block
 block discarded – undo
4462 4462
 	* @return Array the airline list
4463 4463
 	*
4464 4464
 	*/
4465
-	public function countAllAirlinesByDate($date,$filters = array())
4465
+	public function countAllAirlinesByDate($date, $filters = array())
4466 4466
 	{
4467 4467
 		global $globalTimezone, $globalDBdriver;
4468
-		$filter_query = $this->getFilter($filters,true,true);
4469
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4468
+		$filter_query = $this->getFilter($filters, true, true);
4469
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4470 4470
 		if ($globalTimezone != '') {
4471 4471
 			date_default_timezone_set($globalTimezone);
4472 4472
 			$datetime = new DateTime($date);
@@ -4474,12 +4474,12 @@  discard block
 block discarded – undo
4474 4474
 		} else $offset = '+00:00';
4475 4475
 
4476 4476
 		if ($globalDBdriver == 'mysql') {
4477
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4477
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4478 4478
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4479 4479
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4480 4480
 					ORDER BY airline_count DESC";
4481 4481
 		} else {
4482
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4482
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4483 4483
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4484 4484
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4485 4485
 					ORDER BY airline_count DESC";
@@ -4490,7 +4490,7 @@  discard block
 block discarded – undo
4490 4490
 
4491 4491
 		$airline_array = array();
4492 4492
 		$temp_array = array();
4493
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4493
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4494 4494
 		{
4495 4495
 			$temp_array['airline_name'] = $row['airline_name'];
4496 4496
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4510,11 +4510,11 @@  discard block
 block discarded – undo
4510 4510
 	* @return Array the airline country list
4511 4511
 	*
4512 4512
 	*/
4513
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4513
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4514 4514
 	{
4515 4515
 		global $globalTimezone, $globalDBdriver;
4516
-		$filter_query = $this->getFilter($filters,true,true);
4517
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4516
+		$filter_query = $this->getFilter($filters, true, true);
4517
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4518 4518
 		if ($globalTimezone != '') {
4519 4519
 			date_default_timezone_set($globalTimezone);
4520 4520
 			$datetime = new DateTime($date);
@@ -4522,13 +4522,13 @@  discard block
 block discarded – undo
4522 4522
 		} else $offset = '+00:00';
4523 4523
 		
4524 4524
 		if ($globalDBdriver == 'mysql') {
4525
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4525
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4526 4526
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4527 4527
 					GROUP BY spotter_output.airline_country
4528 4528
 					ORDER BY airline_country_count DESC
4529 4529
 					LIMIT 10 OFFSET 0";
4530 4530
 		} else {
4531
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4531
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4532 4532
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4533 4533
 					GROUP BY spotter_output.airline_country
4534 4534
 					ORDER BY airline_country_count DESC
@@ -4540,7 +4540,7 @@  discard block
 block discarded – undo
4540 4540
  
4541 4541
 		$airline_country_array = array();
4542 4542
 		$temp_array = array();
4543
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4543
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4544 4544
 		{
4545 4545
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4546 4546
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4557,11 +4557,11 @@  discard block
 block discarded – undo
4557 4557
 	* @return Array the airline list
4558 4558
 	*
4559 4559
 	*/
4560
-	public function countAllAirlinesByIdent($ident,$filters = array())
4560
+	public function countAllAirlinesByIdent($ident, $filters = array())
4561 4561
 	{
4562
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4563
-		$filter_query = $this->getFilter($filters,true,true);
4564
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4562
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4563
+		$filter_query = $this->getFilter($filters, true, true);
4564
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4565 4565
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4566 4566
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4567 4567
 				ORDER BY airline_count DESC";
@@ -4578,11 +4578,11 @@  discard block
 block discarded – undo
4578 4578
 	* @return Array the airline list
4579 4579
 	*
4580 4580
 	*/
4581
-	public function countAllAirlinesByOwner($owner,$filters = array())
4581
+	public function countAllAirlinesByOwner($owner, $filters = array())
4582 4582
 	{
4583
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4584
-		$filter_query = $this->getFilter($filters,true,true);
4585
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4583
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4584
+		$filter_query = $this->getFilter($filters, true, true);
4585
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4586 4586
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4587 4587
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4588 4588
 				ORDER BY airline_count DESC";
@@ -4599,11 +4599,11 @@  discard block
 block discarded – undo
4599 4599
 	* @return Array the airline list
4600 4600
 	*
4601 4601
 	*/
4602
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4602
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4603 4603
 	{
4604
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4605
-		$filter_query = $this->getFilter($filters,true,true);
4606
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4604
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4605
+		$filter_query = $this->getFilter($filters, true, true);
4606
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4607 4607
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4608 4608
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4609 4609
 				ORDER BY airline_count DESC";
@@ -4620,25 +4620,25 @@  discard block
 block discarded – undo
4620 4620
 	* @return Array the airline list
4621 4621
 	*
4622 4622
 	*/
4623
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4623
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4624 4624
 	{
4625
-		$filter_query = $this->getFilter($filters,true,true);
4626
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4627
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4625
+		$filter_query = $this->getFilter($filters, true, true);
4626
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4627
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4628 4628
 
4629
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4629
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4630 4630
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4631 4631
 					GROUP BY spotter_output.airline_name
4632 4632
 					ORDER BY airline_count DESC";
4633 4633
       
4634 4634
 		
4635 4635
 		$sth = $this->db->prepare($query);
4636
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4636
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4637 4637
       
4638 4638
 		$airline_array = array();
4639 4639
 		$temp_array = array();
4640 4640
         
4641
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4641
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4642 4642
 		{
4643 4643
 			$temp_array['airline_name'] = $row['airline_name'];
4644 4644
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4656,13 +4656,13 @@  discard block
 block discarded – undo
4656 4656
 	* @return Array the airline country list
4657 4657
 	*
4658 4658
 	*/
4659
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4659
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4660 4660
 	{
4661
-		$filter_query = $this->getFilter($filters,true,true);
4662
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4663
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4661
+		$filter_query = $this->getFilter($filters, true, true);
4662
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4663
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4664 4664
       
4665
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4665
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4666 4666
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4667 4667
 				GROUP BY spotter_output.airline_country
4668 4668
 				ORDER BY airline_country_count DESC
@@ -4670,11 +4670,11 @@  discard block
 block discarded – undo
4670 4670
       
4671 4671
 		
4672 4672
 		$sth = $this->db->prepare($query);
4673
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4673
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4674 4674
       
4675 4675
 		$airline_country_array = array();
4676 4676
 		$temp_array = array();
4677
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4677
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4678 4678
 		{
4679 4679
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4680 4680
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4692,11 +4692,11 @@  discard block
 block discarded – undo
4692 4692
 	* @return Array the airline list
4693 4693
 	*
4694 4694
 	*/
4695
-	public function countAllAirlinesByCountry($country,$filters = array())
4695
+	public function countAllAirlinesByCountry($country, $filters = array())
4696 4696
 	{
4697
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4698
-		$filter_query = $this->getFilter($filters,true,true);
4699
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4697
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4698
+		$filter_query = $this->getFilter($filters, true, true);
4699
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4700 4700
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4701 4701
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4702 4702
 			    ORDER BY airline_count DESC";
@@ -4707,7 +4707,7 @@  discard block
 block discarded – undo
4707 4707
 
4708 4708
 		$airline_array = array();
4709 4709
 		$temp_array = array();
4710
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4710
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4711 4711
 		{
4712 4712
 			$temp_array['airline_name'] = $row['airline_name'];
4713 4713
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4726,11 +4726,11 @@  discard block
 block discarded – undo
4726 4726
 	* @return Array the airline country list
4727 4727
 	*
4728 4728
 	*/
4729
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4729
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4730 4730
 	{
4731
-		$filter_query = $this->getFilter($filters,true,true);
4732
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4733
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4731
+		$filter_query = $this->getFilter($filters, true, true);
4732
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4733
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4734 4734
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4735 4735
 				GROUP BY spotter_output.airline_country
4736 4736
 				ORDER BY airline_country_count DESC
@@ -4742,7 +4742,7 @@  discard block
 block discarded – undo
4742 4742
 
4743 4743
 		$airline_country_array = array();
4744 4744
 		$temp_array = array();
4745
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4745
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4746 4746
 		{
4747 4747
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4748 4748
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4762,35 +4762,35 @@  discard block
 block discarded – undo
4762 4762
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4763 4763
 	{
4764 4764
 		global $globalDBdriver;
4765
-		$filter_query = $this->getFilter($filters,true,true);
4766
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4765
+		$filter_query = $this->getFilter($filters, true, true);
4766
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4767 4767
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4768 4768
 		$query_values = array();
4769 4769
 		if ($year != '') {
4770 4770
 			if ($globalDBdriver == 'mysql') {
4771 4771
 				$query .= " AND YEAR(spotter_output.date) = :year";
4772
-				$query_values = array_merge($query_values,array(':year' => $year));
4772
+				$query_values = array_merge($query_values, array(':year' => $year));
4773 4773
 			} else {
4774 4774
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4775
-				$query_values = array_merge($query_values,array(':year' => $year));
4775
+				$query_values = array_merge($query_values, array(':year' => $year));
4776 4776
 			}
4777 4777
 		}
4778 4778
 		if ($month != '') {
4779 4779
 			if ($globalDBdriver == 'mysql') {
4780 4780
 				$query .= " AND MONTH(spotter_output.date) = :month";
4781
-				$query_values = array_merge($query_values,array(':month' => $month));
4781
+				$query_values = array_merge($query_values, array(':month' => $month));
4782 4782
 			} else {
4783 4783
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4784
-				$query_values = array_merge($query_values,array(':month' => $month));
4784
+				$query_values = array_merge($query_values, array(':month' => $month));
4785 4785
 			}
4786 4786
 		}
4787 4787
 		if ($day != '') {
4788 4788
 			if ($globalDBdriver == 'mysql') {
4789 4789
 				$query .= " AND DAY(spotter_output.date) = :day";
4790
-				$query_values = array_merge($query_values,array(':day' => $day));
4790
+				$query_values = array_merge($query_values, array(':day' => $day));
4791 4791
 			} else {
4792 4792
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4793
-				$query_values = array_merge($query_values,array(':day' => $day));
4793
+				$query_values = array_merge($query_values, array(':day' => $day));
4794 4794
 			}
4795 4795
 		}
4796 4796
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4802,7 +4802,7 @@  discard block
 block discarded – undo
4802 4802
 
4803 4803
 		$airline_array = array();
4804 4804
 		$temp_array = array();
4805
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4805
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4806 4806
 		{
4807 4807
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4808 4808
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4818,11 +4818,11 @@  discard block
 block discarded – undo
4818 4818
 	* @return Array the airline country list
4819 4819
 	*
4820 4820
 	*/
4821
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4821
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4822 4822
 	{
4823 4823
 		global $globalDBdriver;
4824 4824
 		//$filter_query = $this->getFilter($filters,true,true);
4825
-		$Connection= new Connection($this->db);
4825
+		$Connection = new Connection($this->db);
4826 4826
 		if (!$Connection->tableExists('countries')) return array();
4827 4827
 		/*
4828 4828
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4837,7 +4837,7 @@  discard block
 block discarded – undo
4837 4837
 */
4838 4838
 		require_once('class.SpotterLive.php');
4839 4839
 		$SpotterLive = new SpotterLive();
4840
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4840
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4841 4841
 		$filter_query .= ' over_country IS NOT NULL';
4842 4842
                 if ($olderthanmonths > 0) {
4843 4843
 			if ($globalDBdriver == 'mysql') {
@@ -4864,7 +4864,7 @@  discard block
 block discarded – undo
4864 4864
 		$flight_array = array();
4865 4865
 		$temp_array = array();
4866 4866
         
4867
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4867
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4868 4868
 		{
4869 4869
 			$temp_array['flight_count'] = $row['nb'];
4870 4870
 			$temp_array['flight_country'] = $row['name'];
@@ -4882,11 +4882,11 @@  discard block
 block discarded – undo
4882 4882
 	* @return Array the aircraft list
4883 4883
 	*
4884 4884
 	*/
4885
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4885
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4886 4886
 	{
4887 4887
 		global $globalDBdriver;
4888
-		$filter_query = $this->getFilter($filters,true,true);
4889
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4888
+		$filter_query = $this->getFilter($filters, true, true);
4889
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4890 4890
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4891 4891
 		if ($olderthanmonths > 0) {
4892 4892
 			if ($globalDBdriver == 'mysql') {
@@ -4906,28 +4906,28 @@  discard block
 block discarded – undo
4906 4906
 		if ($year != '') {
4907 4907
 			if ($globalDBdriver == 'mysql') {
4908 4908
 				$query .= " AND YEAR(spotter_output.date) = :year";
4909
-				$query_values = array_merge($query_values,array(':year' => $year));
4909
+				$query_values = array_merge($query_values, array(':year' => $year));
4910 4910
 			} else {
4911 4911
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4912
-				$query_values = array_merge($query_values,array(':year' => $year));
4912
+				$query_values = array_merge($query_values, array(':year' => $year));
4913 4913
 			}
4914 4914
 		}
4915 4915
 		if ($month != '') {
4916 4916
 			if ($globalDBdriver == 'mysql') {
4917 4917
 				$query .= " AND MONTH(spotter_output.date) = :month";
4918
-				$query_values = array_merge($query_values,array(':month' => $month));
4918
+				$query_values = array_merge($query_values, array(':month' => $month));
4919 4919
 			} else {
4920 4920
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4921
-				$query_values = array_merge($query_values,array(':month' => $month));
4921
+				$query_values = array_merge($query_values, array(':month' => $month));
4922 4922
 			}
4923 4923
 		}
4924 4924
 		if ($day != '') {
4925 4925
 			if ($globalDBdriver == 'mysql') {
4926 4926
 				$query .= " AND DAY(spotter_output.date) = :day";
4927
-				$query_values = array_merge($query_values,array(':day' => $day));
4927
+				$query_values = array_merge($query_values, array(':day' => $day));
4928 4928
 			} else {
4929 4929
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4930
-				$query_values = array_merge($query_values,array(':day' => $day));
4930
+				$query_values = array_merge($query_values, array(':day' => $day));
4931 4931
 			}
4932 4932
 		}
4933 4933
 
@@ -4939,7 +4939,7 @@  discard block
 block discarded – undo
4939 4939
 
4940 4940
 		$aircraft_array = array();
4941 4941
 		$temp_array = array();
4942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4943 4943
 		{
4944 4944
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4945 4945
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4956,11 +4956,11 @@  discard block
 block discarded – undo
4956 4956
 	* @return Array the aircraft list
4957 4957
 	*
4958 4958
 	*/
4959
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4959
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4960 4960
 	{
4961 4961
 		global $globalDBdriver;
4962
-		$filter_query = $this->getFilter($filters,true,true);
4963
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4962
+		$filter_query = $this->getFilter($filters, true, true);
4963
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4964 4964
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA'";
4965 4965
 		if ($olderthanmonths > 0) {
4966 4966
 			if ($globalDBdriver == 'mysql') {
@@ -4980,28 +4980,28 @@  discard block
 block discarded – undo
4980 4980
 		if ($year != '') {
4981 4981
 			if ($globalDBdriver == 'mysql') {
4982 4982
 				$query .= " AND YEAR(spotter_output.date) = :year";
4983
-				$query_values = array_merge($query_values,array(':year' => $year));
4983
+				$query_values = array_merge($query_values, array(':year' => $year));
4984 4984
 			} else {
4985 4985
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4986
-				$query_values = array_merge($query_values,array(':year' => $year));
4986
+				$query_values = array_merge($query_values, array(':year' => $year));
4987 4987
 			}
4988 4988
 		}
4989 4989
 		if ($month != '') {
4990 4990
 			if ($globalDBdriver == 'mysql') {
4991 4991
 				$query .= " AND MONTH(spotter_output.date) = :month";
4992
-				$query_values = array_merge($query_values,array(':month' => $month));
4992
+				$query_values = array_merge($query_values, array(':month' => $month));
4993 4993
 			} else {
4994 4994
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4995
-				$query_values = array_merge($query_values,array(':month' => $month));
4995
+				$query_values = array_merge($query_values, array(':month' => $month));
4996 4996
 			}
4997 4997
 		}
4998 4998
 		if ($day != '') {
4999 4999
 			if ($globalDBdriver == 'mysql') {
5000 5000
 				$query .= " AND DAY(spotter_output.date) = :day";
5001
-				$query_values = array_merge($query_values,array(':day' => $day));
5001
+				$query_values = array_merge($query_values, array(':day' => $day));
5002 5002
 			} else {
5003 5003
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5004
-				$query_values = array_merge($query_values,array(':day' => $day));
5004
+				$query_values = array_merge($query_values, array(':day' => $day));
5005 5005
 			}
5006 5006
 		}
5007 5007
 
@@ -5013,7 +5013,7 @@  discard block
 block discarded – undo
5013 5013
 
5014 5014
 		$aircraft_array = array();
5015 5015
 		$temp_array = array();
5016
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5016
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5017 5017
 		{
5018 5018
 			$temp_array['airline_icao'] = $row['airline_icao'];
5019 5019
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5031,11 +5031,11 @@  discard block
 block discarded – undo
5031 5031
 	* @return Array the aircraft list
5032 5032
 	*
5033 5033
 	*/
5034
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5034
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5035 5035
 	{
5036 5036
 		global $globalDBdriver;
5037
-		$filter_query = $this->getFilter($filters,true,true);
5038
-		$query  = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5037
+		$filter_query = $this->getFilter($filters, true, true);
5038
+		$query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5039 5039
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
5040 5040
 		if ($olderthanmonths > 0) {
5041 5041
 			if ($globalDBdriver == 'mysql') {
@@ -5060,7 +5060,7 @@  discard block
 block discarded – undo
5060 5060
 
5061 5061
 		$aircraft_array = array();
5062 5062
 		$temp_array = array();
5063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5064 5064
 		{
5065 5065
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5066 5066
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5079,13 +5079,13 @@  discard block
 block discarded – undo
5079 5079
 	* @return Array the aircraft list
5080 5080
 	*
5081 5081
 	*/
5082
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5082
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5083 5083
 	{
5084 5084
 		$Image = new Image($this->db);
5085
-		$filter_query = $this->getFilter($filters,true,true);
5086
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5085
+		$filter_query = $this->getFilter($filters, true, true);
5086
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5087 5087
 
5088
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5088
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5089 5089
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5090 5090
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5091 5091
 				ORDER BY registration_count DESC";
@@ -5096,14 +5096,14 @@  discard block
 block discarded – undo
5096 5096
 		$aircraft_array = array();
5097 5097
 		$temp_array = array();
5098 5098
         
5099
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5099
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5100 5100
 		{
5101 5101
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5102 5102
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5103 5103
 			$temp_array['registration'] = $row['registration'];
5104 5104
 			$temp_array['airline_name'] = $row['airline_name'];
5105 5105
 			$temp_array['image_thumbnail'] = "";
5106
-			if($row['registration'] != "")
5106
+			if ($row['registration'] != "")
5107 5107
 			{
5108 5108
 				$image_array = $Image->getSpotterImage($row['registration']);
5109 5109
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5122,11 +5122,11 @@  discard block
 block discarded – undo
5122 5122
 	* @return Array the aircraft list
5123 5123
 	*
5124 5124
 	*/
5125
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5125
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5126 5126
 	{
5127
-		$filter_query = $this->getFilter($filters,true,true);
5128
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5129
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5127
+		$filter_query = $this->getFilter($filters, true, true);
5128
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5129
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5130 5130
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5131 5131
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5132 5132
 			    ORDER BY aircraft_icao_count DESC";
@@ -5137,7 +5137,7 @@  discard block
 block discarded – undo
5137 5137
 		$aircraft_array = array();
5138 5138
 		$temp_array = array();
5139 5139
 
5140
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5140
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5141 5141
 		{
5142 5142
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5143 5143
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5155,13 +5155,13 @@  discard block
 block discarded – undo
5155 5155
 	* @return Array the aircraft list
5156 5156
 	*
5157 5157
 	*/
5158
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5158
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5159 5159
 	{
5160
-		$filter_query = $this->getFilter($filters,true,true);
5160
+		$filter_query = $this->getFilter($filters, true, true);
5161 5161
 		$Image = new Image($this->db);
5162
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5162
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5163 5163
 
5164
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5164
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5165 5165
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5166 5166
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5167 5167
 			    ORDER BY registration_count DESC";
@@ -5171,14 +5171,14 @@  discard block
 block discarded – undo
5171 5171
 
5172 5172
 		$aircraft_array = array();
5173 5173
 		$temp_array = array();
5174
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5174
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5175 5175
 		{
5176 5176
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5177 5177
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5178 5178
 			$temp_array['registration'] = $row['registration'];
5179 5179
 			$temp_array['airline_name'] = $row['airline_name'];
5180 5180
 			$temp_array['image_thumbnail'] = "";
5181
-			if($row['registration'] != "")
5181
+			if ($row['registration'] != "")
5182 5182
 			{
5183 5183
 				$image_array = $Image->getSpotterImage($row['registration']);
5184 5184
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5197,11 +5197,11 @@  discard block
 block discarded – undo
5197 5197
 	* @return Array the aircraft list
5198 5198
 	*
5199 5199
 	*/
5200
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5200
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5201 5201
 	{
5202
-		$filter_query = $this->getFilter($filters,true,true);
5203
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5204
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5202
+		$filter_query = $this->getFilter($filters, true, true);
5203
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5204
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5205 5205
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5206 5206
 				GROUP BY spotter_output.aircraft_manufacturer 
5207 5207
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5212,7 +5212,7 @@  discard block
 block discarded – undo
5212 5212
 		$aircraft_array = array();
5213 5213
 		$temp_array = array();
5214 5214
 
5215
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5215
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5216 5216
 		{
5217 5217
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5218 5218
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5229,12 +5229,12 @@  discard block
 block discarded – undo
5229 5229
 	* @return Array the aircraft list
5230 5230
 	*
5231 5231
 	*/
5232
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5232
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5233 5233
 	{
5234
-		$filter_query = $this->getFilter($filters,true,true);
5235
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5234
+		$filter_query = $this->getFilter($filters, true, true);
5235
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5236 5236
 
5237
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5237
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5238 5238
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
5239 5239
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5240 5240
 				ORDER BY aircraft_icao_count DESC";
@@ -5244,7 +5244,7 @@  discard block
 block discarded – undo
5244 5244
 
5245 5245
 		$aircraft_array = array();
5246 5246
 		$temp_array = array();
5247
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5247
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5248 5248
 		{
5249 5249
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5250 5250
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5262,13 +5262,13 @@  discard block
 block discarded – undo
5262 5262
 	* @return Array the aircraft list
5263 5263
 	*
5264 5264
 	*/
5265
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5265
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5266 5266
 	{
5267
-		$filter_query = $this->getFilter($filters,true,true);
5267
+		$filter_query = $this->getFilter($filters, true, true);
5268 5268
 		$Image = new Image($this->db);
5269
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5269
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5270 5270
 
5271
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5271
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5272 5272
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5273 5273
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5274 5274
 		    ORDER BY registration_count DESC";
@@ -5278,14 +5278,14 @@  discard block
 block discarded – undo
5278 5278
 
5279 5279
 		$aircraft_array = array();
5280 5280
 		$temp_array = array();
5281
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5281
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5282 5282
 		{
5283 5283
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5284 5284
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5285 5285
 			$temp_array['registration'] = $row['registration'];
5286 5286
 			$temp_array['airline_name'] = $row['airline_name'];
5287 5287
 			$temp_array['image_thumbnail'] = "";
5288
-			if($row['registration'] != "")
5288
+			if ($row['registration'] != "")
5289 5289
 			{
5290 5290
 				$image_array = $Image->getSpotterImage($row['registration']);
5291 5291
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5303,11 +5303,11 @@  discard block
 block discarded – undo
5303 5303
 	* @return Array the aircraft list
5304 5304
 	*
5305 5305
 	*/
5306
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5306
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5307 5307
 	{
5308
-		$filter_query = $this->getFilter($filters,true,true);
5309
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5310
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5308
+		$filter_query = $this->getFilter($filters, true, true);
5309
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5310
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5311 5311
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
5312 5312
                     GROUP BY spotter_output.aircraft_manufacturer 
5313 5313
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5318,7 +5318,7 @@  discard block
 block discarded – undo
5318 5318
 
5319 5319
 		$aircraft_array = array();
5320 5320
 		$temp_array = array();
5321
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5321
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5322 5322
 		{
5323 5323
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5324 5324
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5333,12 +5333,12 @@  discard block
 block discarded – undo
5333 5333
 	* @return Array the aircraft list
5334 5334
 	*
5335 5335
 	*/
5336
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5336
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5337 5337
 	{
5338
-		$filter_query = $this->getFilter($filters,true,true);
5339
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5338
+		$filter_query = $this->getFilter($filters, true, true);
5339
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5340 5340
 
5341
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5341
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5342 5342
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5343 5343
                     GROUP BY spotter_output.aircraft_name 
5344 5344
 					ORDER BY aircraft_icao_count DESC";
@@ -5347,7 +5347,7 @@  discard block
 block discarded – undo
5347 5347
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5348 5348
 		$aircraft_array = array();
5349 5349
 		$temp_array = array();
5350
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5350
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5351 5351
 		{
5352 5352
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5353 5353
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5366,11 +5366,11 @@  discard block
 block discarded – undo
5366 5366
 	*/
5367 5367
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5368 5368
 	{
5369
-		$filter_query = $this->getFilter($filters,true,true);
5369
+		$filter_query = $this->getFilter($filters, true, true);
5370 5370
 		$Image = new Image($this->db);
5371
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5371
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5372 5372
 
5373
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5373
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5374 5374
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5375 5375
                     GROUP BY spotter_output.registration 
5376 5376
 					ORDER BY registration_count DESC";
@@ -5380,14 +5380,14 @@  discard block
 block discarded – undo
5380 5380
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5381 5381
 		$aircraft_array = array();
5382 5382
 		$temp_array = array();
5383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5384 5384
 		{
5385 5385
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5386 5386
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5387 5387
 			$temp_array['registration'] = $row['registration'];
5388 5388
 			$temp_array['airline_name'] = $row['airline_name'];
5389 5389
 			$temp_array['image_thumbnail'] = "";
5390
-			if($row['registration'] != "")
5390
+			if ($row['registration'] != "")
5391 5391
 			{
5392 5392
 				$image_array = $Image->getSpotterImage($row['registration']);
5393 5393
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5404,11 +5404,11 @@  discard block
 block discarded – undo
5404 5404
 	* @return Array the aircraft list
5405 5405
 	*
5406 5406
 	*/
5407
-	public function countAllAircraftTypesByDate($date,$filters = array())
5407
+	public function countAllAircraftTypesByDate($date, $filters = array())
5408 5408
 	{
5409 5409
 		global $globalTimezone, $globalDBdriver;
5410
-		$filter_query = $this->getFilter($filters,true,true);
5411
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5410
+		$filter_query = $this->getFilter($filters, true, true);
5411
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5412 5412
 		if ($globalTimezone != '') {
5413 5413
 			date_default_timezone_set($globalTimezone);
5414 5414
 			$datetime = new DateTime($date);
@@ -5416,12 +5416,12 @@  discard block
 block discarded – undo
5416 5416
 		} else $offset = '+00:00';
5417 5417
 
5418 5418
 		if ($globalDBdriver == 'mysql') {
5419
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5419
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5420 5420
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5421 5421
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5422 5422
 					ORDER BY aircraft_icao_count DESC";
5423 5423
 		} else {
5424
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5424
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5425 5425
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5426 5426
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5427 5427
 					ORDER BY aircraft_icao_count DESC";
@@ -5432,7 +5432,7 @@  discard block
 block discarded – undo
5432 5432
 
5433 5433
 		$aircraft_array = array();
5434 5434
 		$temp_array = array();
5435
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5435
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5436 5436
 		{
5437 5437
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5438 5438
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5450,12 +5450,12 @@  discard block
 block discarded – undo
5450 5450
 	* @return Array the aircraft list
5451 5451
 	*
5452 5452
 	*/
5453
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5453
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5454 5454
 	{
5455 5455
 		global $globalTimezone, $globalDBdriver;
5456
-		$filter_query = $this->getFilter($filters,true,true);
5456
+		$filter_query = $this->getFilter($filters, true, true);
5457 5457
 		$Image = new Image($this->db);
5458
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5458
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5459 5459
 		if ($globalTimezone != '') {
5460 5460
 			date_default_timezone_set($globalTimezone);
5461 5461
 			$datetime = new DateTime($date);
@@ -5463,12 +5463,12 @@  discard block
 block discarded – undo
5463 5463
 		} else $offset = '+00:00';
5464 5464
 
5465 5465
 		if ($globalDBdriver == 'mysql') {
5466
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5466
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5467 5467
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5468 5468
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5469 5469
 					ORDER BY registration_count DESC";
5470 5470
 		} else {
5471
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
5471
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
5472 5472
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5473 5473
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5474 5474
 					ORDER BY registration_count DESC";
@@ -5479,14 +5479,14 @@  discard block
 block discarded – undo
5479 5479
 
5480 5480
 		$aircraft_array = array();
5481 5481
 		$temp_array = array();
5482
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5482
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5483 5483
 		{
5484 5484
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5485 5485
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5486 5486
 			$temp_array['registration'] = $row['registration'];
5487 5487
 			$temp_array['airline_name'] = $row['airline_name'];
5488 5488
 			$temp_array['image_thumbnail'] = "";
5489
-			if($row['registration'] != "")
5489
+			if ($row['registration'] != "")
5490 5490
 			{
5491 5491
 				$image_array = $Image->getSpotterImage($row['registration']);
5492 5492
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5505,11 +5505,11 @@  discard block
 block discarded – undo
5505 5505
 	* @return Array the aircraft manufacturer list
5506 5506
 	*
5507 5507
 	*/
5508
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5508
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5509 5509
 	{
5510 5510
 		global $globalTimezone, $globalDBdriver;
5511
-		$filter_query = $this->getFilter($filters,true,true);
5512
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5511
+		$filter_query = $this->getFilter($filters, true, true);
5512
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5513 5513
 		if ($globalTimezone != '') {
5514 5514
 			date_default_timezone_set($globalTimezone);
5515 5515
 			$datetime = new DateTime($date);
@@ -5517,12 +5517,12 @@  discard block
 block discarded – undo
5517 5517
 		} else $offset = '+00:00';
5518 5518
 
5519 5519
 		if ($globalDBdriver == 'mysql') {
5520
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5520
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5521 5521
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5522 5522
 				GROUP BY spotter_output.aircraft_manufacturer 
5523 5523
 				ORDER BY aircraft_manufacturer_count DESC";
5524 5524
 		} else {
5525
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5525
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5526 5526
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5527 5527
 				GROUP BY spotter_output.aircraft_manufacturer 
5528 5528
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5534,7 +5534,7 @@  discard block
 block discarded – undo
5534 5534
 		$aircraft_array = array();
5535 5535
 		$temp_array = array();
5536 5536
 
5537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5538 5538
 		{
5539 5539
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5540 5540
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5551,11 +5551,11 @@  discard block
 block discarded – undo
5551 5551
 	* @return Array the aircraft list
5552 5552
 	*
5553 5553
 	*/
5554
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5554
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5555 5555
 	{
5556
-		$filter_query = $this->getFilter($filters,true,true);
5557
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5558
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5556
+		$filter_query = $this->getFilter($filters, true, true);
5557
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5558
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5559 5559
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5560 5560
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5561 5561
 				ORDER BY aircraft_icao_count DESC";
@@ -5566,7 +5566,7 @@  discard block
 block discarded – undo
5566 5566
 		$aircraft_array = array();
5567 5567
 		$temp_array = array();
5568 5568
 
5569
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5569
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5570 5570
 		{
5571 5571
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5572 5572
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5583,11 +5583,11 @@  discard block
 block discarded – undo
5583 5583
 	* @return Array the aircraft list
5584 5584
 	*
5585 5585
 	*/
5586
-	public function countAllAircraftTypesByPilot($pilot,$filters = array())
5586
+	public function countAllAircraftTypesByPilot($pilot, $filters = array())
5587 5587
 	{
5588
-		$filter_query = $this->getFilter($filters,true,true);
5589
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5590
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5588
+		$filter_query = $this->getFilter($filters, true, true);
5589
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5590
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5591 5591
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot) 
5592 5592
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5593 5593
 				ORDER BY aircraft_icao_count DESC";
@@ -5603,11 +5603,11 @@  discard block
 block discarded – undo
5603 5603
 	* @return Array the aircraft list
5604 5604
 	*
5605 5605
 	*/
5606
-	public function countAllAircraftTypesByOwner($owner,$filters = array())
5606
+	public function countAllAircraftTypesByOwner($owner, $filters = array())
5607 5607
 	{
5608
-		$filter_query = $this->getFilter($filters,true,true);
5609
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5610
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5608
+		$filter_query = $this->getFilter($filters, true, true);
5609
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5610
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5611 5611
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
5612 5612
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5613 5613
 				ORDER BY aircraft_icao_count DESC";
@@ -5624,13 +5624,13 @@  discard block
 block discarded – undo
5624 5624
 	* @return Array the aircraft list
5625 5625
 	*
5626 5626
 	*/
5627
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5627
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5628 5628
 	{
5629
-		$filter_query = $this->getFilter($filters,true,true);
5629
+		$filter_query = $this->getFilter($filters, true, true);
5630 5630
 		$Image = new Image($this->db);
5631
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5631
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5632 5632
 
5633
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5633
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5634 5634
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5635 5635
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5636 5636
 		    ORDER BY registration_count DESC";
@@ -5642,14 +5642,14 @@  discard block
 block discarded – undo
5642 5642
 		$aircraft_array = array();
5643 5643
 		$temp_array = array();
5644 5644
         
5645
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5645
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5646 5646
 		{
5647 5647
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5648 5648
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5649 5649
 			$temp_array['registration'] = $row['registration'];
5650 5650
 			$temp_array['airline_name'] = $row['airline_name'];
5651 5651
 			$temp_array['image_thumbnail'] = "";
5652
-			if($row['registration'] != "")
5652
+			if ($row['registration'] != "")
5653 5653
 			{
5654 5654
 				$image_array = $Image->getSpotterImage($row['registration']);
5655 5655
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5667,13 +5667,13 @@  discard block
 block discarded – undo
5667 5667
 	* @return Array the aircraft list
5668 5668
 	*
5669 5669
 	*/
5670
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
5670
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array())
5671 5671
 	{
5672
-		$filter_query = $this->getFilter($filters,true,true);
5672
+		$filter_query = $this->getFilter($filters, true, true);
5673 5673
 		$Image = new Image($this->db);
5674
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5674
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5675 5675
 
5676
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5676
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5677 5677
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner 
5678 5678
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5679 5679
 		    ORDER BY registration_count DESC";
@@ -5685,7 +5685,7 @@  discard block
 block discarded – undo
5685 5685
 		$aircraft_array = array();
5686 5686
 		$temp_array = array();
5687 5687
         
5688
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5688
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5689 5689
 		{
5690 5690
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5691 5691
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5693,7 +5693,7 @@  discard block
 block discarded – undo
5693 5693
 			$temp_array['registration'] = $row['registration'];
5694 5694
 			$temp_array['airline_name'] = $row['airline_name'];
5695 5695
 			$temp_array['image_thumbnail'] = "";
5696
-			if($row['registration'] != "")
5696
+			if ($row['registration'] != "")
5697 5697
 			{
5698 5698
 				$image_array = $Image->getSpotterImage($row['registration']);
5699 5699
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5711,13 +5711,13 @@  discard block
 block discarded – undo
5711 5711
 	* @return Array the aircraft list
5712 5712
 	*
5713 5713
 	*/
5714
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array())
5714
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array())
5715 5715
 	{
5716
-		$filter_query = $this->getFilter($filters,true,true);
5716
+		$filter_query = $this->getFilter($filters, true, true);
5717 5717
 		$Image = new Image($this->db);
5718
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5718
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5719 5719
 
5720
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5720
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5721 5721
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
5722 5722
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5723 5723
 		    ORDER BY registration_count DESC";
@@ -5729,7 +5729,7 @@  discard block
 block discarded – undo
5729 5729
 		$aircraft_array = array();
5730 5730
 		$temp_array = array();
5731 5731
         
5732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5733 5733
 		{
5734 5734
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5735 5735
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5737,7 +5737,7 @@  discard block
 block discarded – undo
5737 5737
 			$temp_array['registration'] = $row['registration'];
5738 5738
 			$temp_array['airline_name'] = $row['airline_name'];
5739 5739
 			$temp_array['image_thumbnail'] = "";
5740
-			if($row['registration'] != "")
5740
+			if ($row['registration'] != "")
5741 5741
 			{
5742 5742
 				$image_array = $Image->getSpotterImage($row['registration']);
5743 5743
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5756,11 +5756,11 @@  discard block
 block discarded – undo
5756 5756
 	* @return Array the aircraft manufacturer list
5757 5757
 	*
5758 5758
 	*/
5759
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5759
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5760 5760
 	{
5761
-		$filter_query = $this->getFilter($filters,true,true);
5762
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5763
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5761
+		$filter_query = $this->getFilter($filters, true, true);
5762
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5763
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5764 5764
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5765 5765
                     GROUP BY spotter_output.aircraft_manufacturer 
5766 5766
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5770,7 +5770,7 @@  discard block
 block discarded – undo
5770 5770
 		$sth->execute(array(':ident' => $ident));
5771 5771
 		$aircraft_array = array();
5772 5772
 		$temp_array = array();
5773
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5773
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5774 5774
 		{
5775 5775
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5776 5776
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5785,11 +5785,11 @@  discard block
 block discarded – undo
5785 5785
 	* @return Array the aircraft manufacturer list
5786 5786
 	*
5787 5787
 	*/
5788
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
5788
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array())
5789 5789
 	{
5790
-		$filter_query = $this->getFilter($filters,true,true);
5791
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5792
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5790
+		$filter_query = $this->getFilter($filters, true, true);
5791
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5792
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5793 5793
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner 
5794 5794
 		    GROUP BY spotter_output.aircraft_manufacturer 
5795 5795
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -5806,11 +5806,11 @@  discard block
 block discarded – undo
5806 5806
 	* @return Array the aircraft manufacturer list
5807 5807
 	*
5808 5808
 	*/
5809
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array())
5809
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array())
5810 5810
 	{
5811
-		$filter_query = $this->getFilter($filters,true,true);
5812
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5813
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5811
+		$filter_query = $this->getFilter($filters, true, true);
5812
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5813
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5814 5814
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
5815 5815
 		    GROUP BY spotter_output.aircraft_manufacturer 
5816 5816
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -5828,24 +5828,24 @@  discard block
 block discarded – undo
5828 5828
 	* @return Array the aircraft list
5829 5829
 	*
5830 5830
 	*/
5831
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5831
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5832 5832
 	{
5833
-		$filter_query = $this->getFilter($filters,true,true);
5834
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5835
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5833
+		$filter_query = $this->getFilter($filters, true, true);
5834
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5835
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5836 5836
 		
5837 5837
 
5838
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5838
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5839 5839
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5840 5840
                     GROUP BY spotter_output.aircraft_name 
5841 5841
 					ORDER BY aircraft_icao_count DESC";
5842 5842
  
5843 5843
 		
5844 5844
 		$sth = $this->db->prepare($query);
5845
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5845
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5846 5846
 		$aircraft_array = array();
5847 5847
 		$temp_array = array();
5848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5849 5849
 		{
5850 5850
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5851 5851
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5861,33 +5861,33 @@  discard block
 block discarded – undo
5861 5861
 	* @return Array the aircraft list
5862 5862
 	*
5863 5863
 	*/
5864
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5864
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5865 5865
 	{
5866
-		$filter_query = $this->getFilter($filters,true,true);
5866
+		$filter_query = $this->getFilter($filters, true, true);
5867 5867
 		$Image = new Image($this->db);
5868
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5869
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5868
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5869
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5870 5870
 
5871
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5871
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5872 5872
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5873 5873
                     GROUP BY spotter_output.registration 
5874 5874
 					ORDER BY registration_count DESC";
5875 5875
 
5876 5876
 		
5877 5877
 		$sth = $this->db->prepare($query);
5878
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5878
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5879 5879
       
5880 5880
 		$aircraft_array = array();
5881 5881
 		$temp_array = array();
5882 5882
         
5883
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5883
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5884 5884
 		{
5885 5885
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5886 5886
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5887 5887
 			$temp_array['registration'] = $row['registration'];
5888 5888
 			$temp_array['airline_name'] = $row['airline_name'];
5889 5889
 			$temp_array['image_thumbnail'] = "";
5890
-			if($row['registration'] != "")
5890
+			if ($row['registration'] != "")
5891 5891
 			{
5892 5892
 				$image_array = $Image->getSpotterImage($row['registration']);
5893 5893
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5907,25 +5907,25 @@  discard block
 block discarded – undo
5907 5907
 	* @return Array the aircraft manufacturer list
5908 5908
 	*
5909 5909
 	*/
5910
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5910
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5911 5911
 	{
5912
-		$filter_query = $this->getFilter($filters,true,true);
5913
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5914
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5912
+		$filter_query = $this->getFilter($filters, true, true);
5913
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5914
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5915 5915
 
5916
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5916
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5917 5917
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5918 5918
                     GROUP BY spotter_output.aircraft_manufacturer 
5919 5919
 					ORDER BY aircraft_manufacturer_count DESC";
5920 5920
 
5921 5921
 		
5922 5922
 		$sth = $this->db->prepare($query);
5923
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5923
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5924 5924
       
5925 5925
 		$aircraft_array = array();
5926 5926
 		$temp_array = array();
5927 5927
         
5928
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5928
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5929 5929
 		{
5930 5930
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5931 5931
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5945,11 +5945,11 @@  discard block
 block discarded – undo
5945 5945
 	* @return Array the aircraft list
5946 5946
 	*
5947 5947
 	*/
5948
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5948
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5949 5949
 	{
5950
-		$filter_query = $this->getFilter($filters,true,true);
5951
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5952
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5950
+		$filter_query = $this->getFilter($filters, true, true);
5951
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5952
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5953 5953
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5954 5954
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5955 5955
 			    ORDER BY aircraft_icao_count DESC";
@@ -5961,7 +5961,7 @@  discard block
 block discarded – undo
5961 5961
 		$aircraft_array = array();
5962 5962
 		$temp_array = array();
5963 5963
         
5964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5965 5965
 		{
5966 5966
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5967 5967
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5980,12 +5980,12 @@  discard block
 block discarded – undo
5980 5980
 	* @return Array the aircraft list
5981 5981
 	*
5982 5982
 	*/
5983
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5983
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5984 5984
 	{
5985
-		$filter_query = $this->getFilter($filters,true,true);
5985
+		$filter_query = $this->getFilter($filters, true, true);
5986 5986
 		$Image = new Image($this->db);
5987
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5988
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5987
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5988
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5989 5989
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5990 5990
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5991 5991
 			    ORDER BY registration_count DESC";
@@ -5997,14 +5997,14 @@  discard block
 block discarded – undo
5997 5997
 		$aircraft_array = array();
5998 5998
 		$temp_array = array();
5999 5999
         
6000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6001 6001
 		{
6002 6002
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6003 6003
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6004 6004
 			$temp_array['registration'] = $row['registration'];
6005 6005
 			$temp_array['airline_name'] = $row['airline_name'];
6006 6006
 			$temp_array['image_thumbnail'] = "";
6007
-			if($row['registration'] != "")
6007
+			if ($row['registration'] != "")
6008 6008
 			{
6009 6009
 				$image_array = $Image->getSpotterImage($row['registration']);
6010 6010
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6024,11 +6024,11 @@  discard block
 block discarded – undo
6024 6024
 	* @return Array the aircraft manufacturer list
6025 6025
 	*
6026 6026
 	*/
6027
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6027
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6028 6028
 	{
6029
-		$filter_query = $this->getFilter($filters,true,true);
6030
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6031
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6029
+		$filter_query = $this->getFilter($filters, true, true);
6030
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6031
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6032 6032
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
6033 6033
                     GROUP BY spotter_output.aircraft_manufacturer 
6034 6034
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6040,7 +6040,7 @@  discard block
 block discarded – undo
6040 6040
 		$aircraft_array = array();
6041 6041
 		$temp_array = array();
6042 6042
         
6043
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6043
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6044 6044
 		{
6045 6045
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6046 6046
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6059,38 +6059,38 @@  discard block
 block discarded – undo
6059 6059
 	* @return Array the aircraft list
6060 6060
 	*
6061 6061
 	*/
6062
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6062
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6063 6063
 	{
6064 6064
 		global $globalDBdriver;
6065
-		$filter_query = $this->getFilter($filters,true,true);
6066
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6065
+		$filter_query = $this->getFilter($filters, true, true);
6066
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6067 6067
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6068 6068
                 $query_values = array();
6069 6069
 		if ($year != '') {
6070 6070
 			if ($globalDBdriver == 'mysql') {
6071 6071
 				$query .= " AND YEAR(spotter_output.date) = :year";
6072
-				$query_values = array_merge($query_values,array(':year' => $year));
6072
+				$query_values = array_merge($query_values, array(':year' => $year));
6073 6073
 			} else {
6074 6074
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6075
-				$query_values = array_merge($query_values,array(':year' => $year));
6075
+				$query_values = array_merge($query_values, array(':year' => $year));
6076 6076
 			}
6077 6077
 		}
6078 6078
 		if ($month != '') {
6079 6079
 			if ($globalDBdriver == 'mysql') {
6080 6080
 				$query .= " AND MONTH(spotter_output.date) = :month";
6081
-				$query_values = array_merge($query_values,array(':month' => $month));
6081
+				$query_values = array_merge($query_values, array(':month' => $month));
6082 6082
 			} else {
6083 6083
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6084
-				$query_values = array_merge($query_values,array(':month' => $month));
6084
+				$query_values = array_merge($query_values, array(':month' => $month));
6085 6085
 			}
6086 6086
 		}
6087 6087
 		if ($day != '') {
6088 6088
 			if ($globalDBdriver == 'mysql') {
6089 6089
 				$query .= " AND DAY(spotter_output.date) = :day";
6090
-				$query_values = array_merge($query_values,array(':day' => $day));
6090
+				$query_values = array_merge($query_values, array(':day' => $day));
6091 6091
 			} else {
6092 6092
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6093
-				$query_values = array_merge($query_values,array(':day' => $day));
6093
+				$query_values = array_merge($query_values, array(':day' => $day));
6094 6094
 			}
6095 6095
 		}
6096 6096
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6104,7 +6104,7 @@  discard block
 block discarded – undo
6104 6104
 		$manufacturer_array = array();
6105 6105
 		$temp_array = array();
6106 6106
         
6107
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6107
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6108 6108
 		{
6109 6109
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6110 6110
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6123,12 +6123,12 @@  discard block
 block discarded – undo
6123 6123
 	* @return Array the aircraft list
6124 6124
 	*
6125 6125
 	*/
6126
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6126
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6127 6127
 	{
6128 6128
 		global $globalDBdriver;
6129 6129
 		$Image = new Image($this->db);
6130
-		$filter_query = $this->getFilter($filters,true,true);
6131
-		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6130
+		$filter_query = $this->getFilter($filters, true, true);
6131
+		$query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6132 6132
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6133 6133
                 if ($olderthanmonths > 0) {
6134 6134
             		if ($globalDBdriver == 'mysql') {
@@ -6148,28 +6148,28 @@  discard block
 block discarded – undo
6148 6148
 		if ($year != '') {
6149 6149
 			if ($globalDBdriver == 'mysql') {
6150 6150
 				$query .= " AND YEAR(spotter_output.date) = :year";
6151
-				$query_values = array_merge($query_values,array(':year' => $year));
6151
+				$query_values = array_merge($query_values, array(':year' => $year));
6152 6152
 			} else {
6153 6153
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6154
-				$query_values = array_merge($query_values,array(':year' => $year));
6154
+				$query_values = array_merge($query_values, array(':year' => $year));
6155 6155
 			}
6156 6156
 		}
6157 6157
 		if ($month != '') {
6158 6158
 			if ($globalDBdriver == 'mysql') {
6159 6159
 				$query .= " AND MONTH(spotter_output.date) = :month";
6160
-				$query_values = array_merge($query_values,array(':month' => $month));
6160
+				$query_values = array_merge($query_values, array(':month' => $month));
6161 6161
 			} else {
6162 6162
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6163
-				$query_values = array_merge($query_values,array(':month' => $month));
6163
+				$query_values = array_merge($query_values, array(':month' => $month));
6164 6164
 			}
6165 6165
 		}
6166 6166
 		if ($day != '') {
6167 6167
 			if ($globalDBdriver == 'mysql') {
6168 6168
 				$query .= " AND DAY(spotter_output.date) = :day";
6169
-				$query_values = array_merge($query_values,array(':day' => $day));
6169
+				$query_values = array_merge($query_values, array(':day' => $day));
6170 6170
 			} else {
6171 6171
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6172
-				$query_values = array_merge($query_values,array(':day' => $day));
6172
+				$query_values = array_merge($query_values, array(':day' => $day));
6173 6173
 			}
6174 6174
 		}
6175 6175
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6181,7 +6181,7 @@  discard block
 block discarded – undo
6181 6181
 		$aircraft_array = array();
6182 6182
 		$temp_array = array();
6183 6183
         
6184
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6184
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6185 6185
 		{
6186 6186
 			$temp_array['registration'] = $row['registration'];
6187 6187
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6189,7 +6189,7 @@  discard block
 block discarded – undo
6189 6189
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6190 6190
 			$temp_array['airline_name'] = $row['airline_name'];
6191 6191
 			$temp_array['image_thumbnail'] = "";
6192
-			if($row['registration'] != "")
6192
+			if ($row['registration'] != "")
6193 6193
 			{
6194 6194
 				$image_array = $Image->getSpotterImage($row['registration']);
6195 6195
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6208,12 +6208,12 @@  discard block
 block discarded – undo
6208 6208
 	* @return Array the aircraft list
6209 6209
 	*
6210 6210
 	*/
6211
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6211
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6212 6212
 	{
6213 6213
 		global $globalDBdriver;
6214
-		$filter_query = $this->getFilter($filters,true,true);
6214
+		$filter_query = $this->getFilter($filters, true, true);
6215 6215
 		$Image = new Image($this->db);
6216
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6216
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
6217 6217
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6218 6218
                 if ($olderthanmonths > 0) {
6219 6219
             		if ($globalDBdriver == 'mysql') {
@@ -6241,7 +6241,7 @@  discard block
 block discarded – undo
6241 6241
 		$aircraft_array = array();
6242 6242
 		$temp_array = array();
6243 6243
         
6244
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6244
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6245 6245
 		{
6246 6246
 			$temp_array['registration'] = $row['registration'];
6247 6247
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6250,7 +6250,7 @@  discard block
 block discarded – undo
6250 6250
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6251 6251
 			$temp_array['airline_name'] = $row['airline_name'];
6252 6252
 			$temp_array['image_thumbnail'] = "";
6253
-			if($row['registration'] != "")
6253
+			if ($row['registration'] != "")
6254 6254
 			{
6255 6255
 				$image_array = $Image->getSpotterImage($row['registration']);
6256 6256
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6269,11 +6269,11 @@  discard block
 block discarded – undo
6269 6269
 	* @return Array the airport list
6270 6270
 	*
6271 6271
 	*/
6272
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6272
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6273 6273
 	{
6274 6274
 		global $globalDBdriver;
6275
-		$filter_query = $this->getFilter($filters,true,true);
6276
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6275
+		$filter_query = $this->getFilter($filters, true, true);
6276
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6277 6277
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6278 6278
                 if ($olderthanmonths > 0) {
6279 6279
             		if ($globalDBdriver == 'mysql') {
@@ -6293,28 +6293,28 @@  discard block
 block discarded – undo
6293 6293
 		if ($year != '') {
6294 6294
 			if ($globalDBdriver == 'mysql') {
6295 6295
 				$query .= " AND YEAR(spotter_output.date) = :year";
6296
-				$query_values = array_merge($query_values,array(':year' => $year));
6296
+				$query_values = array_merge($query_values, array(':year' => $year));
6297 6297
 			} else {
6298 6298
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6299
-				$query_values = array_merge($query_values,array(':year' => $year));
6299
+				$query_values = array_merge($query_values, array(':year' => $year));
6300 6300
 			}
6301 6301
 		}
6302 6302
 		if ($month != '') {
6303 6303
 			if ($globalDBdriver == 'mysql') {
6304 6304
 				$query .= " AND MONTH(spotter_output.date) = :month";
6305
-				$query_values = array_merge($query_values,array(':month' => $month));
6305
+				$query_values = array_merge($query_values, array(':month' => $month));
6306 6306
 			} else {
6307 6307
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6308
-				$query_values = array_merge($query_values,array(':month' => $month));
6308
+				$query_values = array_merge($query_values, array(':month' => $month));
6309 6309
 			}
6310 6310
 		}
6311 6311
 		if ($day != '') {
6312 6312
 			if ($globalDBdriver == 'mysql') {
6313 6313
 				$query .= " AND DAY(spotter_output.date) = :day";
6314
-				$query_values = array_merge($query_values,array(':day' => $day));
6314
+				$query_values = array_merge($query_values, array(':day' => $day));
6315 6315
 			} else {
6316 6316
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6317
-				$query_values = array_merge($query_values,array(':day' => $day));
6317
+				$query_values = array_merge($query_values, array(':day' => $day));
6318 6318
 			}
6319 6319
 		}
6320 6320
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6326,7 +6326,7 @@  discard block
 block discarded – undo
6326 6326
 
6327 6327
 		$airport_array = array();
6328 6328
 		$temp_array = array();
6329
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6329
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6330 6330
 		{
6331 6331
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6332 6332
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6345,11 +6345,11 @@  discard block
 block discarded – undo
6345 6345
 	* @return Array the airport list
6346 6346
 	*
6347 6347
 	*/
6348
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6348
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6349 6349
 	{
6350 6350
 		global $globalDBdriver;
6351
-		$filter_query = $this->getFilter($filters,true,true);
6352
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6351
+		$filter_query = $this->getFilter($filters, true, true);
6352
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6353 6353
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6354 6354
                 if ($olderthanmonths > 0) {
6355 6355
             		if ($globalDBdriver == 'mysql') {
@@ -6378,7 +6378,7 @@  discard block
 block discarded – undo
6378 6378
 		$airport_array = array();
6379 6379
 		$temp_array = array();
6380 6380
         
6381
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6381
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6382 6382
 		{
6383 6383
 			$temp_array['airline_icao'] = $row['airline_icao'];
6384 6384
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6398,11 +6398,11 @@  discard block
 block discarded – undo
6398 6398
 	* @return Array the airport list
6399 6399
 	*
6400 6400
 	*/
6401
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6401
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6402 6402
 	{
6403 6403
 		global $globalDBdriver;
6404
-		$filter_query = $this->getFilter($filters,true,true);
6405
-		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6404
+		$filter_query = $this->getFilter($filters, true, true);
6405
+		$query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6406 6406
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
6407 6407
                 if ($olderthanmonths > 0) {
6408 6408
             		if ($globalDBdriver == 'mysql') {
@@ -6422,28 +6422,28 @@  discard block
 block discarded – undo
6422 6422
 		if ($year != '') {
6423 6423
 			if ($globalDBdriver == 'mysql') {
6424 6424
 				$query .= " AND YEAR(spotter_output.date) = :year";
6425
-				$query_values = array_merge($query_values,array(':year' => $year));
6425
+				$query_values = array_merge($query_values, array(':year' => $year));
6426 6426
 			} else {
6427 6427
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6428
-				$query_values = array_merge($query_values,array(':year' => $year));
6428
+				$query_values = array_merge($query_values, array(':year' => $year));
6429 6429
 			}
6430 6430
 		}
6431 6431
 		if ($month != '') {
6432 6432
 			if ($globalDBdriver == 'mysql') {
6433 6433
 				$query .= " AND MONTH(spotter_output.date) = :month";
6434
-				$query_values = array_merge($query_values,array(':month' => $month));
6434
+				$query_values = array_merge($query_values, array(':month' => $month));
6435 6435
 			} else {
6436 6436
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6437
-				$query_values = array_merge($query_values,array(':month' => $month));
6437
+				$query_values = array_merge($query_values, array(':month' => $month));
6438 6438
 			}
6439 6439
 		}
6440 6440
 		if ($day != '') {
6441 6441
 			if ($globalDBdriver == 'mysql') {
6442 6442
 				$query .= " AND DAY(spotter_output.date) = :day";
6443
-				$query_values = array_merge($query_values,array(':day' => $day));
6443
+				$query_values = array_merge($query_values, array(':day' => $day));
6444 6444
 			} else {
6445 6445
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6446
-				$query_values = array_merge($query_values,array(':day' => $day));
6446
+				$query_values = array_merge($query_values, array(':day' => $day));
6447 6447
 			}
6448 6448
 		}
6449 6449
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6456,7 +6456,7 @@  discard block
 block discarded – undo
6456 6456
 		$airport_array = array();
6457 6457
 		$temp_array = array();
6458 6458
         
6459
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6459
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6460 6460
 		{
6461 6461
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6462 6462
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6475,11 +6475,11 @@  discard block
 block discarded – undo
6475 6475
 	* @return Array the airport list
6476 6476
 	*
6477 6477
 	*/
6478
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6478
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6479 6479
 	{
6480 6480
 		global $globalDBdriver;
6481
-		$filter_query = $this->getFilter($filters,true,true);
6482
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6481
+		$filter_query = $this->getFilter($filters, true, true);
6482
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
6483 6483
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
6484 6484
                 if ($olderthanmonths > 0) {
6485 6485
             		if ($globalDBdriver == 'mysql') {
@@ -6508,7 +6508,7 @@  discard block
 block discarded – undo
6508 6508
 		$airport_array = array();
6509 6509
 		$temp_array = array();
6510 6510
         
6511
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6511
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6512 6512
 		{
6513 6513
 			$temp_array['airline_icao'] = $row['airline_icao'];
6514 6514
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6528,11 +6528,11 @@  discard block
 block discarded – undo
6528 6528
 	* @return Array the airport list
6529 6529
 	*
6530 6530
 	*/
6531
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6531
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6532 6532
 	{
6533
-		$filter_query = $this->getFilter($filters,true,true);
6534
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6535
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6533
+		$filter_query = $this->getFilter($filters, true, true);
6534
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6535
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6536 6536
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' 
6537 6537
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6538 6538
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6544,7 +6544,7 @@  discard block
 block discarded – undo
6544 6544
 		$airport_array = array();
6545 6545
 		$temp_array = array();
6546 6546
         
6547
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6547
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6548 6548
 		{
6549 6549
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6550 6550
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6566,11 +6566,11 @@  discard block
 block discarded – undo
6566 6566
 	* @return Array the airport list
6567 6567
 	*
6568 6568
 	*/
6569
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6569
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6570 6570
 	{
6571
-		$filter_query = $this->getFilter($filters,true,true);
6572
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6573
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6571
+		$filter_query = $this->getFilter($filters, true, true);
6572
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6573
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6574 6574
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6575 6575
                     GROUP BY spotter_output.departure_airport_country
6576 6576
 					ORDER BY airport_departure_country_count DESC";
@@ -6582,7 +6582,7 @@  discard block
 block discarded – undo
6582 6582
 		$airport_array = array();
6583 6583
 		$temp_array = array();
6584 6584
         
6585
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6585
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6586 6586
 		{
6587 6587
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6588 6588
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6601,11 +6601,11 @@  discard block
 block discarded – undo
6601 6601
 	* @return Array the airport list
6602 6602
 	*
6603 6603
 	*/
6604
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6604
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6605 6605
 	{
6606
-		$filter_query = $this->getFilter($filters,true,true);
6607
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6608
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6606
+		$filter_query = $this->getFilter($filters, true, true);
6607
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6608
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6609 6609
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
6610 6610
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6611 6611
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6617,7 +6617,7 @@  discard block
 block discarded – undo
6617 6617
 		$airport_array = array();
6618 6618
 		$temp_array = array();
6619 6619
         
6620
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6620
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6621 6621
 		{
6622 6622
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6623 6623
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6638,11 +6638,11 @@  discard block
 block discarded – undo
6638 6638
 	* @return Array the airport list
6639 6639
 	*
6640 6640
 	*/
6641
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6641
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6642 6642
 	{
6643
-		$filter_query = $this->getFilter($filters,true,true);
6644
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6645
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6643
+		$filter_query = $this->getFilter($filters, true, true);
6644
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6645
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6646 6646
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6647 6647
                     GROUP BY spotter_output.departure_airport_country
6648 6648
 					ORDER BY airport_departure_country_count DESC";
@@ -6654,7 +6654,7 @@  discard block
 block discarded – undo
6654 6654
 		$airport_array = array();
6655 6655
 		$temp_array = array();
6656 6656
         
6657
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6657
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6658 6658
 		{
6659 6659
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6660 6660
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6672,11 +6672,11 @@  discard block
 block discarded – undo
6672 6672
 	* @return Array the airport list
6673 6673
 	*
6674 6674
 	*/
6675
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6675
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
6676 6676
 	{
6677
-		$filter_query = $this->getFilter($filters,true,true);
6678
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6679
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6677
+		$filter_query = $this->getFilter($filters, true, true);
6678
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6679
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6680 6680
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
6681 6681
                     GROUP BY spotter_output.departure_airport_icao
6682 6682
 					ORDER BY airport_departure_icao_count DESC";
@@ -6688,7 +6688,7 @@  discard block
 block discarded – undo
6688 6688
 		$airport_array = array();
6689 6689
 		$temp_array = array();
6690 6690
         
6691
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6691
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6692 6692
 		{
6693 6693
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6694 6694
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6709,11 +6709,11 @@  discard block
 block discarded – undo
6709 6709
 	* @return Array the airport list
6710 6710
 	*
6711 6711
 	*/
6712
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6712
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6713 6713
 	{
6714
-		$filter_query = $this->getFilter($filters,true,true);
6715
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6716
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6714
+		$filter_query = $this->getFilter($filters, true, true);
6715
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6716
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6717 6717
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
6718 6718
                     GROUP BY spotter_output.departure_airport_country
6719 6719
 					ORDER BY airport_departure_country_count DESC";
@@ -6725,7 +6725,7 @@  discard block
 block discarded – undo
6725 6725
 		$airport_array = array();
6726 6726
 		$temp_array = array();
6727 6727
         
6728
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6728
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6729 6729
 		{
6730 6730
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6731 6731
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6743,11 +6743,11 @@  discard block
 block discarded – undo
6743 6743
 	* @return Array the airport list
6744 6744
 	*
6745 6745
 	*/
6746
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6746
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6747 6747
 	{
6748
-		$filter_query = $this->getFilter($filters,true,true);
6749
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6750
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6748
+		$filter_query = $this->getFilter($filters, true, true);
6749
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6750
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6751 6751
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' 
6752 6752
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6753 6753
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6759,7 +6759,7 @@  discard block
 block discarded – undo
6759 6759
 		$airport_array = array();
6760 6760
 		$temp_array = array();
6761 6761
         
6762
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6762
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6763 6763
 		{
6764 6764
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6765 6765
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6780,11 +6780,11 @@  discard block
 block discarded – undo
6780 6780
 	* @return Array the airport list
6781 6781
 	*
6782 6782
 	*/
6783
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6783
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6784 6784
 	{
6785
-		$filter_query = $this->getFilter($filters,true,true);
6786
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6787
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6785
+		$filter_query = $this->getFilter($filters, true, true);
6786
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6787
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6788 6788
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6789 6789
                     GROUP BY spotter_output.departure_airport_country
6790 6790
 					ORDER BY airport_departure_country_count DESC";
@@ -6796,7 +6796,7 @@  discard block
 block discarded – undo
6796 6796
 		$airport_array = array();
6797 6797
 		$temp_array = array();
6798 6798
         
6799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6800 6800
 		{
6801 6801
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6802 6802
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6815,11 +6815,11 @@  discard block
 block discarded – undo
6815 6815
 	* @return Array the airport list
6816 6816
 	*
6817 6817
 	*/
6818
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6818
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6819 6819
 	{
6820
-		$filter_query = $this->getFilter($filters,true,true);
6821
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6822
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6820
+		$filter_query = $this->getFilter($filters, true, true);
6821
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6822
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6823 6823
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' 
6824 6824
                     GROUP BY spotter_output.departure_airport_icao
6825 6825
 					ORDER BY airport_departure_icao_count DESC";
@@ -6831,7 +6831,7 @@  discard block
 block discarded – undo
6831 6831
 		$airport_array = array();
6832 6832
 		$temp_array = array();
6833 6833
         
6834
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6834
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6835 6835
 		{
6836 6836
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6837 6837
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6852,11 +6852,11 @@  discard block
 block discarded – undo
6852 6852
 	* @return Array the airport list
6853 6853
 	*
6854 6854
 	*/
6855
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6855
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6856 6856
 	{
6857
-		$filter_query = $this->getFilter($filters,true,true);
6858
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6859
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6857
+		$filter_query = $this->getFilter($filters, true, true);
6858
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6859
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6860 6860
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6861 6861
                     GROUP BY spotter_output.departure_airport_country
6862 6862
 					ORDER BY airport_departure_country_count DESC";
@@ -6868,7 +6868,7 @@  discard block
 block discarded – undo
6868 6868
 		$airport_array = array();
6869 6869
 		$temp_array = array();
6870 6870
         
6871
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6871
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6872 6872
 		{
6873 6873
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6874 6874
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6886,11 +6886,11 @@  discard block
 block discarded – undo
6886 6886
 	* @return Array the airport list
6887 6887
 	*
6888 6888
 	*/
6889
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6889
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6890 6890
 	{
6891 6891
 		global $globalTimezone, $globalDBdriver;
6892
-		$filter_query = $this->getFilter($filters,true,true);
6893
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6892
+		$filter_query = $this->getFilter($filters, true, true);
6893
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6894 6894
 		if ($globalTimezone != '') {
6895 6895
 			date_default_timezone_set($globalTimezone);
6896 6896
 			$datetime = new DateTime($date);
@@ -6898,12 +6898,12 @@  discard block
 block discarded – undo
6898 6898
 		} else $offset = '+00:00';
6899 6899
 
6900 6900
 		if ($globalDBdriver == 'mysql') {
6901
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6901
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6902 6902
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6903 6903
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6904 6904
 					ORDER BY airport_departure_icao_count DESC";
6905 6905
 		} else {
6906
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6906
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6907 6907
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6908 6908
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6909 6909
 					ORDER BY airport_departure_icao_count DESC";
@@ -6915,7 +6915,7 @@  discard block
 block discarded – undo
6915 6915
 		$airport_array = array();
6916 6916
 		$temp_array = array();
6917 6917
         
6918
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6918
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6919 6919
 		{
6920 6920
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6921 6921
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6936,11 +6936,11 @@  discard block
 block discarded – undo
6936 6936
 	* @return Array the airport list
6937 6937
 	*
6938 6938
 	*/
6939
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6939
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6940 6940
 	{
6941 6941
 		global $globalTimezone, $globalDBdriver;
6942
-		$filter_query = $this->getFilter($filters,true,true);
6943
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6942
+		$filter_query = $this->getFilter($filters, true, true);
6943
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6944 6944
 		if ($globalTimezone != '') {
6945 6945
 			date_default_timezone_set($globalTimezone);
6946 6946
 			$datetime = new DateTime($date);
@@ -6948,12 +6948,12 @@  discard block
 block discarded – undo
6948 6948
 		} else $offset = '+00:00';
6949 6949
 
6950 6950
 		if ($globalDBdriver == 'mysql') {
6951
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6951
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6952 6952
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6953 6953
 					GROUP BY spotter_output.departure_airport_country
6954 6954
 					ORDER BY airport_departure_country_count DESC";
6955 6955
 		} else {
6956
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6956
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6957 6957
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6958 6958
 					GROUP BY spotter_output.departure_airport_country
6959 6959
 					ORDER BY airport_departure_country_count DESC";
@@ -6965,7 +6965,7 @@  discard block
 block discarded – undo
6965 6965
 		$airport_array = array();
6966 6966
 		$temp_array = array();
6967 6967
         
6968
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6968
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6969 6969
 		{
6970 6970
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6971 6971
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6983,11 +6983,11 @@  discard block
 block discarded – undo
6983 6983
 	* @return Array the airport list
6984 6984
 	*
6985 6985
 	*/
6986
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6986
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6987 6987
 	{
6988
-		$filter_query = $this->getFilter($filters,true,true);
6989
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6990
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6988
+		$filter_query = $this->getFilter($filters, true, true);
6989
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6990
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6991 6991
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident 
6992 6992
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6993 6993
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6999,7 +6999,7 @@  discard block
 block discarded – undo
6999 6999
 		$airport_array = array();
7000 7000
 		$temp_array = array();
7001 7001
         
7002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7003 7003
 		{
7004 7004
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7005 7005
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7019,11 +7019,11 @@  discard block
 block discarded – undo
7019 7019
 	* @return Array the airport list
7020 7020
 	*
7021 7021
 	*/
7022
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7022
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7023 7023
 	{
7024
-		$filter_query = $this->getFilter($filters,true,true);
7025
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7026
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7024
+		$filter_query = $this->getFilter($filters, true, true);
7025
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7026
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7027 7027
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.owner_name = :owner 
7028 7028
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7029 7029
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7035,7 +7035,7 @@  discard block
 block discarded – undo
7035 7035
 		$airport_array = array();
7036 7036
 		$temp_array = array();
7037 7037
         
7038
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7038
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7039 7039
 		{
7040 7040
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7041 7041
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7055,11 +7055,11 @@  discard block
 block discarded – undo
7055 7055
 	* @return Array the airport list
7056 7056
 	*
7057 7057
 	*/
7058
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7058
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7059 7059
 	{
7060
-		$filter_query = $this->getFilter($filters,true,true);
7061
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7062
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7060
+		$filter_query = $this->getFilter($filters, true, true);
7061
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7062
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7063 7063
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7064 7064
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7065 7065
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7070,7 +7070,7 @@  discard block
 block discarded – undo
7070 7070
 		$airport_array = array();
7071 7071
 		$temp_array = array();
7072 7072
         
7073
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7073
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7074 7074
 		{
7075 7075
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7076 7076
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7092,11 +7092,11 @@  discard block
 block discarded – undo
7092 7092
 	* @return Array the airport list
7093 7093
 	*
7094 7094
 	*/
7095
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7095
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7096 7096
 	{
7097
-		$filter_query = $this->getFilter($filters,true,true);
7098
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7099
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7097
+		$filter_query = $this->getFilter($filters, true, true);
7098
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7099
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7100 7100
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7101 7101
                     GROUP BY spotter_output.departure_airport_country
7102 7102
 					ORDER BY airport_departure_country_count DESC";
@@ -7108,7 +7108,7 @@  discard block
 block discarded – undo
7108 7108
 		$airport_array = array();
7109 7109
 		$temp_array = array();
7110 7110
         
7111
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7111
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7112 7112
 		{
7113 7113
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7114 7114
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7125,11 +7125,11 @@  discard block
 block discarded – undo
7125 7125
 	* @return Array the airport list
7126 7126
 	*
7127 7127
 	*/
7128
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7128
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7129 7129
 	{
7130
-		$filter_query = $this->getFilter($filters,true,true);
7131
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7132
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7130
+		$filter_query = $this->getFilter($filters, true, true);
7131
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7132
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7133 7133
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7134 7134
 			GROUP BY spotter_output.departure_airport_country
7135 7135
 			ORDER BY airport_departure_country_count DESC";
@@ -7145,11 +7145,11 @@  discard block
 block discarded – undo
7145 7145
 	* @return Array the airport list
7146 7146
 	*
7147 7147
 	*/
7148
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7148
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7149 7149
 	{
7150
-		$filter_query = $this->getFilter($filters,true,true);
7151
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7152
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7150
+		$filter_query = $this->getFilter($filters, true, true);
7151
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7152
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7153 7153
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7154 7154
 			GROUP BY spotter_output.departure_airport_country
7155 7155
 			ORDER BY airport_departure_country_count DESC";
@@ -7167,12 +7167,12 @@  discard block
 block discarded – undo
7167 7167
 	* @return Array the airport list
7168 7168
 	*
7169 7169
 	*/
7170
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7170
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7171 7171
 	{
7172
-		$filter_query = $this->getFilter($filters,true,true);
7173
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7172
+		$filter_query = $this->getFilter($filters, true, true);
7173
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7174 7174
 
7175
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7175
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7176 7176
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7177 7177
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7178 7178
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7184,7 +7184,7 @@  discard block
 block discarded – undo
7184 7184
 		$airport_array = array();
7185 7185
 		$temp_array = array();
7186 7186
         
7187
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7187
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7188 7188
 		{
7189 7189
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7190 7190
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7205,11 +7205,11 @@  discard block
 block discarded – undo
7205 7205
 	* @return Array the airport list
7206 7206
 	*
7207 7207
 	*/
7208
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7208
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7209 7209
 	{
7210
-		$filter_query = $this->getFilter($filters,true,true);
7211
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7212
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7210
+		$filter_query = $this->getFilter($filters, true, true);
7211
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7212
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7213 7213
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7214 7214
                     GROUP BY spotter_output.departure_airport_country
7215 7215
 					ORDER BY airport_departure_country_count DESC";
@@ -7221,7 +7221,7 @@  discard block
 block discarded – undo
7221 7221
 		$airport_array = array();
7222 7222
 		$temp_array = array();
7223 7223
         
7224
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7224
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7225 7225
 		{
7226 7226
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7227 7227
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7244,11 +7244,11 @@  discard block
 block discarded – undo
7244 7244
 	* @return Array the airport list
7245 7245
 	*
7246 7246
 	*/
7247
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7247
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7248 7248
 	{
7249 7249
 		global $globalDBdriver;
7250
-		$filter_query = $this->getFilter($filters,true,true);
7251
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7250
+		$filter_query = $this->getFilter($filters, true, true);
7251
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7252 7252
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7253 7253
                 if ($olderthanmonths > 0) {
7254 7254
             		if ($globalDBdriver == 'mysql') {
@@ -7268,28 +7268,28 @@  discard block
 block discarded – undo
7268 7268
 		if ($year != '') {
7269 7269
 			if ($globalDBdriver == 'mysql') {
7270 7270
 				$query .= " AND YEAR(spotter_output.date) = :year";
7271
-				$query_values = array_merge($query_values,array(':year' => $year));
7271
+				$query_values = array_merge($query_values, array(':year' => $year));
7272 7272
 			} else {
7273 7273
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7274
-				$query_values = array_merge($query_values,array(':year' => $year));
7274
+				$query_values = array_merge($query_values, array(':year' => $year));
7275 7275
 			}
7276 7276
 		}
7277 7277
 		if ($month != '') {
7278 7278
 			if ($globalDBdriver == 'mysql') {
7279 7279
 				$query .= " AND MONTH(spotter_output.date) = :month";
7280
-				$query_values = array_merge($query_values,array(':month' => $month));
7280
+				$query_values = array_merge($query_values, array(':month' => $month));
7281 7281
 			} else {
7282 7282
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7283
-				$query_values = array_merge($query_values,array(':month' => $month));
7283
+				$query_values = array_merge($query_values, array(':month' => $month));
7284 7284
 			}
7285 7285
 		}
7286 7286
 		if ($day != '') {
7287 7287
 			if ($globalDBdriver == 'mysql') {
7288 7288
 				$query .= " AND DAY(spotter_output.date) = :day";
7289
-				$query_values = array_merge($query_values,array(':day' => $day));
7289
+				$query_values = array_merge($query_values, array(':day' => $day));
7290 7290
 			} else {
7291 7291
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7292
-				$query_values = array_merge($query_values,array(':day' => $day));
7292
+				$query_values = array_merge($query_values, array(':day' => $day));
7293 7293
 			}
7294 7294
 		}
7295 7295
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7303,7 +7303,7 @@  discard block
 block discarded – undo
7303 7303
 		$airport_array = array();
7304 7304
 		$temp_array = array();
7305 7305
         
7306
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7306
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7307 7307
 		{
7308 7308
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7309 7309
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7326,11 +7326,11 @@  discard block
 block discarded – undo
7326 7326
 	* @return Array the airport list
7327 7327
 	*
7328 7328
 	*/
7329
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7329
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7330 7330
 	{
7331 7331
 		global $globalDBdriver;
7332
-		$filter_query = $this->getFilter($filters,true,true);
7333
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7332
+		$filter_query = $this->getFilter($filters, true, true);
7333
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7334 7334
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7335 7335
                 if ($olderthanmonths > 0) {
7336 7336
             		if ($globalDBdriver == 'mysql') {
@@ -7360,7 +7360,7 @@  discard block
 block discarded – undo
7360 7360
 		$airport_array = array();
7361 7361
 		$temp_array = array();
7362 7362
         
7363
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7363
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7364 7364
 		{
7365 7365
 			$temp_array['airline_icao'] = $row['airline_icao'];
7366 7366
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7385,11 +7385,11 @@  discard block
 block discarded – undo
7385 7385
 	* @return Array the airport list
7386 7386
 	*
7387 7387
 	*/
7388
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7388
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7389 7389
 	{
7390 7390
 		global $globalDBdriver;
7391
-		$filter_query = $this->getFilter($filters,true,true);
7392
-		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7391
+		$filter_query = $this->getFilter($filters, true, true);
7392
+		$query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7393 7393
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
7394 7394
                 if ($olderthanmonths > 0) {
7395 7395
             		if ($globalDBdriver == 'mysql') {
@@ -7409,28 +7409,28 @@  discard block
 block discarded – undo
7409 7409
 		if ($year != '') {
7410 7410
 			if ($globalDBdriver == 'mysql') {
7411 7411
 				$query .= " AND YEAR(spotter_output.date) = :year";
7412
-				$query_values = array_merge($query_values,array(':year' => $year));
7412
+				$query_values = array_merge($query_values, array(':year' => $year));
7413 7413
 			} else {
7414 7414
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7415
-				$query_values = array_merge($query_values,array(':year' => $year));
7415
+				$query_values = array_merge($query_values, array(':year' => $year));
7416 7416
 			}
7417 7417
 		}
7418 7418
 		if ($month != '') {
7419 7419
 			if ($globalDBdriver == 'mysql') {
7420 7420
 				$query .= " AND MONTH(spotter_output.date) = :month";
7421
-				$query_values = array_merge($query_values,array(':month' => $month));
7421
+				$query_values = array_merge($query_values, array(':month' => $month));
7422 7422
 			} else {
7423 7423
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7424
-				$query_values = array_merge($query_values,array(':month' => $month));
7424
+				$query_values = array_merge($query_values, array(':month' => $month));
7425 7425
 			}
7426 7426
 		}
7427 7427
 		if ($day != '') {
7428 7428
 			if ($globalDBdriver == 'mysql') {
7429 7429
 				$query .= " AND DAY(spotter_output.date) = :day";
7430
-				$query_values = array_merge($query_values,array(':day' => $day));
7430
+				$query_values = array_merge($query_values, array(':day' => $day));
7431 7431
 			} else {
7432 7432
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7433
-				$query_values = array_merge($query_values,array(':day' => $day));
7433
+				$query_values = array_merge($query_values, array(':day' => $day));
7434 7434
 			}
7435 7435
 		}
7436 7436
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7443,7 +7443,7 @@  discard block
 block discarded – undo
7443 7443
       
7444 7444
 		$airport_array = array();
7445 7445
 		$temp_array = array();
7446
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7446
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7447 7447
 		{
7448 7448
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7449 7449
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7466,11 +7466,11 @@  discard block
 block discarded – undo
7466 7466
 	* @return Array the airport list
7467 7467
 	*
7468 7468
 	*/
7469
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7469
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7470 7470
 	{
7471 7471
 		global $globalDBdriver;
7472
-		$filter_query = $this->getFilter($filters,true,true);
7473
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7472
+		$filter_query = $this->getFilter($filters, true, true);
7473
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
7474 7474
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
7475 7475
                 if ($olderthanmonths > 0) {
7476 7476
             		if ($globalDBdriver == 'mysql') {
@@ -7500,7 +7500,7 @@  discard block
 block discarded – undo
7500 7500
 		$airport_array = array();
7501 7501
 		$temp_array = array();
7502 7502
         
7503
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7503
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7504 7504
 		{
7505 7505
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7506 7506
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7526,9 +7526,9 @@  discard block
 block discarded – undo
7526 7526
 	*/
7527 7527
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7528 7528
 	{
7529
-		$filter_query = $this->getFilter($filters,true,true);
7530
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7531
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7529
+		$filter_query = $this->getFilter($filters, true, true);
7530
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7531
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7532 7532
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao 
7533 7533
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7534 7534
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7539,7 +7539,7 @@  discard block
 block discarded – undo
7539 7539
 		$airport_array = array();
7540 7540
 		$temp_array = array();
7541 7541
         
7542
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7542
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7543 7543
 		{
7544 7544
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7545 7545
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7560,12 +7560,12 @@  discard block
 block discarded – undo
7560 7560
 	* @return Array the airport list
7561 7561
 	*
7562 7562
 	*/
7563
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7563
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7564 7564
 	{
7565
-		$filter_query = $this->getFilter($filters,true,true);
7566
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7565
+		$filter_query = $this->getFilter($filters, true, true);
7566
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7567 7567
 					
7568
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7568
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7569 7569
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7570 7570
                     GROUP BY spotter_output.arrival_airport_country
7571 7571
 					ORDER BY airport_arrival_country_count DESC";
@@ -7577,7 +7577,7 @@  discard block
 block discarded – undo
7577 7577
 		$airport_array = array();
7578 7578
 		$temp_array = array();
7579 7579
         
7580
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7580
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7581 7581
 		{
7582 7582
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7583 7583
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7595,11 +7595,11 @@  discard block
 block discarded – undo
7595 7595
 	* @return Array the airport list
7596 7596
 	*
7597 7597
 	*/
7598
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7598
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7599 7599
 	{
7600
-		$filter_query = $this->getFilter($filters,true,true);
7601
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7602
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7600
+		$filter_query = $this->getFilter($filters, true, true);
7601
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7602
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7603 7603
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7604 7604
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7605 7605
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7611,7 +7611,7 @@  discard block
 block discarded – undo
7611 7611
 		$airport_array = array();
7612 7612
 		$temp_array = array();
7613 7613
         
7614
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7614
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7615 7615
 		{
7616 7616
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7617 7617
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7633,11 +7633,11 @@  discard block
 block discarded – undo
7633 7633
 	* @return Array the airport list
7634 7634
 	*
7635 7635
 	*/
7636
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7636
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
7637 7637
 	{
7638
-		$filter_query = $this->getFilter($filters,true,true);
7639
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7640
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7638
+		$filter_query = $this->getFilter($filters, true, true);
7639
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7640
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7641 7641
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7642 7642
                     GROUP BY spotter_output.arrival_airport_country
7643 7643
 					ORDER BY airport_arrival_country_count DESC";
@@ -7649,7 +7649,7 @@  discard block
 block discarded – undo
7649 7649
 		$airport_array = array();
7650 7650
 		$temp_array = array();
7651 7651
         
7652
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7652
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7653 7653
 		{
7654 7654
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7655 7655
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7667,12 +7667,12 @@  discard block
 block discarded – undo
7667 7667
 	* @return Array the airport list
7668 7668
 	*
7669 7669
 	*/
7670
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7670
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
7671 7671
 	{
7672
-		$filter_query = $this->getFilter($filters,true,true);
7673
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7672
+		$filter_query = $this->getFilter($filters, true, true);
7673
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7674 7674
 
7675
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7675
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7676 7676
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration 
7677 7677
                     GROUP BY spotter_output.arrival_airport_icao
7678 7678
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7684,7 +7684,7 @@  discard block
 block discarded – undo
7684 7684
 		$airport_array = array();
7685 7685
 		$temp_array = array();
7686 7686
         
7687
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7687
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7688 7688
 		{
7689 7689
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7690 7690
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7705,11 +7705,11 @@  discard block
 block discarded – undo
7705 7705
 	* @return Array the airport list
7706 7706
 	*
7707 7707
 	*/
7708
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7708
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
7709 7709
 	{
7710
-		$filter_query = $this->getFilter($filters,true,true);
7711
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7712
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7710
+		$filter_query = $this->getFilter($filters, true, true);
7711
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7712
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7713 7713
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
7714 7714
                     GROUP BY spotter_output.arrival_airport_country
7715 7715
 					ORDER BY airport_arrival_country_count DESC";
@@ -7721,7 +7721,7 @@  discard block
 block discarded – undo
7721 7721
 		$airport_array = array();
7722 7722
 		$temp_array = array();
7723 7723
         
7724
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7724
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7725 7725
 		{
7726 7726
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7727 7727
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7740,11 +7740,11 @@  discard block
 block discarded – undo
7740 7740
 	* @return Array the airport list
7741 7741
 	*
7742 7742
 	*/
7743
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7743
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
7744 7744
 	{
7745
-		$filter_query = $this->getFilter($filters,true,true);
7746
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7747
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7745
+		$filter_query = $this->getFilter($filters, true, true);
7746
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7747
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7748 7748
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao 
7749 7749
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7750 7750
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7756,7 +7756,7 @@  discard block
 block discarded – undo
7756 7756
 		$airport_array = array();
7757 7757
 		$temp_array = array();
7758 7758
         
7759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7760 7760
 		{
7761 7761
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7762 7762
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7777,11 +7777,11 @@  discard block
 block discarded – undo
7777 7777
 	* @return Array the airport list
7778 7778
 	*
7779 7779
 	*/
7780
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7780
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
7781 7781
 	{
7782
-		$filter_query = $this->getFilter($filters,true,true);
7783
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7784
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7782
+		$filter_query = $this->getFilter($filters, true, true);
7783
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7784
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7785 7785
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
7786 7786
                     GROUP BY spotter_output.arrival_airport_country
7787 7787
 					ORDER BY airport_arrival_country_count DESC";
@@ -7793,7 +7793,7 @@  discard block
 block discarded – undo
7793 7793
 		$airport_array = array();
7794 7794
 		$temp_array = array();
7795 7795
         
7796
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7796
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7797 7797
 		{
7798 7798
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7799 7799
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7811,11 +7811,11 @@  discard block
 block discarded – undo
7811 7811
 	* @return Array the airport list
7812 7812
 	*
7813 7813
 	*/
7814
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7814
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7815 7815
 	{
7816
-		$filter_query = $this->getFilter($filters,true,true);
7817
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7818
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7816
+		$filter_query = $this->getFilter($filters, true, true);
7817
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7818
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7819 7819
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7820 7820
                     GROUP BY spotter_output.arrival_airport_icao
7821 7821
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7827,7 +7827,7 @@  discard block
 block discarded – undo
7827 7827
 		$airport_array = array();
7828 7828
 		$temp_array = array();
7829 7829
         
7830
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7830
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7831 7831
 		{
7832 7832
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7833 7833
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7849,11 +7849,11 @@  discard block
 block discarded – undo
7849 7849
 	* @return Array the airport list
7850 7850
 	*
7851 7851
 	*/
7852
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7852
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7853 7853
 	{
7854
-		$filter_query = $this->getFilter($filters,true,true);
7855
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7856
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7854
+		$filter_query = $this->getFilter($filters, true, true);
7855
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7856
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7857 7857
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7858 7858
                     GROUP BY spotter_output.arrival_airport_country
7859 7859
 					ORDER BY airport_arrival_country_count DESC";
@@ -7865,7 +7865,7 @@  discard block
 block discarded – undo
7865 7865
 		$airport_array = array();
7866 7866
 		$temp_array = array();
7867 7867
         
7868
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7868
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7869 7869
 		{
7870 7870
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7871 7871
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7884,11 +7884,11 @@  discard block
 block discarded – undo
7884 7884
 	* @return Array the airport list
7885 7885
 	*
7886 7886
 	*/
7887
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7887
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7888 7888
 	{
7889 7889
 		global $globalTimezone, $globalDBdriver;
7890
-		$filter_query = $this->getFilter($filters,true,true);
7891
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7890
+		$filter_query = $this->getFilter($filters, true, true);
7891
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7892 7892
 		if ($globalTimezone != '') {
7893 7893
 			date_default_timezone_set($globalTimezone);
7894 7894
 			$datetime = new DateTime($date);
@@ -7896,12 +7896,12 @@  discard block
 block discarded – undo
7896 7896
 		} else $offset = '+00:00';
7897 7897
 
7898 7898
 		if ($globalDBdriver == 'mysql') {
7899
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7899
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7900 7900
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7901 7901
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7902 7902
 					ORDER BY airport_arrival_icao_count DESC";
7903 7903
 		} else {
7904
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7904
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7905 7905
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7906 7906
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7907 7907
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7913,7 +7913,7 @@  discard block
 block discarded – undo
7913 7913
 		$airport_array = array();
7914 7914
 		$temp_array = array();
7915 7915
         
7916
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7916
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7917 7917
 		{
7918 7918
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7919 7919
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7937,8 +7937,8 @@  discard block
 block discarded – undo
7937 7937
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7938 7938
 	{
7939 7939
 		global $globalTimezone, $globalDBdriver;
7940
-		$filter_query = $this->getFilter($filters,true,true);
7941
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7940
+		$filter_query = $this->getFilter($filters, true, true);
7941
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7942 7942
 		if ($globalTimezone != '') {
7943 7943
 			date_default_timezone_set($globalTimezone);
7944 7944
 			$datetime = new DateTime($date);
@@ -7946,12 +7946,12 @@  discard block
 block discarded – undo
7946 7946
 		} else $offset = '+00:00';
7947 7947
 
7948 7948
 		if ($globalDBdriver == 'mysql') {
7949
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7949
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7950 7950
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7951 7951
 					GROUP BY spotter_output.arrival_airport_country
7952 7952
 					ORDER BY airport_arrival_country_count DESC";
7953 7953
 		} else {
7954
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7954
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7955 7955
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
7956 7956
 					GROUP BY spotter_output.arrival_airport_country
7957 7957
 					ORDER BY airport_arrival_country_count DESC";
@@ -7963,7 +7963,7 @@  discard block
 block discarded – undo
7963 7963
 		$airport_array = array();
7964 7964
 		$temp_array = array();
7965 7965
         
7966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7967 7967
 		{
7968 7968
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7969 7969
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7981,11 +7981,11 @@  discard block
 block discarded – undo
7981 7981
 	* @return Array the airport list
7982 7982
 	*
7983 7983
 	*/
7984
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7984
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7985 7985
 	{
7986
-		$filter_query = $this->getFilter($filters,true,true);
7987
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7988
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7986
+		$filter_query = $this->getFilter($filters, true, true);
7987
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7988
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7989 7989
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
7990 7990
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7991 7991
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7997,7 +7997,7 @@  discard block
 block discarded – undo
7997 7997
 		$airport_array = array();
7998 7998
 		$temp_array = array();
7999 7999
         
8000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8001 8001
 		{
8002 8002
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8003 8003
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8017,11 +8017,11 @@  discard block
 block discarded – undo
8017 8017
 	* @return Array the airport list
8018 8018
 	*
8019 8019
 	*/
8020
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8020
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8021 8021
 	{
8022
-		$filter_query = $this->getFilter($filters,true,true);
8023
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8024
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8022
+		$filter_query = $this->getFilter($filters, true, true);
8023
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8024
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8025 8025
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.owner_name = :owner 
8026 8026
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8027 8027
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8032,7 +8032,7 @@  discard block
 block discarded – undo
8032 8032
 		$airport_array = array();
8033 8033
 		$temp_array = array();
8034 8034
         
8035
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8035
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8036 8036
 		{
8037 8037
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8038 8038
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8052,11 +8052,11 @@  discard block
 block discarded – undo
8052 8052
 	* @return Array the airport list
8053 8053
 	*
8054 8054
 	*/
8055
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8055
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8056 8056
 	{
8057
-		$filter_query = $this->getFilter($filters,true,true);
8058
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8059
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8057
+		$filter_query = $this->getFilter($filters, true, true);
8058
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8059
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8060 8060
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8061 8061
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8062 8062
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8067,7 +8067,7 @@  discard block
 block discarded – undo
8067 8067
 		$airport_array = array();
8068 8068
 		$temp_array = array();
8069 8069
         
8070
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8070
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8071 8071
 		{
8072 8072
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8073 8073
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8089,9 +8089,9 @@  discard block
 block discarded – undo
8089 8089
 	*/
8090 8090
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8091 8091
 	{
8092
-		$filter_query = $this->getFilter($filters,true,true);
8093
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8094
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8092
+		$filter_query = $this->getFilter($filters, true, true);
8093
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8094
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8095 8095
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8096 8096
                     GROUP BY spotter_output.arrival_airport_country
8097 8097
 					ORDER BY airport_arrival_country_count DESC";
@@ -8103,7 +8103,7 @@  discard block
 block discarded – undo
8103 8103
 		$airport_array = array();
8104 8104
 		$temp_array = array();
8105 8105
         
8106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8107 8107
 		{
8108 8108
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8109 8109
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8122,9 +8122,9 @@  discard block
 block discarded – undo
8122 8122
 	*/
8123 8123
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8124 8124
 	{
8125
-		$filter_query = $this->getFilter($filters,true,true);
8126
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8127
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8125
+		$filter_query = $this->getFilter($filters, true, true);
8126
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8127
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8128 8128
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8129 8129
                     GROUP BY spotter_output.arrival_airport_country
8130 8130
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8142,9 +8142,9 @@  discard block
 block discarded – undo
8142 8142
 	*/
8143 8143
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8144 8144
 	{
8145
-		$filter_query = $this->getFilter($filters,true,true);
8146
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8147
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8145
+		$filter_query = $this->getFilter($filters, true, true);
8146
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8147
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8148 8148
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8149 8149
                     GROUP BY spotter_output.arrival_airport_country
8150 8150
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8162,11 +8162,11 @@  discard block
 block discarded – undo
8162 8162
 	* @return Array the airport list
8163 8163
 	*
8164 8164
 	*/
8165
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8165
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8166 8166
 	{
8167
-		$filter_query = $this->getFilter($filters,true,true);
8168
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8169
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8167
+		$filter_query = $this->getFilter($filters, true, true);
8168
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8169
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8170 8170
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8171 8171
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8172 8172
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8178,7 +8178,7 @@  discard block
 block discarded – undo
8178 8178
 		$airport_array = array();
8179 8179
 		$temp_array = array();
8180 8180
         
8181
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8181
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8182 8182
 		{
8183 8183
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8184 8184
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8199,12 +8199,12 @@  discard block
 block discarded – undo
8199 8199
 	* @return Array the airport list
8200 8200
 	*
8201 8201
 	*/
8202
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8202
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8203 8203
 	{
8204 8204
 		global $globalDBdriver;
8205
-		$filter_query = $this->getFilter($filters,true,true);
8206
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8207
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8205
+		$filter_query = $this->getFilter($filters, true, true);
8206
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8207
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8208 8208
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
8209 8209
                     GROUP BY spotter_output.arrival_airport_country
8210 8210
 					ORDER BY airport_arrival_country_count DESC";
@@ -8216,7 +8216,7 @@  discard block
 block discarded – undo
8216 8216
 		$airport_array = array();
8217 8217
 		$temp_array = array();
8218 8218
         
8219
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8219
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8220 8220
 		{
8221 8221
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8222 8222
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8235,38 +8235,38 @@  discard block
 block discarded – undo
8235 8235
 	* @return Array the airport departure list
8236 8236
 	*
8237 8237
 	*/
8238
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8238
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8239 8239
 	{
8240 8240
 		global $globalDBdriver;
8241
-		$filter_query = $this->getFilter($filters,true,true);
8242
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8241
+		$filter_query = $this->getFilter($filters, true, true);
8242
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8243 8243
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8244 8244
 		$query_values = array();
8245 8245
 		if ($year != '') {
8246 8246
 			if ($globalDBdriver == 'mysql') {
8247 8247
 				$query .= " AND YEAR(spotter_output.date) = :year";
8248
-				$query_values = array_merge($query_values,array(':year' => $year));
8248
+				$query_values = array_merge($query_values, array(':year' => $year));
8249 8249
 			} else {
8250 8250
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8251
-				$query_values = array_merge($query_values,array(':year' => $year));
8251
+				$query_values = array_merge($query_values, array(':year' => $year));
8252 8252
 			}
8253 8253
 		}
8254 8254
 		if ($month != '') {
8255 8255
 			if ($globalDBdriver == 'mysql') {
8256 8256
 				$query .= " AND MONTH(spotter_output.date) = :month";
8257
-				$query_values = array_merge($query_values,array(':month' => $month));
8257
+				$query_values = array_merge($query_values, array(':month' => $month));
8258 8258
 			} else {
8259 8259
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8260
-				$query_values = array_merge($query_values,array(':month' => $month));
8260
+				$query_values = array_merge($query_values, array(':month' => $month));
8261 8261
 			}
8262 8262
 		}
8263 8263
 		if ($day != '') {
8264 8264
 			if ($globalDBdriver == 'mysql') {
8265 8265
 				$query .= " AND DAY(spotter_output.date) = :day";
8266
-				$query_values = array_merge($query_values,array(':day' => $day));
8266
+				$query_values = array_merge($query_values, array(':day' => $day));
8267 8267
 			} else {
8268 8268
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8269
-				$query_values = array_merge($query_values,array(':day' => $day));
8269
+				$query_values = array_merge($query_values, array(':day' => $day));
8270 8270
 			}
8271 8271
 		}
8272 8272
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -8280,7 +8280,7 @@  discard block
 block discarded – undo
8280 8280
 		$airport_array = array();
8281 8281
 		$temp_array = array();
8282 8282
         
8283
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8283
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8284 8284
 		{
8285 8285
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8286 8286
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8298,38 +8298,38 @@  discard block
 block discarded – undo
8298 8298
 	* @return Array the airport arrival list
8299 8299
 	*
8300 8300
 	*/
8301
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8301
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8302 8302
 	{
8303 8303
 		global $globalDBdriver;
8304
-		$filter_query = $this->getFilter($filters,true,true);
8305
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8304
+		$filter_query = $this->getFilter($filters, true, true);
8305
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8306 8306
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8307 8307
 		$query_values = array();
8308 8308
 		if ($year != '') {
8309 8309
 			if ($globalDBdriver == 'mysql') {
8310 8310
 				$query .= " AND YEAR(spotter_output.date) = :year";
8311
-				$query_values = array_merge($query_values,array(':year' => $year));
8311
+				$query_values = array_merge($query_values, array(':year' => $year));
8312 8312
 			} else {
8313 8313
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8314
-				$query_values = array_merge($query_values,array(':year' => $year));
8314
+				$query_values = array_merge($query_values, array(':year' => $year));
8315 8315
 			}
8316 8316
 		}
8317 8317
 		if ($month != '') {
8318 8318
 			if ($globalDBdriver == 'mysql') {
8319 8319
 				$query .= " AND MONTH(spotter_output.date) = :month";
8320
-				$query_values = array_merge($query_values,array(':month' => $month));
8320
+				$query_values = array_merge($query_values, array(':month' => $month));
8321 8321
 			} else {
8322 8322
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8323
-				$query_values = array_merge($query_values,array(':month' => $month));
8323
+				$query_values = array_merge($query_values, array(':month' => $month));
8324 8324
 			}
8325 8325
 		}
8326 8326
 		if ($day != '') {
8327 8327
 			if ($globalDBdriver == 'mysql') {
8328 8328
 				$query .= " AND DAY(spotter_output.date) = :day";
8329
-				$query_values = array_merge($query_values,array(':day' => $day));
8329
+				$query_values = array_merge($query_values, array(':day' => $day));
8330 8330
 			} else {
8331 8331
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8332
-				$query_values = array_merge($query_values,array(':day' => $day));
8332
+				$query_values = array_merge($query_values, array(':day' => $day));
8333 8333
 			}
8334 8334
 		}
8335 8335
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -8343,7 +8343,7 @@  discard block
 block discarded – undo
8343 8343
 		$airport_array = array();
8344 8344
 		$temp_array = array();
8345 8345
         
8346
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8346
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8347 8347
 		{
8348 8348
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8349 8349
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8366,8 +8366,8 @@  discard block
 block discarded – undo
8366 8366
 	*/
8367 8367
 	public function countAllRoutes($filters = array())
8368 8368
 	{
8369
-		$filter_query = $this->getFilter($filters,true,true);
8370
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8369
+		$filter_query = $this->getFilter($filters, true, true);
8370
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8371 8371
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''
8372 8372
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
8373 8373
                     ORDER BY route_count DESC
@@ -8380,7 +8380,7 @@  discard block
 block discarded – undo
8380 8380
 		$routes_array = array();
8381 8381
 		$temp_array = array();
8382 8382
         
8383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8384 8384
 		{
8385 8385
 			$temp_array['route_count'] = $row['route_count'];
8386 8386
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8407,11 +8407,11 @@  discard block
 block discarded – undo
8407 8407
 	* @return Array the route list
8408 8408
 	*
8409 8409
 	*/
8410
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8410
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8411 8411
 	{
8412
-		$filter_query = $this->getFilter($filters,true,true);
8413
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8414
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8412
+		$filter_query = $this->getFilter($filters, true, true);
8413
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8414
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8415 8415
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8416 8416
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8417 8417
 			    ORDER BY route_count DESC";
@@ -8422,7 +8422,7 @@  discard block
 block discarded – undo
8422 8422
 		$routes_array = array();
8423 8423
 		$temp_array = array();
8424 8424
         
8425
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8425
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8426 8426
 		{
8427 8427
 			$temp_array['route_count'] = $row['route_count'];
8428 8428
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8449,9 +8449,9 @@  discard block
 block discarded – undo
8449 8449
 	*/
8450 8450
 	public function countAllRoutesByRegistration($registration, $filters = array())
8451 8451
 	{
8452
-		$filter_query = $this->getFilter($filters,true,true);
8452
+		$filter_query = $this->getFilter($filters, true, true);
8453 8453
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8454
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8454
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8455 8455
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8456 8456
                     GROUP BY route
8457 8457
                     ORDER BY route_count DESC";
@@ -8463,7 +8463,7 @@  discard block
 block discarded – undo
8463 8463
 		$routes_array = array();
8464 8464
 		$temp_array = array();
8465 8465
         
8466
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8466
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8467 8467
 		{
8468 8468
 			$temp_array['route_count'] = $row['route_count'];
8469 8469
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8491,9 +8491,9 @@  discard block
 block discarded – undo
8491 8491
 	*/
8492 8492
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8493 8493
 	{
8494
-		$filter_query = $this->getFilter($filters,true,true);
8495
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8496
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8494
+		$filter_query = $this->getFilter($filters, true, true);
8495
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8496
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8497 8497
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8498 8498
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8499 8499
 			    ORDER BY route_count DESC";
@@ -8505,7 +8505,7 @@  discard block
 block discarded – undo
8505 8505
 		$routes_array = array();
8506 8506
 		$temp_array = array();
8507 8507
         
8508
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8508
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8509 8509
 		{
8510 8510
 			$temp_array['route_count'] = $row['route_count'];
8511 8511
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8533,9 +8533,9 @@  discard block
 block discarded – undo
8533 8533
 	*/
8534 8534
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8535 8535
 	{
8536
-		$filter_query = $this->getFilter($filters,true,true);
8537
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8538
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8536
+		$filter_query = $this->getFilter($filters, true, true);
8537
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8538
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8539 8539
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8540 8540
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8541 8541
 			    ORDER BY route_count DESC";
@@ -8546,7 +8546,7 @@  discard block
 block discarded – undo
8546 8546
 		$routes_array = array();
8547 8547
 		$temp_array = array();
8548 8548
         
8549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8550 8550
 		{
8551 8551
 			$temp_array['route_count'] = $row['route_count'];
8552 8552
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8574,9 +8574,9 @@  discard block
 block discarded – undo
8574 8574
 	*/
8575 8575
 	public function countAllRoutesByCountry($country, $filters = array())
8576 8576
 	{
8577
-		$filter_query = $this->getFilter($filters,true,true);
8578
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8579
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8577
+		$filter_query = $this->getFilter($filters, true, true);
8578
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8579
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8580 8580
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
8581 8581
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8582 8582
 			    ORDER BY route_count DESC";
@@ -8587,7 +8587,7 @@  discard block
 block discarded – undo
8587 8587
 		$routes_array = array();
8588 8588
 		$temp_array = array();
8589 8589
         
8590
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8590
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8591 8591
 		{
8592 8592
 			$temp_array['route_count'] = $row['route_count'];
8593 8593
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8615,8 +8615,8 @@  discard block
 block discarded – undo
8615 8615
 	public function countAllRoutesByDate($date, $filters = array())
8616 8616
 	{
8617 8617
 		global $globalTimezone, $globalDBdriver;
8618
-		$filter_query = $this->getFilter($filters,true,true);
8619
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8618
+		$filter_query = $this->getFilter($filters, true, true);
8619
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8620 8620
 		if ($globalTimezone != '') {
8621 8621
 			date_default_timezone_set($globalTimezone);
8622 8622
 			$datetime = new DateTime($date);
@@ -8624,12 +8624,12 @@  discard block
 block discarded – undo
8624 8624
 		} else $offset = '+00:00';
8625 8625
 		
8626 8626
 		if ($globalDBdriver == 'mysql') {
8627
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8627
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8628 8628
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8629 8629
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8630 8630
 				    ORDER BY route_count DESC";
8631 8631
 		} else {
8632
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8632
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8633 8633
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8634 8634
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8635 8635
 				    ORDER BY route_count DESC";
@@ -8641,7 +8641,7 @@  discard block
 block discarded – undo
8641 8641
 		$routes_array = array();
8642 8642
 		$temp_array = array();
8643 8643
         
8644
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8644
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8645 8645
 		{
8646 8646
 			$temp_array['route_count'] = $row['route_count'];
8647 8647
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8668,9 +8668,9 @@  discard block
 block discarded – undo
8668 8668
 	*/
8669 8669
 	public function countAllRoutesByIdent($ident, $filters = array())
8670 8670
 	{
8671
-		$filter_query = $this->getFilter($filters,true,true);
8672
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8673
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8671
+		$filter_query = $this->getFilter($filters, true, true);
8672
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8673
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8674 8674
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
8675 8675
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8676 8676
                     ORDER BY route_count DESC";
@@ -8682,7 +8682,7 @@  discard block
 block discarded – undo
8682 8682
 		$routes_array = array();
8683 8683
 		$temp_array = array();
8684 8684
         
8685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8686 8686
 		{
8687 8687
 			$temp_array['route_count'] = $row['route_count'];
8688 8688
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8706,11 +8706,11 @@  discard block
 block discarded – undo
8706 8706
 	* @return Array the route list
8707 8707
 	*
8708 8708
 	*/
8709
-	public function countAllRoutesByOwner($owner,$filters = array())
8709
+	public function countAllRoutesByOwner($owner, $filters = array())
8710 8710
 	{
8711
-		$filter_query = $this->getFilter($filters,true,true);
8712
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8713
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8711
+		$filter_query = $this->getFilter($filters, true, true);
8712
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8713
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8714 8714
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
8715 8715
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8716 8716
                     ORDER BY route_count DESC";
@@ -8722,7 +8722,7 @@  discard block
 block discarded – undo
8722 8722
 		$routes_array = array();
8723 8723
 		$temp_array = array();
8724 8724
         
8725
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8725
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8726 8726
 		{
8727 8727
 			$temp_array['route_count'] = $row['route_count'];
8728 8728
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8746,11 +8746,11 @@  discard block
 block discarded – undo
8746 8746
 	* @return Array the route list
8747 8747
 	*
8748 8748
 	*/
8749
-	public function countAllRoutesByPilot($pilot,$filters = array())
8749
+	public function countAllRoutesByPilot($pilot, $filters = array())
8750 8750
 	{
8751
-		$filter_query = $this->getFilter($filters,true,true);
8752
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8753
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8751
+		$filter_query = $this->getFilter($filters, true, true);
8752
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8753
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8754 8754
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8755 8755
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8756 8756
                     ORDER BY route_count DESC";
@@ -8762,7 +8762,7 @@  discard block
 block discarded – undo
8762 8762
 		$routes_array = array();
8763 8763
 		$temp_array = array();
8764 8764
         
8765
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8765
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8766 8766
 		{
8767 8767
 			$temp_array['route_count'] = $row['route_count'];
8768 8768
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8789,9 +8789,9 @@  discard block
 block discarded – undo
8789 8789
 	*/
8790 8790
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8791 8791
 	{
8792
-		$filter_query = $this->getFilter($filters,true,true);
8793
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8794
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8792
+		$filter_query = $this->getFilter($filters, true, true);
8793
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8794
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8795 8795
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
8796 8796
                     GROUP BY route
8797 8797
                     ORDER BY route_count DESC";
@@ -8803,7 +8803,7 @@  discard block
 block discarded – undo
8803 8803
 		$routes_array = array();
8804 8804
 		$temp_array = array();
8805 8805
         
8806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8807 8807
 		{
8808 8808
 			$temp_array['route_count'] = $row['route_count'];
8809 8809
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8831,8 +8831,8 @@  discard block
 block discarded – undo
8831 8831
 	*/
8832 8832
 	public function countAllRoutesWithWaypoints($filters = array())
8833 8833
 	{
8834
-		$filter_query = $this->getFilter($filters,true,true);
8835
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8834
+		$filter_query = $this->getFilter($filters, true, true);
8835
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8836 8836
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
8837 8837
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8838 8838
                     ORDER BY route_count DESC
@@ -8845,7 +8845,7 @@  discard block
 block discarded – undo
8845 8845
 		$routes_array = array();
8846 8846
 		$temp_array = array();
8847 8847
         
8848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8849 8849
 		{
8850 8850
 			$temp_array['spotter_id'] = $row['spotter_id'];
8851 8851
 			$temp_array['route_count'] = $row['route_count'];
@@ -8870,11 +8870,11 @@  discard block
 block discarded – undo
8870 8870
 	* @return Array the callsign list
8871 8871
 	*
8872 8872
 	*/
8873
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8873
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
8874 8874
 	{
8875 8875
 		global $globalDBdriver;
8876
-		$filter_query = $this->getFilter($filters,true,true);
8877
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8876
+		$filter_query = $this->getFilter($filters, true, true);
8877
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8878 8878
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
8879 8879
 		 if ($olderthanmonths > 0) {
8880 8880
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -8888,28 +8888,28 @@  discard block
 block discarded – undo
8888 8888
 		if ($year != '') {
8889 8889
 			if ($globalDBdriver == 'mysql') {
8890 8890
 				$query .= " AND YEAR(spotter_output.date) = :year";
8891
-				$query_values = array_merge($query_values,array(':year' => $year));
8891
+				$query_values = array_merge($query_values, array(':year' => $year));
8892 8892
 			} else {
8893 8893
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8894
-				$query_values = array_merge($query_values,array(':year' => $year));
8894
+				$query_values = array_merge($query_values, array(':year' => $year));
8895 8895
 			}
8896 8896
 		}
8897 8897
 		if ($month != '') {
8898 8898
 			if ($globalDBdriver == 'mysql') {
8899 8899
 				$query .= " AND MONTH(spotter_output.date) = :month";
8900
-				$query_values = array_merge($query_values,array(':month' => $month));
8900
+				$query_values = array_merge($query_values, array(':month' => $month));
8901 8901
 			} else {
8902 8902
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8903
-				$query_values = array_merge($query_values,array(':month' => $month));
8903
+				$query_values = array_merge($query_values, array(':month' => $month));
8904 8904
 			}
8905 8905
 		}
8906 8906
 		if ($day != '') {
8907 8907
 			if ($globalDBdriver == 'mysql') {
8908 8908
 				$query .= " AND DAY(spotter_output.date) = :day";
8909
-				$query_values = array_merge($query_values,array(':day' => $day));
8909
+				$query_values = array_merge($query_values, array(':day' => $day));
8910 8910
 			} else {
8911 8911
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8912
-				$query_values = array_merge($query_values,array(':day' => $day));
8912
+				$query_values = array_merge($query_values, array(':day' => $day));
8913 8913
 			}
8914 8914
 		}
8915 8915
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -8921,7 +8921,7 @@  discard block
 block discarded – undo
8921 8921
 		$callsign_array = array();
8922 8922
 		$temp_array = array();
8923 8923
         
8924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8925 8925
 		{
8926 8926
 			$temp_array['callsign_icao'] = $row['ident'];
8927 8927
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -8943,8 +8943,8 @@  discard block
 block discarded – undo
8943 8943
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8944 8944
 	{
8945 8945
 		global $globalDBdriver;
8946
-		$filter_query = $this->getFilter($filters,true,true);
8947
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8946
+		$filter_query = $this->getFilter($filters, true, true);
8947
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8948 8948
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8949 8949
 		 if ($olderthanmonths > 0) {
8950 8950
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -8963,7 +8963,7 @@  discard block
 block discarded – undo
8963 8963
 		$callsign_array = array();
8964 8964
 		$temp_array = array();
8965 8965
         
8966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8967 8967
 		{
8968 8968
 			$temp_array['callsign_icao'] = $row['ident'];
8969 8969
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9017,7 +9017,7 @@  discard block
 block discarded – undo
9017 9017
 		$date_array = array();
9018 9018
 		$temp_array = array();
9019 9019
         
9020
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9020
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9021 9021
 		{
9022 9022
 			$temp_array['date_name'] = $row['date_name'];
9023 9023
 			$temp_array['date_count'] = $row['date_count'];
@@ -9042,15 +9042,15 @@  discard block
 block discarded – undo
9042 9042
 			$datetime = new DateTime();
9043 9043
 			$offset = $datetime->format('P');
9044 9044
 		} else $offset = '+00:00';
9045
-		$filter_query = $this->getFilter($filters,true,true);
9045
+		$filter_query = $this->getFilter($filters, true, true);
9046 9046
 		if ($globalDBdriver == 'mysql') {
9047
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9047
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9048 9048
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9049 9049
 								GROUP BY spotter_output.airline_icao, date_name 
9050 9050
 								ORDER BY date_count DESC
9051 9051
 								LIMIT 10 OFFSET 0";
9052 9052
 		} else {
9053
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9053
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9054 9054
 								FROM spotter_output 
9055 9055
 								WHERE spotter_output.airline_icao <> '' 
9056 9056
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9065,7 +9065,7 @@  discard block
 block discarded – undo
9065 9065
 		$date_array = array();
9066 9066
 		$temp_array = array();
9067 9067
         
9068
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9068
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9069 9069
 		{
9070 9070
 			$temp_array['date_name'] = $row['date_name'];
9071 9071
 			$temp_array['date_count'] = $row['date_count'];
@@ -9091,7 +9091,7 @@  discard block
 block discarded – undo
9091 9091
 			$datetime = new DateTime();
9092 9092
 			$offset = $datetime->format('P');
9093 9093
 		} else $offset = '+00:00';
9094
-		$filter_query = $this->getFilter($filters,true,true);
9094
+		$filter_query = $this->getFilter($filters, true, true);
9095 9095
 		if ($globalDBdriver == 'mysql') {
9096 9096
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9097 9097
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9112,7 +9112,7 @@  discard block
 block discarded – undo
9112 9112
 		$date_array = array();
9113 9113
 		$temp_array = array();
9114 9114
         
9115
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9115
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9116 9116
 		{
9117 9117
 			$temp_array['date_name'] = $row['date_name'];
9118 9118
 			$temp_array['date_count'] = $row['date_count'];
@@ -9137,7 +9137,7 @@  discard block
 block discarded – undo
9137 9137
 			$datetime = new DateTime();
9138 9138
 			$offset = $datetime->format('P');
9139 9139
 		} else $offset = '+00:00';
9140
-		$filter_query = $this->getFilter($filters,true,true);
9140
+		$filter_query = $this->getFilter($filters, true, true);
9141 9141
 		if ($globalDBdriver == 'mysql') {
9142 9142
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9143 9143
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9158,7 +9158,7 @@  discard block
 block discarded – undo
9158 9158
 		$date_array = array();
9159 9159
 		$temp_array = array();
9160 9160
         
9161
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9161
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9162 9162
 		{
9163 9163
 			$temp_array['date_name'] = $row['date_name'];
9164 9164
 			$temp_array['date_count'] = $row['date_count'];
@@ -9179,7 +9179,7 @@  discard block
 block discarded – undo
9179 9179
 	public function countAllDatesLastMonthByAirlines($filters = array())
9180 9180
 	{
9181 9181
 		global $globalTimezone, $globalDBdriver;
9182
-		$filter_query = $this->getFilter($filters,true,true);
9182
+		$filter_query = $this->getFilter($filters, true, true);
9183 9183
 		if ($globalTimezone != '') {
9184 9184
 			date_default_timezone_set($globalTimezone);
9185 9185
 			$datetime = new DateTime();
@@ -9187,13 +9187,13 @@  discard block
 block discarded – undo
9187 9187
 		} else $offset = '+00:00';
9188 9188
 		
9189 9189
 		if ($globalDBdriver == 'mysql') {
9190
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9190
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9191 9191
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9192 9192
 								GROUP BY spotter_output.airline_icao, date_name 
9193 9193
 								ORDER BY spotter_output.date ASC";
9194 9194
 			$query_data = array(':offset' => $offset);
9195 9195
 		} else {
9196
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9196
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
9197 9197
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9198 9198
 								GROUP BY spotter_output.airline_icao, date_name 
9199 9199
 								ORDER BY date_name ASC";
@@ -9206,7 +9206,7 @@  discard block
 block discarded – undo
9206 9206
 		$date_array = array();
9207 9207
 		$temp_array = array();
9208 9208
         
9209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9210 9210
 		{
9211 9211
 			$temp_array['date_name'] = $row['date_name'];
9212 9212
 			$temp_array['date_count'] = $row['date_count'];
@@ -9253,7 +9253,7 @@  discard block
 block discarded – undo
9253 9253
 		$date_array = array();
9254 9254
 		$temp_array = array();
9255 9255
         
9256
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9256
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9257 9257
 		{
9258 9258
 			$temp_array['month_name'] = $row['month_name'];
9259 9259
 			$temp_array['year_name'] = $row['year_name'];
@@ -9274,7 +9274,7 @@  discard block
 block discarded – undo
9274 9274
 	public function countAllMonthsByAirlines($filters = array())
9275 9275
 	{
9276 9276
 		global $globalTimezone, $globalDBdriver;
9277
-		$filter_query = $this->getFilter($filters,true,true);
9277
+		$filter_query = $this->getFilter($filters, true, true);
9278 9278
 		if ($globalTimezone != '') {
9279 9279
 			date_default_timezone_set($globalTimezone);
9280 9280
 			$datetime = new DateTime();
@@ -9282,12 +9282,12 @@  discard block
 block discarded – undo
9282 9282
 		} else $offset = '+00:00';
9283 9283
 
9284 9284
 		if ($globalDBdriver == 'mysql') {
9285
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
9285
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
9286 9286
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9287 9287
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9288 9288
 								ORDER BY date_count DESC";
9289 9289
 		} else {
9290
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9290
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9291 9291
 								FROM spotter_output 
9292 9292
 								WHERE spotter_output.airline_icao <> '' 
9293 9293
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9301,7 +9301,7 @@  discard block
 block discarded – undo
9301 9301
 		$date_array = array();
9302 9302
 		$temp_array = array();
9303 9303
         
9304
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9304
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9305 9305
 		{
9306 9306
 			$temp_array['month_name'] = $row['month_name'];
9307 9307
 			$temp_array['year_name'] = $row['year_name'];
@@ -9328,14 +9328,14 @@  discard block
 block discarded – undo
9328 9328
 			$datetime = new DateTime();
9329 9329
 			$offset = $datetime->format('P');
9330 9330
 		} else $offset = '+00:00';
9331
-		$filter_query = $this->getFilter($filters,true,true);
9331
+		$filter_query = $this->getFilter($filters, true, true);
9332 9332
 		if ($globalDBdriver == 'mysql') {
9333
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
9333
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
9334 9334
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9335 9335
 								GROUP BY year_name, month_name 
9336 9336
 								ORDER BY date_count DESC";
9337 9337
 		} else {
9338
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9338
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
9339 9339
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9340 9340
 								GROUP BY year_name, month_name 
9341 9341
 								ORDER BY date_count DESC";
@@ -9347,7 +9347,7 @@  discard block
 block discarded – undo
9347 9347
 		$date_array = array();
9348 9348
 		$temp_array = array();
9349 9349
         
9350
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9350
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9351 9351
 		{
9352 9352
 			$temp_array['month_name'] = $row['month_name'];
9353 9353
 			$temp_array['year_name'] = $row['year_name'];
@@ -9373,15 +9373,15 @@  discard block
 block discarded – undo
9373 9373
 			$datetime = new DateTime();
9374 9374
 			$offset = $datetime->format('P');
9375 9375
 		} else $offset = '+00:00';
9376
-		$filter_query = $this->getFilter($filters,true,true);
9376
+		$filter_query = $this->getFilter($filters, true, true);
9377 9377
 
9378 9378
 		if ($globalDBdriver == 'mysql') {
9379
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9379
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9380 9380
 								FROM spotter_output".$filter_query." owner_name <> ''
9381 9381
 								GROUP BY year_name, month_name
9382 9382
 								ORDER BY date_count DESC";
9383 9383
 		} else {
9384
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9384
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9385 9385
 								FROM spotter_output".$filter_query." owner_name <> ''
9386 9386
 								GROUP BY year_name, month_name
9387 9387
 								ORDER BY date_count DESC";
@@ -9393,7 +9393,7 @@  discard block
 block discarded – undo
9393 9393
 		$date_array = array();
9394 9394
 		$temp_array = array();
9395 9395
         
9396
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9396
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9397 9397
 		{
9398 9398
 			$temp_array['month_name'] = $row['month_name'];
9399 9399
 			$temp_array['year_name'] = $row['year_name'];
@@ -9414,7 +9414,7 @@  discard block
 block discarded – undo
9414 9414
 	public function countAllMonthsOwnersByAirlines($filters = array())
9415 9415
 	{
9416 9416
 		global $globalTimezone, $globalDBdriver;
9417
-		$filter_query = $this->getFilter($filters,true,true);
9417
+		$filter_query = $this->getFilter($filters, true, true);
9418 9418
 		if ($globalTimezone != '') {
9419 9419
 			date_default_timezone_set($globalTimezone);
9420 9420
 			$datetime = new DateTime();
@@ -9422,12 +9422,12 @@  discard block
 block discarded – undo
9422 9422
 		} else $offset = '+00:00';
9423 9423
 
9424 9424
 		if ($globalDBdriver == 'mysql') {
9425
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9425
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
9426 9426
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9427 9427
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9428 9428
 								ORDER BY date_count DESC";
9429 9429
 		} else {
9430
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9430
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
9431 9431
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9432 9432
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9433 9433
 								ORDER BY date_count DESC";
@@ -9439,7 +9439,7 @@  discard block
 block discarded – undo
9439 9439
 		$date_array = array();
9440 9440
 		$temp_array = array();
9441 9441
         
9442
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9442
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9443 9443
 		{
9444 9444
 			$temp_array['month_name'] = $row['month_name'];
9445 9445
 			$temp_array['year_name'] = $row['year_name'];
@@ -9466,15 +9466,15 @@  discard block
 block discarded – undo
9466 9466
 			$datetime = new DateTime();
9467 9467
 			$offset = $datetime->format('P');
9468 9468
 		} else $offset = '+00:00';
9469
-		$filter_query = $this->getFilter($filters,true,true);
9469
+		$filter_query = $this->getFilter($filters, true, true);
9470 9470
 
9471 9471
 		if ($globalDBdriver == 'mysql') {
9472
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9472
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9473 9473
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9474 9474
 								GROUP BY year_name, month_name
9475 9475
 								ORDER BY date_count DESC";
9476 9476
 		} else {
9477
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9477
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9478 9478
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9479 9479
 								GROUP BY year_name, month_name
9480 9480
 								ORDER BY date_count DESC";
@@ -9486,7 +9486,7 @@  discard block
 block discarded – undo
9486 9486
 		$date_array = array();
9487 9487
 		$temp_array = array();
9488 9488
         
9489
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9489
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9490 9490
 		{
9491 9491
 			$temp_array['month_name'] = $row['month_name'];
9492 9492
 			$temp_array['year_name'] = $row['year_name'];
@@ -9507,7 +9507,7 @@  discard block
 block discarded – undo
9507 9507
 	public function countAllMonthsPilotsByAirlines($filters = array())
9508 9508
 	{
9509 9509
 		global $globalTimezone, $globalDBdriver;
9510
-		$filter_query = $this->getFilter($filters,true,true);
9510
+		$filter_query = $this->getFilter($filters, true, true);
9511 9511
 		if ($globalTimezone != '') {
9512 9512
 			date_default_timezone_set($globalTimezone);
9513 9513
 			$datetime = new DateTime();
@@ -9515,12 +9515,12 @@  discard block
 block discarded – undo
9515 9515
 		} else $offset = '+00:00';
9516 9516
 
9517 9517
 		if ($globalDBdriver == 'mysql') {
9518
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9518
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
9519 9519
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9520 9520
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9521 9521
 								ORDER BY date_count DESC";
9522 9522
 		} else {
9523
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9523
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
9524 9524
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9525 9525
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9526 9526
 								ORDER BY date_count DESC";
@@ -9532,7 +9532,7 @@  discard block
 block discarded – undo
9532 9532
 		$date_array = array();
9533 9533
 		$temp_array = array();
9534 9534
         
9535
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9535
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9536 9536
 		{
9537 9537
 			$temp_array['month_name'] = $row['month_name'];
9538 9538
 			$temp_array['year_name'] = $row['year_name'];
@@ -9554,7 +9554,7 @@  discard block
 block discarded – undo
9554 9554
 	public function countAllMonthsAirlines($filters = array())
9555 9555
 	{
9556 9556
 		global $globalTimezone, $globalDBdriver;
9557
-		$filter_query = $this->getFilter($filters,true,true);
9557
+		$filter_query = $this->getFilter($filters, true, true);
9558 9558
 		if ($globalTimezone != '') {
9559 9559
 			date_default_timezone_set($globalTimezone);
9560 9560
 			$datetime = new DateTime();
@@ -9562,12 +9562,12 @@  discard block
 block discarded – undo
9562 9562
 		} else $offset = '+00:00';
9563 9563
 
9564 9564
 		if ($globalDBdriver == 'mysql') {
9565
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
9565
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
9566 9566
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9567 9567
 								GROUP BY year_name, month_name
9568 9568
 								ORDER BY date_count DESC";
9569 9569
 		} else {
9570
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
9570
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
9571 9571
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9572 9572
 								GROUP BY year_name, month_name
9573 9573
 								ORDER BY date_count DESC";
@@ -9579,7 +9579,7 @@  discard block
 block discarded – undo
9579 9579
 		$date_array = array();
9580 9580
 		$temp_array = array();
9581 9581
         
9582
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9582
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9583 9583
 		{
9584 9584
 			$temp_array['month_name'] = $row['month_name'];
9585 9585
 			$temp_array['year_name'] = $row['year_name'];
@@ -9605,15 +9605,15 @@  discard block
 block discarded – undo
9605 9605
 			$datetime = new DateTime();
9606 9606
 			$offset = $datetime->format('P');
9607 9607
 		} else $offset = '+00:00';
9608
-		$filter_query = $this->getFilter($filters,true,true);
9608
+		$filter_query = $this->getFilter($filters, true, true);
9609 9609
 
9610 9610
 		if ($globalDBdriver == 'mysql') {
9611
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9611
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9612 9612
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9613 9613
 								GROUP BY year_name, month_name
9614 9614
 								ORDER BY date_count DESC";
9615 9615
 		} else {
9616
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9616
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9617 9617
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9618 9618
 								GROUP BY year_name, month_name
9619 9619
 								ORDER BY date_count DESC";
@@ -9625,7 +9625,7 @@  discard block
 block discarded – undo
9625 9625
 		$date_array = array();
9626 9626
 		$temp_array = array();
9627 9627
         
9628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9629 9629
 		{
9630 9630
 			$temp_array['month_name'] = $row['month_name'];
9631 9631
 			$temp_array['year_name'] = $row['year_name'];
@@ -9647,7 +9647,7 @@  discard block
 block discarded – undo
9647 9647
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9648 9648
 	{
9649 9649
 		global $globalTimezone, $globalDBdriver;
9650
-		$filter_query = $this->getFilter($filters,true,true);
9650
+		$filter_query = $this->getFilter($filters, true, true);
9651 9651
 		if ($globalTimezone != '') {
9652 9652
 			date_default_timezone_set($globalTimezone);
9653 9653
 			$datetime = new DateTime();
@@ -9655,12 +9655,12 @@  discard block
 block discarded – undo
9655 9655
 		} else $offset = '+00:00';
9656 9656
 
9657 9657
 		if ($globalDBdriver == 'mysql') {
9658
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9658
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
9659 9659
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
9660 9660
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9661 9661
 								ORDER BY date_count DESC";
9662 9662
 		} else {
9663
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9663
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
9664 9664
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
9665 9665
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9666 9666
 								ORDER BY date_count DESC";
@@ -9672,7 +9672,7 @@  discard block
 block discarded – undo
9672 9672
 		$date_array = array();
9673 9673
 		$temp_array = array();
9674 9674
         
9675
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9675
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9676 9676
 		{
9677 9677
 			$temp_array['month_name'] = $row['month_name'];
9678 9678
 			$temp_array['year_name'] = $row['year_name'];
@@ -9699,15 +9699,15 @@  discard block
 block discarded – undo
9699 9699
 			$datetime = new DateTime();
9700 9700
 			$offset = $datetime->format('P');
9701 9701
 		} else $offset = '+00:00';
9702
-		$filter_query = $this->getFilter($filters,true,true);
9702
+		$filter_query = $this->getFilter($filters, true, true);
9703 9703
 
9704 9704
 		if ($globalDBdriver == 'mysql') {
9705
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
9705
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
9706 9706
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9707 9707
 								GROUP BY year_name, month_name
9708 9708
 								ORDER BY date_count DESC";
9709 9709
 		} else {
9710
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
9710
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
9711 9711
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9712 9712
 								GROUP BY year_name, month_name
9713 9713
 								ORDER BY date_count DESC";
@@ -9719,7 +9719,7 @@  discard block
 block discarded – undo
9719 9719
 		$date_array = array();
9720 9720
 		$temp_array = array();
9721 9721
         
9722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9723 9723
 		{
9724 9724
 			$temp_array['month_name'] = $row['month_name'];
9725 9725
 			$temp_array['year_name'] = $row['year_name'];
@@ -9741,7 +9741,7 @@  discard block
 block discarded – undo
9741 9741
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9742 9742
 	{
9743 9743
 		global $globalTimezone, $globalDBdriver;
9744
-		$filter_query = $this->getFilter($filters,true,true);
9744
+		$filter_query = $this->getFilter($filters, true, true);
9745 9745
 		if ($globalTimezone != '') {
9746 9746
 			date_default_timezone_set($globalTimezone);
9747 9747
 			$datetime = new DateTime();
@@ -9749,12 +9749,12 @@  discard block
 block discarded – undo
9749 9749
 		} else $offset = '+00:00';
9750 9750
 
9751 9751
 		if ($globalDBdriver == 'mysql') {
9752
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
9752
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
9753 9753
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9754 9754
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9755 9755
 								ORDER BY date_count DESC";
9756 9756
 		} else {
9757
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
9757
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
9758 9758
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9759 9759
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9760 9760
 								ORDER BY date_count DESC";
@@ -9766,7 +9766,7 @@  discard block
 block discarded – undo
9766 9766
 		$date_array = array();
9767 9767
 		$temp_array = array();
9768 9768
         
9769
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9769
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9770 9770
 		{
9771 9771
 			$temp_array['month_name'] = $row['month_name'];
9772 9772
 			$temp_array['year_name'] = $row['year_name'];
@@ -9794,7 +9794,7 @@  discard block
 block discarded – undo
9794 9794
 			$datetime = new DateTime();
9795 9795
 			$offset = $datetime->format('P');
9796 9796
 		} else $offset = '+00:00';
9797
-		$filter_query = $this->getFilter($filters,true,true);
9797
+		$filter_query = $this->getFilter($filters, true, true);
9798 9798
 		if ($globalDBdriver == 'mysql') {
9799 9799
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
9800 9800
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -9815,7 +9815,7 @@  discard block
 block discarded – undo
9815 9815
 		$date_array = array();
9816 9816
 		$temp_array = array();
9817 9817
         
9818
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9818
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9819 9819
 		{
9820 9820
 			$temp_array['year_name'] = $row['year_name'];
9821 9821
 			$temp_array['month_name'] = $row['month_name'];
@@ -9835,7 +9835,7 @@  discard block
 block discarded – undo
9835 9835
 	* @return Array the hour list
9836 9836
 	*
9837 9837
 	*/
9838
-	public function countAllHours($orderby,$filters = array())
9838
+	public function countAllHours($orderby, $filters = array())
9839 9839
 	{
9840 9840
 		global $globalTimezone, $globalDBdriver;
9841 9841
 		if ($globalTimezone != '') {
@@ -9883,7 +9883,7 @@  discard block
 block discarded – undo
9883 9883
 		$hour_array = array();
9884 9884
 		$temp_array = array();
9885 9885
         
9886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9887 9887
 		{
9888 9888
 			$temp_array['hour_name'] = $row['hour_name'];
9889 9889
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9903,7 +9903,7 @@  discard block
 block discarded – undo
9903 9903
 	public function countAllHoursByAirlines($orderby, $filters = array())
9904 9904
 	{
9905 9905
 		global $globalTimezone, $globalDBdriver;
9906
-		$filter_query = $this->getFilter($filters,true,true);
9906
+		$filter_query = $this->getFilter($filters, true, true);
9907 9907
 		if ($globalTimezone != '') {
9908 9908
 			date_default_timezone_set($globalTimezone);
9909 9909
 			$datetime = new DateTime();
@@ -9921,7 +9921,7 @@  discard block
 block discarded – undo
9921 9921
 		}
9922 9922
 		
9923 9923
 		if ($globalDBdriver == 'mysql') {
9924
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9924
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9925 9925
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9926 9926
 								GROUP BY spotter_output.airline_icao, hour_name 
9927 9927
 								".$orderby_sql;
@@ -9934,7 +9934,7 @@  discard block
 block discarded – undo
9934 9934
   */    
9935 9935
 		$query_data = array(':offset' => $offset);
9936 9936
 		} else {
9937
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9937
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9938 9938
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9939 9939
 								GROUP BY spotter_output.airline_icao, hour_name 
9940 9940
 								".$orderby_sql;
@@ -9947,7 +9947,7 @@  discard block
 block discarded – undo
9947 9947
 		$hour_array = array();
9948 9948
 		$temp_array = array();
9949 9949
         
9950
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9950
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9951 9951
 		{
9952 9952
 			$temp_array['hour_name'] = $row['hour_name'];
9953 9953
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9970,34 +9970,34 @@  discard block
 block discarded – undo
9970 9970
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9971 9971
 	{
9972 9972
 		global $globalTimezone, $globalDBdriver;
9973
-		$filter_query = $this->getFilter($filters,true,true);
9973
+		$filter_query = $this->getFilter($filters, true, true);
9974 9974
 		if ($globalTimezone != '') {
9975 9975
 			date_default_timezone_set($globalTimezone);
9976 9976
 			$datetime = new DateTime();
9977 9977
 			$offset = $datetime->format('P');
9978 9978
 		} else $offset = '+00:00';
9979 9979
 
9980
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9980
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
9981 9981
 
9982 9982
 		if ($globalDBdriver == 'mysql') {
9983
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9983
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9984 9984
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9985 9985
 								GROUP BY hour_name 
9986 9986
 								ORDER BY hour_name ASC";
9987 9987
 		} else {
9988
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9988
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9989 9989
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9990 9990
 								GROUP BY hour_name 
9991 9991
 								ORDER BY hour_name ASC";
9992 9992
 		}
9993 9993
 		
9994 9994
 		$sth = $this->db->prepare($query);
9995
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
9995
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
9996 9996
       
9997 9997
 		$hour_array = array();
9998 9998
 		$temp_array = array();
9999 9999
         
10000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10001 10001
 		{
10002 10002
 			$temp_array['hour_name'] = $row['hour_name'];
10003 10003
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10020,8 +10020,8 @@  discard block
 block discarded – undo
10020 10020
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10021 10021
 	{
10022 10022
 		global $globalTimezone, $globalDBdriver;
10023
-		$filter_query = $this->getFilter($filters,true,true);
10024
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10023
+		$filter_query = $this->getFilter($filters, true, true);
10024
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10025 10025
 		if ($globalTimezone != '') {
10026 10026
 			date_default_timezone_set($globalTimezone);
10027 10027
 			$datetime = new DateTime();
@@ -10029,24 +10029,24 @@  discard block
 block discarded – undo
10029 10029
 		} else $offset = '+00:00';
10030 10030
 
10031 10031
 		if ($globalDBdriver == 'mysql') {
10032
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10032
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10033 10033
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10034 10034
 								GROUP BY hour_name 
10035 10035
 								ORDER BY hour_name ASC";
10036 10036
 		} else {
10037
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10037
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10038 10038
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10039 10039
 								GROUP BY hour_name 
10040 10040
 								ORDER BY hour_name ASC";
10041 10041
 		}
10042 10042
 		
10043 10043
 		$sth = $this->db->prepare($query);
10044
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10044
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10045 10045
       
10046 10046
 		$hour_array = array();
10047 10047
 		$temp_array = array();
10048 10048
         
10049
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10049
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10050 10050
 		{
10051 10051
 			$temp_array['hour_name'] = $row['hour_name'];
10052 10052
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10067,8 +10067,8 @@  discard block
 block discarded – undo
10067 10067
 	public function countAllHoursByRegistration($registration, $filters = array())
10068 10068
 	{
10069 10069
 		global $globalTimezone, $globalDBdriver;
10070
-		$filter_query = $this->getFilter($filters,true,true);
10071
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10070
+		$filter_query = $this->getFilter($filters, true, true);
10071
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10072 10072
 		if ($globalTimezone != '') {
10073 10073
 			date_default_timezone_set($globalTimezone);
10074 10074
 			$datetime = new DateTime();
@@ -10076,24 +10076,24 @@  discard block
 block discarded – undo
10076 10076
 		} else $offset = '+00:00';
10077 10077
 
10078 10078
 		if ($globalDBdriver == 'mysql') {
10079
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10079
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10080 10080
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10081 10081
 								GROUP BY hour_name 
10082 10082
 								ORDER BY hour_name ASC";
10083 10083
 		} else {
10084
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10084
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10085 10085
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10086 10086
 								GROUP BY hour_name 
10087 10087
 								ORDER BY hour_name ASC";
10088 10088
 		}
10089 10089
 		
10090 10090
 		$sth = $this->db->prepare($query);
10091
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10091
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10092 10092
       
10093 10093
 		$hour_array = array();
10094 10094
 		$temp_array = array();
10095 10095
         
10096
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10096
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10097 10097
 		{
10098 10098
 			$temp_array['hour_name'] = $row['hour_name'];
10099 10099
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10114,8 +10114,8 @@  discard block
 block discarded – undo
10114 10114
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10115 10115
 	{
10116 10116
 		global $globalTimezone, $globalDBdriver;
10117
-		$filter_query = $this->getFilter($filters,true,true);
10118
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10117
+		$filter_query = $this->getFilter($filters, true, true);
10118
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10119 10119
 		if ($globalTimezone != '') {
10120 10120
 			date_default_timezone_set($globalTimezone);
10121 10121
 			$datetime = new DateTime();
@@ -10123,24 +10123,24 @@  discard block
 block discarded – undo
10123 10123
 		} else $offset = '+00:00';
10124 10124
 
10125 10125
 		if ($globalDBdriver == 'mysql') {
10126
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10126
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10127 10127
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10128 10128
 								GROUP BY hour_name 
10129 10129
 								ORDER BY hour_name ASC";
10130 10130
 		} else {
10131
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10131
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10132 10132
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10133 10133
 								GROUP BY hour_name 
10134 10134
 								ORDER BY hour_name ASC";
10135 10135
 		}
10136 10136
 		
10137 10137
 		$sth = $this->db->prepare($query);
10138
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10138
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10139 10139
       
10140 10140
 		$hour_array = array();
10141 10141
 		$temp_array = array();
10142 10142
         
10143
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10143
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10144 10144
 		{
10145 10145
 			$temp_array['hour_name'] = $row['hour_name'];
10146 10146
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10159,11 +10159,11 @@  discard block
 block discarded – undo
10159 10159
 	* @return Array the hour list
10160 10160
 	*
10161 10161
 	*/
10162
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10162
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10163 10163
 	{
10164 10164
 		global $globalTimezone, $globalDBdriver;
10165
-		$filter_query = $this->getFilter($filters,true,true);
10166
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10165
+		$filter_query = $this->getFilter($filters, true, true);
10166
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10167 10167
 		if ($globalTimezone != '') {
10168 10168
 			date_default_timezone_set($globalTimezone);
10169 10169
 			$datetime = new DateTime();
@@ -10171,24 +10171,24 @@  discard block
 block discarded – undo
10171 10171
 		} else $offset = '+00:00';
10172 10172
 
10173 10173
 		if ($globalDBdriver == 'mysql') {
10174
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10174
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10175 10175
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10176 10176
 								GROUP BY hour_name 
10177 10177
 								ORDER BY hour_name ASC";
10178 10178
 		} else {
10179
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10179
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10180 10180
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10181 10181
 								GROUP BY hour_name 
10182 10182
 								ORDER BY hour_name ASC";
10183 10183
 		}
10184 10184
 		
10185 10185
 		$sth = $this->db->prepare($query);
10186
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10186
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10187 10187
       
10188 10188
 		$hour_array = array();
10189 10189
 		$temp_array = array();
10190 10190
         
10191
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10191
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10192 10192
 		{
10193 10193
 			$temp_array['hour_name'] = $row['hour_name'];
10194 10194
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10210,8 +10210,8 @@  discard block
 block discarded – undo
10210 10210
 	public function countAllHoursByDate($date, $filters = array())
10211 10211
 	{
10212 10212
 		global $globalTimezone, $globalDBdriver;
10213
-		$filter_query = $this->getFilter($filters,true,true);
10214
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10213
+		$filter_query = $this->getFilter($filters, true, true);
10214
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10215 10215
 		if ($globalTimezone != '') {
10216 10216
 			date_default_timezone_set($globalTimezone);
10217 10217
 			$datetime = new DateTime($date);
@@ -10219,12 +10219,12 @@  discard block
 block discarded – undo
10219 10219
 		} else $offset = '+00:00';
10220 10220
 
10221 10221
 		if ($globalDBdriver == 'mysql') {
10222
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10222
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10223 10223
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10224 10224
 								GROUP BY hour_name 
10225 10225
 								ORDER BY hour_name ASC";
10226 10226
 		} else {
10227
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10227
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10228 10228
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10229 10229
 								GROUP BY hour_name 
10230 10230
 								ORDER BY hour_name ASC";
@@ -10236,7 +10236,7 @@  discard block
 block discarded – undo
10236 10236
 		$hour_array = array();
10237 10237
 		$temp_array = array();
10238 10238
         
10239
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10239
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10240 10240
 		{
10241 10241
 			$temp_array['hour_name'] = $row['hour_name'];
10242 10242
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10258,8 +10258,8 @@  discard block
 block discarded – undo
10258 10258
 	public function countAllHoursByIdent($ident, $filters = array())
10259 10259
 	{
10260 10260
 		global $globalTimezone, $globalDBdriver;
10261
-		$filter_query = $this->getFilter($filters,true,true);
10262
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10261
+		$filter_query = $this->getFilter($filters, true, true);
10262
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10263 10263
 		if ($globalTimezone != '') {
10264 10264
 			date_default_timezone_set($globalTimezone);
10265 10265
 			$datetime = new DateTime();
@@ -10267,12 +10267,12 @@  discard block
 block discarded – undo
10267 10267
 		} else $offset = '+00:00';
10268 10268
 
10269 10269
 		if ($globalDBdriver == 'mysql') {
10270
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10270
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10271 10271
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10272 10272
 								GROUP BY hour_name 
10273 10273
 								ORDER BY hour_name ASC";
10274 10274
 		} else {
10275
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10275
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10276 10276
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10277 10277
 								GROUP BY hour_name 
10278 10278
 								ORDER BY hour_name ASC";
@@ -10280,12 +10280,12 @@  discard block
 block discarded – undo
10280 10280
       
10281 10281
 		
10282 10282
 		$sth = $this->db->prepare($query);
10283
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10283
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10284 10284
       
10285 10285
 		$hour_array = array();
10286 10286
 		$temp_array = array();
10287 10287
         
10288
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10288
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10289 10289
 		{
10290 10290
 			$temp_array['hour_name'] = $row['hour_name'];
10291 10291
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10305,8 +10305,8 @@  discard block
 block discarded – undo
10305 10305
 	public function countAllHoursByOwner($owner, $filters = array())
10306 10306
 	{
10307 10307
 		global $globalTimezone, $globalDBdriver;
10308
-		$filter_query = $this->getFilter($filters,true,true);
10309
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10308
+		$filter_query = $this->getFilter($filters, true, true);
10309
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10310 10310
 		if ($globalTimezone != '') {
10311 10311
 			date_default_timezone_set($globalTimezone);
10312 10312
 			$datetime = new DateTime();
@@ -10314,12 +10314,12 @@  discard block
 block discarded – undo
10314 10314
 		} else $offset = '+00:00';
10315 10315
 
10316 10316
 		if ($globalDBdriver == 'mysql') {
10317
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10317
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10318 10318
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10319 10319
 								GROUP BY hour_name 
10320 10320
 								ORDER BY hour_name ASC";
10321 10321
 		} else {
10322
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10322
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10323 10323
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10324 10324
 								GROUP BY hour_name 
10325 10325
 								ORDER BY hour_name ASC";
@@ -10327,12 +10327,12 @@  discard block
 block discarded – undo
10327 10327
       
10328 10328
 		
10329 10329
 		$sth = $this->db->prepare($query);
10330
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10330
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10331 10331
       
10332 10332
 		$hour_array = array();
10333 10333
 		$temp_array = array();
10334 10334
         
10335
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10335
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10336 10336
 		{
10337 10337
 			$temp_array['hour_name'] = $row['hour_name'];
10338 10338
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10352,8 +10352,8 @@  discard block
 block discarded – undo
10352 10352
 	public function countAllHoursByPilot($pilot, $filters = array())
10353 10353
 	{
10354 10354
 		global $globalTimezone, $globalDBdriver;
10355
-		$filter_query = $this->getFilter($filters,true,true);
10356
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10355
+		$filter_query = $this->getFilter($filters, true, true);
10356
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10357 10357
 		if ($globalTimezone != '') {
10358 10358
 			date_default_timezone_set($globalTimezone);
10359 10359
 			$datetime = new DateTime();
@@ -10361,12 +10361,12 @@  discard block
 block discarded – undo
10361 10361
 		} else $offset = '+00:00';
10362 10362
 
10363 10363
 		if ($globalDBdriver == 'mysql') {
10364
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10364
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10365 10365
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10366 10366
 								GROUP BY hour_name 
10367 10367
 								ORDER BY hour_name ASC";
10368 10368
 		} else {
10369
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10369
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10370 10370
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10371 10371
 								GROUP BY hour_name 
10372 10372
 								ORDER BY hour_name ASC";
@@ -10374,12 +10374,12 @@  discard block
 block discarded – undo
10374 10374
       
10375 10375
 		
10376 10376
 		$sth = $this->db->prepare($query);
10377
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10377
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10378 10378
       
10379 10379
 		$hour_array = array();
10380 10380
 		$temp_array = array();
10381 10381
         
10382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10383 10383
 		{
10384 10384
 			$temp_array['hour_name'] = $row['hour_name'];
10385 10385
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10398,12 +10398,12 @@  discard block
 block discarded – undo
10398 10398
 	* @return Array the hour list
10399 10399
 	*
10400 10400
 	*/
10401
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10401
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10402 10402
 	{
10403 10403
 		global $globalTimezone, $globalDBdriver;
10404
-		$filter_query = $this->getFilter($filters,true,true);
10405
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10406
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10404
+		$filter_query = $this->getFilter($filters, true, true);
10405
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10406
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10407 10407
 		if ($globalTimezone != '') {
10408 10408
 			date_default_timezone_set($globalTimezone);
10409 10409
 			$datetime = new DateTime();
@@ -10411,24 +10411,24 @@  discard block
 block discarded – undo
10411 10411
 		} else $offset = '+00:00';
10412 10412
 
10413 10413
 		if ($globalDBdriver == 'mysql') {
10414
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10414
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10415 10415
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10416 10416
 								GROUP BY hour_name 
10417 10417
 								ORDER BY hour_name ASC";
10418 10418
 		} else {
10419
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10419
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10420 10420
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10421 10421
 								GROUP BY hour_name 
10422 10422
 								ORDER BY hour_name ASC";
10423 10423
 		}
10424 10424
 		
10425 10425
 		$sth = $this->db->prepare($query);
10426
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10426
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10427 10427
       
10428 10428
 		$hour_array = array();
10429 10429
 		$temp_array = array();
10430 10430
         
10431
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10431
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10432 10432
 		{
10433 10433
 			$temp_array['hour_name'] = $row['hour_name'];
10434 10434
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10449,8 +10449,8 @@  discard block
 block discarded – undo
10449 10449
 	public function countAllHoursByCountry($country, $filters = array())
10450 10450
 	{
10451 10451
 		global $globalTimezone, $globalDBdriver;
10452
-		$filter_query = $this->getFilter($filters,true,true);
10453
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10452
+		$filter_query = $this->getFilter($filters, true, true);
10453
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10454 10454
 		if ($globalTimezone != '') {
10455 10455
 			date_default_timezone_set($globalTimezone);
10456 10456
 			$datetime = new DateTime();
@@ -10458,24 +10458,24 @@  discard block
 block discarded – undo
10458 10458
 		} else $offset = '+00:00';
10459 10459
 
10460 10460
 		if ($globalDBdriver == 'mysql') {
10461
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10461
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10462 10462
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10463 10463
 								GROUP BY hour_name 
10464 10464
 								ORDER BY hour_name ASC";
10465 10465
 		} else {
10466
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10466
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10467 10467
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10468 10468
 								GROUP BY hour_name 
10469 10469
 								ORDER BY hour_name ASC";
10470 10470
 		}
10471 10471
 		
10472 10472
 		$sth = $this->db->prepare($query);
10473
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10473
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10474 10474
       
10475 10475
 		$hour_array = array();
10476 10476
 		$temp_array = array();
10477 10477
         
10478
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10478
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10479 10479
 		{
10480 10480
 			$temp_array['hour_name'] = $row['hour_name'];
10481 10481
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10495,29 +10495,29 @@  discard block
 block discarded – undo
10495 10495
 	* @return Integer the number of aircrafts
10496 10496
 	*
10497 10497
 	*/
10498
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10498
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10499 10499
 	{
10500 10500
 		global $globalDBdriver;
10501
-		$filter_query = $this->getFilter($filters,true,true);
10502
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10501
+		$filter_query = $this->getFilter($filters, true, true);
10502
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10503 10503
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10504 10504
 		$query_values = array();
10505 10505
 		if ($year != '') {
10506 10506
 			if ($globalDBdriver == 'mysql') {
10507 10507
 				$query .= " AND YEAR(spotter_output.date) = :year";
10508
-				$query_values = array_merge($query_values,array(':year' => $year));
10508
+				$query_values = array_merge($query_values, array(':year' => $year));
10509 10509
 			} else {
10510 10510
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10511
-				$query_values = array_merge($query_values,array(':year' => $year));
10511
+				$query_values = array_merge($query_values, array(':year' => $year));
10512 10512
 			}
10513 10513
 		}
10514 10514
 		if ($month != '') {
10515 10515
 			if ($globalDBdriver == 'mysql') {
10516 10516
 				$query .= " AND MONTH(spotter_output.date) = :month";
10517
-				$query_values = array_merge($query_values,array(':month' => $month));
10517
+				$query_values = array_merge($query_values, array(':month' => $month));
10518 10518
 			} else {
10519 10519
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10520
-				$query_values = array_merge($query_values,array(':month' => $month));
10520
+				$query_values = array_merge($query_values, array(':month' => $month));
10521 10521
 			}
10522 10522
 		}
10523 10523
 
@@ -10532,29 +10532,29 @@  discard block
 block discarded – undo
10532 10532
 	* @return Integer the number of aircrafts
10533 10533
 	*
10534 10534
 	*/
10535
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10535
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10536 10536
 	{
10537 10537
 		global $globalDBdriver;
10538
-		$filter_query = $this->getFilter($filters,true,true);
10539
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10538
+		$filter_query = $this->getFilter($filters, true, true);
10539
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10540 10540
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10541 10541
 		$query_values = array();
10542 10542
 		if ($year != '') {
10543 10543
 			if ($globalDBdriver == 'mysql') {
10544 10544
 				$query .= " AND YEAR(spotter_output.date) = :year";
10545
-				$query_values = array_merge($query_values,array(':year' => $year));
10545
+				$query_values = array_merge($query_values, array(':year' => $year));
10546 10546
 			} else {
10547 10547
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10548
-				$query_values = array_merge($query_values,array(':year' => $year));
10548
+				$query_values = array_merge($query_values, array(':year' => $year));
10549 10549
 			}
10550 10550
 		}
10551 10551
 		if ($month != '') {
10552 10552
 			if ($globalDBdriver == 'mysql') {
10553 10553
 				$query .= " AND MONTH(spotter_output.date) = :month";
10554
-				$query_values = array_merge($query_values,array(':month' => $month));
10554
+				$query_values = array_merge($query_values, array(':month' => $month));
10555 10555
 			} else {
10556 10556
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10557
-				$query_values = array_merge($query_values,array(':month' => $month));
10557
+				$query_values = array_merge($query_values, array(':month' => $month));
10558 10558
 			}
10559 10559
 		}
10560 10560
 		
@@ -10569,29 +10569,29 @@  discard block
 block discarded – undo
10569 10569
 	* @return Integer the number of pilots
10570 10570
 	*
10571 10571
 	*/
10572
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10572
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10573 10573
 	{
10574 10574
 		global $globalDBdriver;
10575
-		$filter_query = $this->getFilter($filters,true,true);
10576
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10575
+		$filter_query = $this->getFilter($filters, true, true);
10576
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10577 10577
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10578 10578
 		$query_values = array();
10579 10579
 		if ($year != '') {
10580 10580
 			if ($globalDBdriver == 'mysql') {
10581 10581
 				$query .= " AND YEAR(spotter_output.date) = :year";
10582
-				$query_values = array_merge($query_values,array(':year' => $year));
10582
+				$query_values = array_merge($query_values, array(':year' => $year));
10583 10583
 			} else {
10584 10584
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10585
-				$query_values = array_merge($query_values,array(':year' => $year));
10585
+				$query_values = array_merge($query_values, array(':year' => $year));
10586 10586
 			}
10587 10587
 		}
10588 10588
 		if ($month != '') {
10589 10589
 			if ($globalDBdriver == 'mysql') {
10590 10590
 				$query .= " AND MONTH(spotter_output.date) = :month";
10591
-				$query_values = array_merge($query_values,array(':month' => $month));
10591
+				$query_values = array_merge($query_values, array(':month' => $month));
10592 10592
 			} else {
10593 10593
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10594
-				$query_values = array_merge($query_values,array(':month' => $month));
10594
+				$query_values = array_merge($query_values, array(':month' => $month));
10595 10595
 			}
10596 10596
 		}
10597 10597
 		$sth = $this->db->prepare($query);
@@ -10605,29 +10605,29 @@  discard block
 block discarded – undo
10605 10605
 	* @return Integer the number of owners
10606 10606
 	*
10607 10607
 	*/
10608
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10608
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10609 10609
 	{
10610 10610
 		global $globalDBdriver;
10611
-		$filter_query = $this->getFilter($filters,true,true);
10612
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10611
+		$filter_query = $this->getFilter($filters, true, true);
10612
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10613 10613
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10614 10614
 		$query_values = array();
10615 10615
 		if ($year != '') {
10616 10616
 			if ($globalDBdriver == 'mysql') {
10617 10617
 				$query .= " AND YEAR(spotter_output.date) = :year";
10618
-				$query_values = array_merge($query_values,array(':year' => $year));
10618
+				$query_values = array_merge($query_values, array(':year' => $year));
10619 10619
 			} else {
10620 10620
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10621
-				$query_values = array_merge($query_values,array(':year' => $year));
10621
+				$query_values = array_merge($query_values, array(':year' => $year));
10622 10622
 			}
10623 10623
 		}
10624 10624
 		if ($month != '') {
10625 10625
 			if ($globalDBdriver == 'mysql') {
10626 10626
 				$query .= " AND MONTH(spotter_output.date) = :month";
10627
-				$query_values = array_merge($query_values,array(':month' => $month));
10627
+				$query_values = array_merge($query_values, array(':month' => $month));
10628 10628
 			} else {
10629 10629
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10630
-				$query_values = array_merge($query_values,array(':month' => $month));
10630
+				$query_values = array_merge($query_values, array(':month' => $month));
10631 10631
 			}
10632 10632
 		}
10633 10633
 		$sth = $this->db->prepare($query);
@@ -10642,32 +10642,32 @@  discard block
 block discarded – undo
10642 10642
 	* @return Integer the number of flights
10643 10643
 	*
10644 10644
 	*/
10645
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
10645
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
10646 10646
 	{
10647 10647
 		global $globalDBdriver;
10648
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10648
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10649 10649
 		$query_values = array();
10650 10650
 		$query = '';
10651 10651
 		if ($year != '') {
10652 10652
 			if ($globalDBdriver == 'mysql') {
10653 10653
 				$query .= " AND YEAR(spotter_output.date) = :year";
10654
-				$query_values = array_merge($query_values,array(':year' => $year));
10654
+				$query_values = array_merge($query_values, array(':year' => $year));
10655 10655
 			} else {
10656 10656
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10657
-				$query_values = array_merge($query_values,array(':year' => $year));
10657
+				$query_values = array_merge($query_values, array(':year' => $year));
10658 10658
 			}
10659 10659
 		}
10660 10660
 		if ($month != '') {
10661 10661
 			if ($globalDBdriver == 'mysql') {
10662 10662
 				$query .= " AND MONTH(spotter_output.date) = :month";
10663
-				$query_values = array_merge($query_values,array(':month' => $month));
10663
+				$query_values = array_merge($query_values, array(':month' => $month));
10664 10664
 			} else {
10665 10665
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10666
-				$query_values = array_merge($query_values,array(':month' => $month));
10666
+				$query_values = array_merge($query_values, array(':month' => $month));
10667 10667
 			}
10668 10668
 		}
10669 10669
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10670
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10670
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10671 10671
 		
10672 10672
 		//echo $query;
10673 10673
 		$sth = $this->db->prepare($queryi);
@@ -10681,29 +10681,29 @@  discard block
 block discarded – undo
10681 10681
 	* @return Integer the number of flights
10682 10682
 	*
10683 10683
 	*/
10684
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10684
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
10685 10685
 	{
10686 10686
 		global $globalDBdriver;
10687
-		$filter_query = $this->getFilter($filters,true,true);
10688
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10687
+		$filter_query = $this->getFilter($filters, true, true);
10688
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10689 10689
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
10690 10690
 		$query_values = array();
10691 10691
 		if ($year != '') {
10692 10692
 			if ($globalDBdriver == 'mysql') {
10693 10693
 				$query .= " AND YEAR(spotter_output.date) = :year";
10694
-				$query_values = array_merge($query_values,array(':year' => $year));
10694
+				$query_values = array_merge($query_values, array(':year' => $year));
10695 10695
 			} else {
10696 10696
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10697
-				$query_values = array_merge($query_values,array(':year' => $year));
10697
+				$query_values = array_merge($query_values, array(':year' => $year));
10698 10698
 			}
10699 10699
 		}
10700 10700
 		if ($month != '') {
10701 10701
 			if ($globalDBdriver == 'mysql') {
10702 10702
 				$query .= " AND MONTH(spotter_output.date) = :month";
10703
-				$query_values = array_merge($query_values,array(':month' => $month));
10703
+				$query_values = array_merge($query_values, array(':month' => $month));
10704 10704
 			} else {
10705 10705
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10706
-				$query_values = array_merge($query_values,array(':month' => $month));
10706
+				$query_values = array_merge($query_values, array(':month' => $month));
10707 10707
 			}
10708 10708
 		}
10709 10709
       
@@ -10720,10 +10720,10 @@  discard block
 block discarded – undo
10720 10720
 	* @return Integer the number of airlines
10721 10721
 	*
10722 10722
 	*/
10723
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10723
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
10724 10724
 	{
10725 10725
 		global $globalDBdriver;
10726
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10726
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10727 10727
 							FROM spotter_output";
10728 10728
       
10729 10729
 		$query_values = array();
@@ -10731,23 +10731,23 @@  discard block
 block discarded – undo
10731 10731
 		if ($year != '') {
10732 10732
 			if ($globalDBdriver == 'mysql') {
10733 10733
 				$query .= " AND YEAR(spotter_output.date) = :year";
10734
-				$query_values = array_merge($query_values,array(':year' => $year));
10734
+				$query_values = array_merge($query_values, array(':year' => $year));
10735 10735
 			} else {
10736 10736
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10737
-				$query_values = array_merge($query_values,array(':year' => $year));
10737
+				$query_values = array_merge($query_values, array(':year' => $year));
10738 10738
 			}
10739 10739
 		}
10740 10740
 		if ($month != '') {
10741 10741
 			if ($globalDBdriver == 'mysql') {
10742 10742
 				$query .= " AND MONTH(spotter_output.date) = :month";
10743
-				$query_values = array_merge($query_values,array(':month' => $month));
10743
+				$query_values = array_merge($query_values, array(':month' => $month));
10744 10744
 			} else {
10745 10745
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10746
-				$query_values = array_merge($query_values,array(':month' => $month));
10746
+				$query_values = array_merge($query_values, array(':month' => $month));
10747 10747
 			}
10748 10748
 		}
10749 10749
                 if ($query == '') $queryi .= $this->getFilter($filters);
10750
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10750
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10751 10751
 
10752 10752
 
10753 10753
 		$sth = $this->db->prepare($queryi);
@@ -10765,7 +10765,7 @@  discard block
 block discarded – undo
10765 10765
 	public function countAllHoursFromToday($filters = array())
10766 10766
 	{
10767 10767
 		global $globalTimezone, $globalDBdriver;
10768
-		$filter_query = $this->getFilter($filters,true,true);
10768
+		$filter_query = $this->getFilter($filters, true, true);
10769 10769
 		if ($globalTimezone != '') {
10770 10770
 			date_default_timezone_set($globalTimezone);
10771 10771
 			$datetime = new DateTime();
@@ -10773,12 +10773,12 @@  discard block
 block discarded – undo
10773 10773
 		} else $offset = '+00:00';
10774 10774
 
10775 10775
 		if ($globalDBdriver == 'mysql') {
10776
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10776
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10777 10777
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
10778 10778
 								GROUP BY hour_name 
10779 10779
 								ORDER BY hour_name ASC";
10780 10780
 		} else {
10781
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10781
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10782 10782
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
10783 10783
 								GROUP BY hour_name 
10784 10784
 								ORDER BY hour_name ASC";
@@ -10790,7 +10790,7 @@  discard block
 block discarded – undo
10790 10790
 		$hour_array = array();
10791 10791
 		$temp_array = array();
10792 10792
         
10793
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10793
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10794 10794
 		{
10795 10795
 			$temp_array['hour_name'] = $row['hour_name'];
10796 10796
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10809,14 +10809,14 @@  discard block
 block discarded – undo
10809 10809
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10810 10810
 	{
10811 10811
 		global $global_query, $globalDBdriver, $globalTimezone;
10812
-		$filter_query = $this->getFilter($filters,true,true);
10812
+		$filter_query = $this->getFilter($filters, true, true);
10813 10813
 		date_default_timezone_set('UTC');
10814 10814
 		$limit_query = '';
10815 10815
 		if ($limit != "")
10816 10816
 		{
10817 10817
 			$limit_array = explode(",", $limit);
10818
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
10819
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
10818
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
10819
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
10820 10820
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
10821 10821
 			{
10822 10822
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -10869,7 +10869,7 @@  discard block
 block discarded – undo
10869 10869
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
10870 10870
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
10871 10871
 			//echo $query;
10872
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
10872
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
10873 10873
 			/*
10874 10874
 			$sth = $this->db->prepare($query);
10875 10875
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -10888,9 +10888,9 @@  discard block
 block discarded – undo
10888 10888
 	*/
10889 10889
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10890 10890
 	{
10891
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
10891
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
10892 10892
 
10893
-		$query  = "SELECT spotter_output.spotter_id
10893
+		$query = "SELECT spotter_output.spotter_id
10894 10894
 								FROM spotter_output 
10895 10895
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
10896 10896
         
@@ -10898,7 +10898,7 @@  discard block
 block discarded – undo
10898 10898
 		$sth = $this->db->prepare($query);
10899 10899
 		$sth->execute();
10900 10900
 
10901
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10901
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10902 10902
 		{
10903 10903
 			return $row['spotter_id'];
10904 10904
 		}
@@ -10923,23 +10923,23 @@  discard block
 block discarded – undo
10923 10923
 		}
10924 10924
 		
10925 10925
 		$current_date = date("Y-m-d H:i:s");
10926
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
10926
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
10927 10927
 		
10928 10928
 		$diff = abs(strtotime($current_date) - strtotime($date));
10929 10929
 
10930
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
10930
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
10931 10931
 		$years = $time_array['years'];
10932 10932
 		
10933
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
10933
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
10934 10934
 		$months = $time_array['months'];
10935 10935
 		
10936
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
10936
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
10937 10937
 		$days = $time_array['days'];
10938
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
10938
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
10939 10939
 		$hours = $time_array['hours'];
10940
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
10940
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
10941 10941
 		$minutes = $time_array['minutes'];
10942
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10942
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10943 10943
 		
10944 10944
 		return $time_array;	
10945 10945
 	}	
@@ -10965,63 +10965,63 @@  discard block
 block discarded – undo
10965 10965
 			$temp_array['direction_degree'] = $direction;
10966 10966
 			$temp_array['direction_shortname'] = "N";
10967 10967
 			$temp_array['direction_fullname'] = "North";
10968
-		} elseif ($direction >= 22.5 && $direction < 45){
10968
+		} elseif ($direction >= 22.5 && $direction < 45) {
10969 10969
 			$temp_array['direction_degree'] = $direction;
10970 10970
 			$temp_array['direction_shortname'] = "NNE";
10971 10971
 			$temp_array['direction_fullname'] = "North-Northeast";
10972
-		} elseif ($direction >= 45 && $direction < 67.5){
10972
+		} elseif ($direction >= 45 && $direction < 67.5) {
10973 10973
 			$temp_array['direction_degree'] = $direction;
10974 10974
 			$temp_array['direction_shortname'] = "NE";
10975 10975
 			$temp_array['direction_fullname'] = "Northeast";
10976
-		} elseif ($direction >= 67.5 && $direction < 90){
10976
+		} elseif ($direction >= 67.5 && $direction < 90) {
10977 10977
 			$temp_array['direction_degree'] = $direction;
10978 10978
 			$temp_array['direction_shortname'] = "ENE";
10979 10979
 			$temp_array['direction_fullname'] = "East-Northeast";
10980
-		} elseif ($direction >= 90 && $direction < 112.5){
10980
+		} elseif ($direction >= 90 && $direction < 112.5) {
10981 10981
 			$temp_array['direction_degree'] = $direction;
10982 10982
 			$temp_array['direction_shortname'] = "E";
10983 10983
 			$temp_array['direction_fullname'] = "East";
10984
-		} elseif ($direction >= 112.5 && $direction < 135){
10984
+		} elseif ($direction >= 112.5 && $direction < 135) {
10985 10985
 			$temp_array['direction_degree'] = $direction;
10986 10986
 			$temp_array['direction_shortname'] = "ESE";
10987 10987
 			$temp_array['direction_fullname'] = "East-Southeast";
10988
-		} elseif ($direction >= 135 && $direction < 157.5){
10988
+		} elseif ($direction >= 135 && $direction < 157.5) {
10989 10989
 			$temp_array['direction_degree'] = $direction;
10990 10990
 			$temp_array['direction_shortname'] = "SE";
10991 10991
 			$temp_array['direction_fullname'] = "Southeast";
10992
-		} elseif ($direction >= 157.5 && $direction < 180){
10992
+		} elseif ($direction >= 157.5 && $direction < 180) {
10993 10993
 			$temp_array['direction_degree'] = $direction;
10994 10994
 			$temp_array['direction_shortname'] = "SSE";
10995 10995
 			$temp_array['direction_fullname'] = "South-Southeast";
10996
-		} elseif ($direction >= 180 && $direction < 202.5){
10996
+		} elseif ($direction >= 180 && $direction < 202.5) {
10997 10997
 			$temp_array['direction_degree'] = $direction;
10998 10998
 			$temp_array['direction_shortname'] = "S";
10999 10999
 			$temp_array['direction_fullname'] = "South";
11000
-		} elseif ($direction >= 202.5 && $direction < 225){
11000
+		} elseif ($direction >= 202.5 && $direction < 225) {
11001 11001
 			$temp_array['direction_degree'] = $direction;
11002 11002
 			$temp_array['direction_shortname'] = "SSW";
11003 11003
 			$temp_array['direction_fullname'] = "South-Southwest";
11004
-		} elseif ($direction >= 225 && $direction < 247.5){
11004
+		} elseif ($direction >= 225 && $direction < 247.5) {
11005 11005
 			$temp_array['direction_degree'] = $direction;
11006 11006
 			$temp_array['direction_shortname'] = "SW";
11007 11007
 			$temp_array['direction_fullname'] = "Southwest";
11008
-		} elseif ($direction >= 247.5 && $direction < 270){
11008
+		} elseif ($direction >= 247.5 && $direction < 270) {
11009 11009
 			$temp_array['direction_degree'] = $direction;
11010 11010
 			$temp_array['direction_shortname'] = "WSW";
11011 11011
 			$temp_array['direction_fullname'] = "West-Southwest";
11012
-		} elseif ($direction >= 270 && $direction < 292.5){
11012
+		} elseif ($direction >= 270 && $direction < 292.5) {
11013 11013
 			$temp_array['direction_degree'] = $direction;
11014 11014
 			$temp_array['direction_shortname'] = "W";
11015 11015
 			$temp_array['direction_fullname'] = "West";
11016
-		} elseif ($direction >= 292.5 && $direction < 315){
11016
+		} elseif ($direction >= 292.5 && $direction < 315) {
11017 11017
 			$temp_array['direction_degree'] = $direction;
11018 11018
 			$temp_array['direction_shortname'] = "WNW";
11019 11019
 			$temp_array['direction_fullname'] = "West-Northwest";
11020
-		} elseif ($direction >= 315 && $direction < 337.5){
11020
+		} elseif ($direction >= 315 && $direction < 337.5) {
11021 11021
 			$temp_array['direction_degree'] = $direction;
11022 11022
 			$temp_array['direction_shortname'] = "NW";
11023 11023
 			$temp_array['direction_fullname'] = "Northwest";
11024
-		} elseif ($direction >= 337.5 && $direction < 360){
11024
+		} elseif ($direction >= 337.5 && $direction < 360) {
11025 11025
 			$temp_array['direction_degree'] = $direction;
11026 11026
 			$temp_array['direction_shortname'] = "NNW";
11027 11027
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11074,9 +11074,9 @@  discard block
 block discarded – undo
11074 11074
 	*/
11075 11075
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11076 11076
 	{
11077
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11077
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11078 11078
 	
11079
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11079
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11080 11080
 		
11081 11081
 		$sth = $this->db->prepare($query);
11082 11082
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11099,9 +11099,9 @@  discard block
 block discarded – undo
11099 11099
 	*/
11100 11100
 	public function getAircraftTypeBymodeS($aircraft_modes)
11101 11101
 	{
11102
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11102
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11103 11103
 	
11104
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11104
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11105 11105
 		
11106 11106
 		$sth = $this->db->prepare($query);
11107 11107
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11122,11 +11122,11 @@  discard block
 block discarded – undo
11122 11122
 	* @param Float $longitude longitute of the flight
11123 11123
 	* @return String the countrie
11124 11124
 	*/
11125
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11125
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11126 11126
 	{
11127 11127
 		global $globalDBdriver, $globalDebug;
11128
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11129
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11128
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11129
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11130 11130
 	
11131 11131
 		$Connection = new Connection($this->db);
11132 11132
 		if (!$Connection->tableExists('countries')) return '';
@@ -11166,7 +11166,7 @@  discard block
 block discarded – undo
11166 11166
 	public function getCountryFromISO2($iso2)
11167 11167
 	{
11168 11168
 		global $globalDBdriver, $globalDebug;
11169
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11169
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11170 11170
 	
11171 11171
 		$Connection = new Connection($this->db);
11172 11172
 		if (!$Connection->tableExists('countries')) return '';
@@ -11198,19 +11198,19 @@  discard block
 block discarded – undo
11198 11198
 	*/
11199 11199
 	public function convertAircraftRegistration($registration)
11200 11200
 	{
11201
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11201
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11202 11202
 		$registration_prefix = '';
11203 11203
 		$registration_1 = substr($registration, 0, 1);
11204 11204
 		$registration_2 = substr($registration, 0, 2);
11205 11205
 
11206 11206
 		//first get the prefix based on two characters
11207
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11207
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11208 11208
       
11209 11209
 		
11210 11210
 		$sth = $this->db->prepare($query);
11211 11211
 		$sth->execute(array(':registration_2' => $registration_2));
11212 11212
         
11213
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11213
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11214 11214
 		{
11215 11215
 			$registration_prefix = $row['registration_prefix'];
11216 11216
 		}
@@ -11218,11 +11218,11 @@  discard block
 block discarded – undo
11218 11218
 		//if we didn't find a two chracter prefix lets just search the one with one character
11219 11219
 		if ($registration_prefix == '')
11220 11220
 		{
11221
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11221
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11222 11222
 			$sth = $this->db->prepare($query);
11223 11223
 			$sth->execute(array(':registration_1' => $registration_1));
11224 11224
 	        
11225
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11225
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11226 11226
 			{
11227 11227
 				$registration_prefix = $row['registration_prefix'];
11228 11228
 			}
@@ -11236,7 +11236,7 @@  discard block
 block discarded – undo
11236 11236
 			} else {
11237 11237
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11238 11238
 			}
11239
-		} else if(strlen($registration_prefix) == 2){
11239
+		} else if (strlen($registration_prefix) == 2) {
11240 11240
 			if (0 === strpos($registration, 'N')) {
11241 11241
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11242 11242
 			} else {
@@ -11255,17 +11255,17 @@  discard block
 block discarded – undo
11255 11255
 	*/
11256 11256
 	public function countryFromAircraftRegistration($registration)
11257 11257
 	{
11258
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11258
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11259 11259
 		
11260 11260
 		$registration_prefix = '';
11261
-		$registration_test = explode('-',$registration);
11261
+		$registration_test = explode('-', $registration);
11262 11262
 		$country = '';
11263 11263
 		if ($registration_test[0] != $registration) {
11264 11264
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11265 11265
 	      
11266 11266
 			$sth = $this->db->prepare($query);
11267 11267
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11268
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11268
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11269 11269
 			{
11270 11270
 				//$registration_prefix = $row['registration_prefix'];
11271 11271
 				$country = $row['country'];
@@ -11276,13 +11276,13 @@  discard block
 block discarded – undo
11276 11276
 
11277 11277
 			$country = '';
11278 11278
 			//first get the prefix based on two characters
11279
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11279
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11280 11280
       
11281 11281
 			
11282 11282
 			$sth = $this->db->prepare($query);
11283 11283
 			$sth->execute(array(':registration_2' => $registration_2));
11284 11284
         
11285
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11285
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11286 11286
 			{
11287 11287
 				$registration_prefix = $row['registration_prefix'];
11288 11288
 				$country = $row['country'];
@@ -11291,12 +11291,12 @@  discard block
 block discarded – undo
11291 11291
 			//if we didn't find a two chracter prefix lets just search the one with one character
11292 11292
 			if ($registration_prefix == "")
11293 11293
 			{
11294
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11294
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11295 11295
 	      
11296 11296
 				$sth = $this->db->prepare($query);
11297 11297
 				$sth->execute(array(':registration_1' => $registration_1));
11298 11298
 	        
11299
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11299
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11300 11300
 				{
11301 11301
 					//$registration_prefix = $row['registration_prefix'];
11302 11302
 					$country = $row['country'];
@@ -11316,17 +11316,17 @@  discard block
 block discarded – undo
11316 11316
 	*/
11317 11317
 	public function registrationPrefixFromAircraftRegistration($registration)
11318 11318
 	{
11319
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11319
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11320 11320
 		
11321 11321
 		$registration_prefix = '';
11322
-		$registration_test = explode('-',$registration);
11322
+		$registration_test = explode('-', $registration);
11323 11323
 		//$country = '';
11324 11324
 		if ($registration_test[0] != $registration) {
11325
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11325
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11326 11326
 	      
11327 11327
 			$sth = $this->db->prepare($query);
11328 11328
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11329
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11329
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11330 11330
 			{
11331 11331
 				$registration_prefix = $row['registration_prefix'];
11332 11332
 				//$country = $row['country'];
@@ -11336,13 +11336,13 @@  discard block
 block discarded – undo
11336 11336
 		        $registration_2 = substr($registration, 0, 2);
11337 11337
 
11338 11338
 			//first get the prefix based on two characters
11339
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11339
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11340 11340
       
11341 11341
 			
11342 11342
 			$sth = $this->db->prepare($query);
11343 11343
 			$sth->execute(array(':registration_2' => $registration_2));
11344 11344
         
11345
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11345
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11346 11346
 			{
11347 11347
 				$registration_prefix = $row['registration_prefix'];
11348 11348
 				//$country = $row['country'];
@@ -11351,12 +11351,12 @@  discard block
 block discarded – undo
11351 11351
 			//if we didn't find a two chracter prefix lets just search the one with one character
11352 11352
 			if ($registration_prefix == "")
11353 11353
 			{
11354
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11354
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11355 11355
 	      
11356 11356
 				$sth = $this->db->prepare($query);
11357 11357
 				$sth->execute(array(':registration_1' => $registration_1));
11358 11358
 	        
11359
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11359
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11360 11360
 				{
11361 11361
 					$registration_prefix = $row['registration_prefix'];
11362 11362
 					//$country = $row['country'];
@@ -11377,13 +11377,13 @@  discard block
 block discarded – undo
11377 11377
 	*/
11378 11378
 	public function countryFromAircraftRegistrationCode($registration)
11379 11379
 	{
11380
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11380
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11381 11381
 		
11382 11382
 		$country = '';
11383
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11383
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11384 11384
 		$sth = $this->db->prepare($query);
11385 11385
 		$sth->execute(array(':registration' => $registration));
11386
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11386
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11387 11387
 		{
11388 11388
 			$country = $row['country'];
11389 11389
 		}
@@ -11396,9 +11396,9 @@  discard block
 block discarded – undo
11396 11396
 	* @param String $flightaware_id flightaware_id from spotter_output table
11397 11397
 	* @param String $highlight New highlight value
11398 11398
 	*/
11399
-	public function setHighlightFlight($flightaware_id,$highlight) {
11399
+	public function setHighlightFlight($flightaware_id, $highlight) {
11400 11400
 		
11401
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11401
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11402 11402
 		$sth = $this->db->prepare($query);
11403 11403
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11404 11404
 	}
@@ -11410,13 +11410,13 @@  discard block
 block discarded – undo
11410 11410
 	* @param String $date Date of spotted aircraft
11411 11411
 	* @param String $highlight New highlight value
11412 11412
 	*/
11413
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11413
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11414 11414
 		if ($date == '') {
11415 11415
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11416 11416
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11417 11417
 		} else {
11418 11418
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11419
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11419
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11420 11420
 		}
11421 11421
 		$sth = $this->db->prepare($query);
11422 11422
 		$sth->execute($query_values);
@@ -11446,7 +11446,7 @@  discard block
 block discarded – undo
11446 11446
 		
11447 11447
 		$bitly_data = json_decode($bitly_data);
11448 11448
 		$bitly_url = '';
11449
-		if ($bitly_data->status_txt = "OK"){
11449
+		if ($bitly_data->status_txt = "OK") {
11450 11450
 			$bitly_url = $bitly_data->data->url;
11451 11451
 		}
11452 11452
 
@@ -11456,7 +11456,7 @@  discard block
 block discarded – undo
11456 11456
 
11457 11457
 	public function getOrderBy()
11458 11458
 	{
11459
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_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"));
11459
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_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"));
11460 11460
 		
11461 11461
 		return $orderby;
11462 11462
 		
@@ -11590,14 +11590,14 @@  discard block
 block discarded – undo
11590 11590
 		}
11591 11591
 		$sth = $this->db->prepare($query);
11592 11592
 		$sth->execute();
11593
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11593
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11594 11594
 		{
11595 11595
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11596 11596
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11597 11597
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11598
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
11598
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
11599 11599
 				$sthu = $this->db->prepare($update_query);
11600
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
11600
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
11601 11601
 			}
11602 11602
 		}
11603 11603
 		
@@ -11610,7 +11610,7 @@  discard block
 block discarded – undo
11610 11610
 		}
11611 11611
 		$sth = $this->db->prepare($query);
11612 11612
 		$sth->execute();
11613
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11613
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11614 11614
 		{
11615 11615
 			if (is_numeric(substr($row['ident'], -1, 1)))
11616 11616
 			{
@@ -11619,11 +11619,11 @@  discard block
 block discarded – undo
11619 11619
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11620 11620
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11621 11621
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
11622
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11622
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
11623 11623
 				if (isset($airline_array[0]['name'])) {
11624
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
11624
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
11625 11625
 					$sthu = $this->db->prepare($update_query);
11626
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
11626
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
11627 11627
 				}
11628 11628
 			}
11629 11629
 		}
@@ -11643,18 +11643,18 @@  discard block
 block discarded – undo
11643 11643
 		}
11644 11644
 		$sth = $this->db->prepare($query);
11645 11645
 		$sth->execute();
11646
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11646
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11647 11647
 		{
11648 11648
 			if ($row['aircraft_icao'] != '') {
11649 11649
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
11650
-				if ($row['registration'] != ""){
11650
+				if ($row['registration'] != "") {
11651 11651
 					$image_array = $Image->getSpotterImage($row['registration']);
11652 11652
 					if (!isset($image_array[0]['registration'])) {
11653 11653
 						$Image->addSpotterImage($row['registration']);
11654 11654
 					}
11655 11655
 				}
11656 11656
 				if (count($aircraft_name) > 0) {
11657
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
11657
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
11658 11658
 					$sthu = $this->db->prepare($update_query);
11659 11659
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
11660 11660
 				}
@@ -11669,10 +11669,10 @@  discard block
 block discarded – undo
11669 11669
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
11670 11670
 		$sth = $this->db->prepare($query);
11671 11671
 		$sth->execute();
11672
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11672
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11673 11673
 		{
11674 11674
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
11675
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
11675
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
11676 11676
 				$airport_icao = '';
11677 11677
 				 if (isset($closestAirports[0])) {
11678 11678
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -11686,7 +11686,7 @@  discard block
 block discarded – undo
11686 11686
 								break;
11687 11687
 							}
11688 11688
 						}
11689
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11689
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
11690 11690
 						$airport_icao = $closestAirports[0]['icao'];
11691 11691
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
11692 11692
 					} else {
@@ -11697,28 +11697,28 @@  discard block
 block discarded – undo
11697 11697
 				}
11698 11698
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11699 11699
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
11700
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11700
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11701 11701
 					$sthu = $this->db->prepare($update_query);
11702
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
11702
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
11703 11703
 				}
11704 11704
 			}
11705 11705
 		}
11706 11706
 	}
11707 11707
 	
11708
-	public function closestAirports($origLat,$origLon,$dist = 10) {
11708
+	public function closestAirports($origLat, $origLon, $dist = 10) {
11709 11709
 		global $globalDBdriver;
11710
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
11710
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
11711 11711
 /*
11712 11712
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
11713 11713
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
11714 11714
                       having distance < $dist ORDER BY distance limit 100;";
11715 11715
 */
11716 11716
 		if ($globalDBdriver == 'mysql') {
11717
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
11717
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
11718 11718
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
11719 11719
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
11720 11720
                 } else {
11721
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
11721
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
11722 11722
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
11723 11723
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
11724 11724
     		}
Please login to merge, or discard this patch.
Braces   +718 added lines, -250 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) {
73
+			$filter = array_merge($filter,$globalFilter);
74
+		}
73 75
 		$filter_query_join = '';
74 76
 		$filter_query_where = '';
75 77
 		foreach($filters as $flt) {
@@ -122,8 +124,11 @@  discard block
 block discarded – undo
122 124
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
123 125
 			}
124 126
 		}
125
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
126
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
127
+		if ($filter_query_where == '' && $where) {
128
+			$filter_query_where = ' WHERE';
129
+		} elseif ($filter_query_where != '' && $and) {
130
+			$filter_query_where .= ' AND';
131
+		}
127 132
 		$filter_query = $filter_query_join.$filter_query_where;
128 133
 		return $filter_query;
129 134
 	}
@@ -143,10 +148,18 @@  discard block
 block discarded – undo
143 148
 		$Image = new Image($this->db);
144 149
 		$Schedule = new Schedule($this->db);
145 150
 		$ACARS = new ACARS($this->db);
146
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
147
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
148
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
149
-		if (!isset($globalVAM)) $globalVAM = FALSE;
151
+		if (!isset($globalIVAO)) {
152
+			$globalIVAO = FALSE;
153
+		}
154
+		if (!isset($globalVATSIM)) {
155
+			$globalVATSIM = FALSE;
156
+		}
157
+		if (!isset($globalphpVMS)) {
158
+			$globalphpVMS = FALSE;
159
+		}
160
+		if (!isset($globalVAM)) {
161
+			$globalVAM = FALSE;
162
+		}
150 163
 		date_default_timezone_set('UTC');
151 164
 		
152 165
 		if (!is_string($query))
@@ -193,21 +206,35 @@  discard block
 block discarded – undo
193 206
 			} else {
194 207
 				$temp_array['spotter_id'] = '';
195 208
 			}
196
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
197
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
209
+			if (isset($row['flightaware_id'])) {
210
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
211
+			}
212
+			if (isset($row['modes'])) {
213
+				$temp_array['modes'] = $row['modes'];
214
+			}
198 215
 			$temp_array['ident'] = $row['ident'];
199 216
 			if (isset($row['registration']) && $row['registration'] != '') {
200 217
 				$temp_array['registration'] = $row['registration'];
201 218
 			} elseif (isset($temp_array['modes'])) {
202 219
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
203
-			} else $temp_array['registration'] = '';
204
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
220
+			} else {
221
+				$temp_array['registration'] = '';
222
+			}
223
+			if (isset($row['aircraft_icao'])) {
224
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
225
+			}
205 226
 			
206 227
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
207 228
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
208
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
209
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
210
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
229
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
230
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
231
+			}
232
+			if (isset($row['latitude'])) {
233
+				$temp_array['latitude'] = $row['latitude'];
234
+			}
235
+			if (isset($row['longitude'])) {
236
+				$temp_array['longitude'] = $row['longitude'];
237
+			}
211 238
 			/*
212 239
 			if (Connection->tableExists('countries')) {
213 240
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -217,8 +244,12 @@  discard block
 block discarded – undo
217 244
 				}
218 245
 			}
219 246
 			*/
220
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
221
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
247
+			if (isset($row['waypoints'])) {
248
+				$temp_array['waypoints'] = $row['waypoints'];
249
+			}
250
+			if (isset($row['format_source'])) {
251
+				$temp_array['format_source'] = $row['format_source'];
252
+			}
222 253
 			if (isset($row['route_stop'])) {
223 254
 				$temp_array['route_stop'] = $row['route_stop'];
224 255
 				if ($row['route_stop'] != '') {
@@ -237,13 +268,19 @@  discard block
 block discarded – undo
237 268
 					}
238 269
 				}
239 270
 			}
240
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
271
+			if (isset($row['altitude'])) {
272
+				$temp_array['altitude'] = $row['altitude'];
273
+			}
241 274
 			if (isset($row['heading'])) {
242 275
 				$temp_array['heading'] = $row['heading'];
243 276
 				$heading_direction = $this->parseDirection($row['heading']);
244
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
277
+				if (isset($heading_direction[0]['direction_fullname'])) {
278
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
279
+				}
280
+			}
281
+			if (isset($row['ground_speed'])) {
282
+				$temp_array['ground_speed'] = $row['ground_speed'];
245 283
 			}
246
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
247 284
 			$temp_array['image'] = "";
248 285
 			$temp_array['image_thumbnail'] = "";
249 286
 			$temp_array['image_source'] = "";
@@ -251,7 +288,9 @@  discard block
 block discarded – undo
251 288
  
252 289
 			if (isset($row['highlight'])) {
253 290
 				$temp_array['highlight'] = $row['highlight'];
254
-			} else $temp_array['highlight'] = '';
291
+			} else {
292
+				$temp_array['highlight'] = '';
293
+			}
255 294
 			
256 295
 			if (isset($row['date'])) {
257 296
 				$dateArray = $this->parseDateString($row['date']);
@@ -299,7 +338,9 @@  discard block
 block discarded – undo
299 338
 				
300 339
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 340
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302
-					} else $temp_array['aircraft_shadow'] = 'default.png';
341
+					} else {
342
+						$temp_array['aircraft_shadow'] = 'default.png';
343
+					}
303 344
                                 } else {
304 345
                             		$temp_array['aircraft_shadow'] = 'default.png';
305 346
 					$temp_array['aircraft_name'] = 'N/A';
@@ -307,11 +348,17 @@  discard block
 block discarded – undo
307 348
                             	}
308 349
 			}
309 350
 			$fromsource = NULL;
310
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
311
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
312
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
313
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
314
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
351
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
352
+				$fromsource = $globalAirlinesSource;
353
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
354
+				$fromsource = 'vatsim';
355
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
356
+				$fromsource = 'ivao';
357
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
358
+				$fromsource = 'vatsim';
359
+			} elseif (isset($globalIVAO) && $globalIVAO) {
360
+				$fromsource = 'ivao';
361
+			}
315 362
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
316 363
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
317 364
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -334,12 +381,18 @@  discard block
 block discarded – undo
334 381
 				}
335 382
 			} else {
336 383
 				$temp_array['airline_icao'] = $row['airline_icao'];
337
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
338
-				else $temp_array['airline_iata'] = 'N/A';
384
+				if (isset($row['airline_iata'])) {
385
+					$temp_array['airline_iata'] = $row['airline_iata'];
386
+				} else {
387
+					$temp_array['airline_iata'] = 'N/A';
388
+				}
339 389
 				$temp_array['airline_name'] = $row['airline_name'];
340 390
 				$temp_array['airline_country'] = $row['airline_country'];
341
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
342
-				else $temp_array['airline_callsign'] = 'N/A';
391
+				if (isset($row['airline_callsign'])) {
392
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
393
+				} else {
394
+					$temp_array['airline_callsign'] = 'N/A';
395
+				}
343 396
 				$temp_array['airline_type'] = $row['airline_type'];
344 397
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
345 398
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -366,7 +419,9 @@  discard block
 block discarded – undo
366 419
 			}
367 420
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
368 421
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
369
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
422
+				if ($owner_info['owner'] != '') {
423
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
424
+				}
370 425
 				$temp_array['aircraft_base'] = $owner_info['base'];
371 426
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
372 427
 			}
@@ -374,9 +429,14 @@  discard block
 block discarded – undo
374 429
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
375 430
 			{
376 431
 				if ($globalIVAO) {
377
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
378
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
379
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
432
+					if (isset($temp_array['airline_icao'])) {
433
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
434
+					} else {
435
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
436
+					}
437
+				} else {
438
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
439
+				}
380 440
 				if (count($image_array) > 0) {
381 441
 					$temp_array['image'] = $image_array[0]['image'];
382 442
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -428,7 +488,9 @@  discard block
 block discarded – undo
428 488
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
429 489
 			if ($row['departure_airport_icao'] != '') {
430 490
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
431
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
491
+				if (!isset($departure_airport_array[0]['name'])) {
492
+					$departure_airport_array = $this->getAllAirportInfo('NA');
493
+				}
432 494
 			/*
433 495
 			} elseif ($row['departure_airport_name'] != '') {
434 496
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -436,7 +498,9 @@  discard block
 block discarded – undo
436 498
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
437 499
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
438 500
 			*/
439
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
501
+			} else {
502
+				$departure_airport_array = $this->getAllAirportInfo('NA');
503
+			}
440 504
 			if (isset($departure_airport_array[0]['name'])) {
441 505
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
442 506
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -456,8 +520,12 @@  discard block
 block discarded – undo
456 520
 			
457 521
 			if ($row['arrival_airport_icao'] != '') {
458 522
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
459
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
460
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
523
+				if (count($arrival_airport_array) == 0) {
524
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
525
+				}
526
+			} else {
527
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
528
+			}
461 529
 			if (isset($arrival_airport_array[0]['name'])) {
462 530
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
463 531
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -473,27 +541,45 @@  discard block
 block discarded – undo
473 541
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
474 542
 			}
475 543
 			*/
476
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
477
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
478
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
479
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
480
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
544
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
545
+				$temp_array['pilot_id'] = $row['pilot_id'];
546
+			}
547
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
548
+				$temp_array['pilot_name'] = $row['pilot_name'];
549
+			}
550
+			if (isset($row['source_name']) && $row['source_name'] != '') {
551
+				$temp_array['source_name'] = $row['source_name'];
552
+			}
553
+			if (isset($row['over_country']) && $row['over_country'] != '') {
554
+				$temp_array['over_country'] = $row['over_country'];
555
+			}
556
+			if (isset($row['distance']) && $row['distance'] != '') {
557
+				$temp_array['distance'] = $row['distance'];
558
+			}
481 559
 			if (isset($row['squawk'])) {
482 560
 				$temp_array['squawk'] = $row['squawk'];
483 561
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
484 562
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
485
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
563
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
564
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
565
+					}
486 566
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
487 567
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
488
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
489
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
568
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
569
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
570
+					}
571
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
572
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
573
+				}
490 574
 			}
491 575
     			
492 576
 			$temp_array['query_number_rows'] = $num_rows;
493 577
 			
494 578
 			$spotter_array[] = $temp_array;
495 579
 		}
496
-		if ($num_rows == 0) return array();
580
+		if ($num_rows == 0) {
581
+			return array();
582
+		}
497 583
 		$spotter_array[0]['query_number_rows'] = $num_rows;
498 584
 		return $spotter_array;
499 585
 	}	
@@ -526,7 +612,9 @@  discard block
 block discarded – undo
526 612
 				foreach ($q_array as $q_item){
527 613
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
528 614
 					$additional_query .= " AND (";
529
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
615
+					if (is_int($q_item)) {
616
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
617
+					}
530 618
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
531 619
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
532 620
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -547,7 +635,9 @@  discard block
 block discarded – undo
547 635
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
548 636
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
549 637
 					$translate = $Translation->ident2icao($q_item);
550
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
638
+					if ($translate != $q_item) {
639
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
640
+					}
551 641
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
552 642
 					$additional_query .= ")";
553 643
 				}
@@ -774,7 +864,9 @@  discard block
 block discarded – undo
774 864
 				date_default_timezone_set($globalTimezone);
775 865
 				$datetime = new DateTime();
776 866
 				$offset = $datetime->format('P');
777
-			} else $offset = '+00:00';
867
+			} else {
868
+				$offset = '+00:00';
869
+			}
778 870
 
779 871
 			if ($date_array[1] != "")
780 872
 			{
@@ -806,8 +898,12 @@  discard block
 block discarded – undo
806 898
 			{
807 899
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
808 900
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
809
-			} else $limit_query = "";
810
-		} else $limit_query = "";
901
+			} else {
902
+				$limit_query = "";
903
+			}
904
+		} else {
905
+			$limit_query = "";
906
+		}
811 907
 
812 908
 
813 909
 		if ($sort != "")
@@ -875,8 +971,12 @@  discard block
 block discarded – undo
875 971
 			{
876 972
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
877 973
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
878
-			} else $limit_query = "";
879
-		} else $limit_query = "";
974
+			} else {
975
+				$limit_query = "";
976
+			}
977
+		} else {
978
+			$limit_query = "";
979
+		}
880 980
 		
881 981
 		if ($sort != "")
882 982
 		{
@@ -1200,7 +1300,9 @@  discard block
 block discarded – undo
1200 1300
 		global $global_query;
1201 1301
 		
1202 1302
 		date_default_timezone_set('UTC');
1203
-		if ($id == '') return array();
1303
+		if ($id == '') {
1304
+			return array();
1305
+		}
1204 1306
 		$additional_query = "spotter_output.spotter_id = :id";
1205 1307
 		$query_values = array(':id' => $id);
1206 1308
 
@@ -1937,7 +2039,9 @@  discard block
 block discarded – undo
1937 2039
 		{
1938 2040
 			$highlight = $row['highlight'];
1939 2041
 		}
1940
-		if (isset($highlight)) return $highlight;
2042
+		if (isset($highlight)) {
2043
+			return $highlight;
2044
+		}
1941 2045
 	}
1942 2046
 
1943 2047
 	
@@ -1965,7 +2069,9 @@  discard block
 block discarded – undo
1965 2069
 		$sth->closeCursor();
1966 2070
 		if (count($row) > 0) {
1967 2071
 			return $row['usage'];
1968
-		} else return '';
2072
+		} else {
2073
+			return '';
2074
+		}
1969 2075
 	}
1970 2076
 
1971 2077
 	/**
@@ -1990,7 +2096,9 @@  discard block
 block discarded – undo
1990 2096
 		$sth->closeCursor();
1991 2097
 		if (count($row) > 0) {
1992 2098
 			return $row['icao'];
1993
-		} else return '';
2099
+		} else {
2100
+			return '';
2101
+		}
1994 2102
 	}
1995 2103
 
1996 2104
 	/**
@@ -2018,7 +2126,9 @@  discard block
 block discarded – undo
2018 2126
 			$airport_longitude = $row['longitude'];
2019 2127
 			$Common = new Common();
2020 2128
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2021
-		} else return '';
2129
+		} else {
2130
+			return '';
2131
+		}
2022 2132
 	}
2023 2133
 	
2024 2134
 	/**
@@ -2130,7 +2240,9 @@  discard block
 block discarded – undo
2130 2240
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2131 2241
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2132 2242
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2133
-		} else return array();
2243
+		} else {
2244
+			return array();
2245
+		}
2134 2246
 		if ($globalDBdriver == 'mysql') {
2135 2247
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2136 2248
 		} else {
@@ -2165,7 +2277,9 @@  discard block
 block discarded – undo
2165 2277
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2166 2278
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2167 2279
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2168
-		} else return array();
2280
+		} else {
2281
+			return array();
2282
+		}
2169 2283
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2170 2284
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2171 2285
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2200,7 +2314,9 @@  discard block
 block discarded – undo
2200 2314
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2201 2315
 	{
2202 2316
 		global $globalUseRealAirlines;
2203
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2317
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2318
+			$fromsource = NULL;
2319
+		}
2204 2320
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2205 2321
 		if ($airline_icao == 'NA') {
2206 2322
 			$airline_array = array();
@@ -2269,7 +2385,9 @@  discard block
 block discarded – undo
2269 2385
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2270 2386
 	{
2271 2387
 		global $globalUseRealAirlines;
2272
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2388
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2389
+			$fromsource = NULL;
2390
+		}
2273 2391
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2274 2392
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2275 2393
 		$sth = $this->db->prepare($query);
@@ -2285,7 +2403,9 @@  discard block
 block discarded – undo
2285 2403
 			$sth->execute(array(':fromsource' => $fromsource));
2286 2404
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2287 2405
 			$sth->closeCursor();
2288
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2406
+			if ($row['nb'] == 0) {
2407
+				$result = $this->getAllAirlineInfoByName($airline_name);
2408
+			}
2289 2409
 		}
2290 2410
 		return $result;
2291 2411
 	}
@@ -2348,15 +2468,20 @@  discard block
 block discarded – undo
2348 2468
 				'A320-211' => 'A320',
2349 2469
 				'747-8i' => 'B748',
2350 2470
 				'A380' => 'A388');
2351
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2471
+		if (isset($all_aircraft[$aircraft_type])) {
2472
+			return $all_aircraft[$aircraft_type];
2473
+		}
2352 2474
 
2353 2475
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2354 2476
 		$aircraft_type = strtoupper($aircraft_type);
2355 2477
 		$sth = $this->db->prepare($query);
2356 2478
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2357 2479
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2358
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2359
-		else return '';
2480
+		if (isset($result[0]['icao'])) {
2481
+			return $result[0]['icao'];
2482
+		} else {
2483
+			return '';
2484
+		}
2360 2485
 	}
2361 2486
 	
2362 2487
 	/**
@@ -2379,9 +2504,13 @@  discard block
 block discarded – undo
2379 2504
 		$sth->closeCursor();
2380 2505
 		if (isset($row['icaotypecode'])) {
2381 2506
 			$icao = $row['icaotypecode'];
2382
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2507
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2508
+				$icao = $this->aircraft_correct_icaotype[$icao];
2509
+			}
2383 2510
 			return $icao;
2384
-		} else return '';
2511
+		} else {
2512
+			return '';
2513
+		}
2385 2514
 	}
2386 2515
 
2387 2516
 	/**
@@ -2404,7 +2533,9 @@  discard block
 block discarded – undo
2404 2533
 		$sth->closeCursor();
2405 2534
 		if (isset($row['icaotypecode'])) {
2406 2535
 			return $row['icaotypecode'];
2407
-		} else return '';
2536
+		} else {
2537
+			return '';
2538
+		}
2408 2539
 	}
2409 2540
 
2410 2541
 	/**
@@ -2450,7 +2581,9 @@  discard block
 block discarded – undo
2450 2581
 		$sth->closeCursor();
2451 2582
 		if (isset($row['operator_correct'])) {
2452 2583
 			return $row['operator_correct'];
2453
-		} else return $operator;
2584
+		} else {
2585
+			return $operator;
2586
+		}
2454 2587
 	}
2455 2588
 
2456 2589
 	/**
@@ -2463,7 +2596,9 @@  discard block
 block discarded – undo
2463 2596
 	public function getRouteInfo($callsign)
2464 2597
 	{
2465 2598
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2466
-                if ($callsign == '') return array();
2599
+                if ($callsign == '') {
2600
+                	return array();
2601
+                }
2467 2602
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2468 2603
 		
2469 2604
 		$sth = $this->db->prepare($query);
@@ -2473,7 +2608,9 @@  discard block
 block discarded – undo
2473 2608
 		$sth->closeCursor();
2474 2609
 		if (count($row) > 0) {
2475 2610
 			return $row;
2476
-		} else return array();
2611
+		} else {
2612
+			return array();
2613
+		}
2477 2614
 	}
2478 2615
 	
2479 2616
 	/**
@@ -2526,7 +2663,9 @@  discard block
 block discarded – undo
2526 2663
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2527 2664
 			$sth->closeCursor();
2528 2665
 			return $result;
2529
-		} else return array();
2666
+		} else {
2667
+			return array();
2668
+		}
2530 2669
 	}
2531 2670
 	
2532 2671
   
@@ -2685,8 +2824,11 @@  discard block
 block discarded – undo
2685 2824
 		$query .= " ORDER BY spotter_output.source_name ASC";
2686 2825
 
2687 2826
 		$sth = $this->db->prepare($query);
2688
-		if (!empty($query_values)) $sth->execute($query_values);
2689
-		else $sth->execute();
2827
+		if (!empty($query_values)) {
2828
+			$sth->execute($query_values);
2829
+		} else {
2830
+			$sth->execute();
2831
+		}
2690 2832
 
2691 2833
 		$source_array = array();
2692 2834
 		$temp_array = array();
@@ -2719,9 +2861,13 @@  discard block
 block discarded – undo
2719 2861
 								WHERE spotter_output.airline_icao <> '' 
2720 2862
 								ORDER BY spotter_output.airline_name ASC";
2721 2863
 			*/
2722
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2723
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2724
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2864
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2865
+				$forsource = $globalAirlinesSource;
2866
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2867
+				$forsource = 'vatsim';
2868
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2869
+				$forsource = 'ivao';
2870
+			}
2725 2871
 			if ($forsource === NULL) {
2726 2872
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2727 2873
 				$query_data = array();
@@ -2764,9 +2910,13 @@  discard block
 block discarded – undo
2764 2910
 	{
2765 2911
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766 2912
 		$filter_query = $this->getFilter($filters,true,true);
2767
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2768
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2769
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2913
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2914
+			$forsource = $globalAirlinesSource;
2915
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2916
+			$forsource = 'vatsim';
2917
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2918
+			$forsource = 'ivao';
2919
+		}
2770 2920
 		if ($forsource === NULL) {
2771 2921
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2772 2922
 			$query_data = array();
@@ -3077,7 +3227,9 @@  discard block
 block discarded – undo
3077 3227
 			date_default_timezone_set($globalTimezone);
3078 3228
 			$datetime = new DateTime();
3079 3229
 			$offset = $datetime->format('P');
3080
-		} else $offset = '+00:00';
3230
+		} else {
3231
+			$offset = '+00:00';
3232
+		}
3081 3233
 		if ($airport_icao == '') {
3082 3234
 			if ($globalDBdriver == 'mysql') {
3083 3235
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3109,7 +3261,9 @@  discard block
 block discarded – undo
3109 3261
 			date_default_timezone_set($globalTimezone);
3110 3262
 			$datetime = new DateTime();
3111 3263
 			$offset = $datetime->format('P');
3112
-		} else $offset = '+00:00';
3264
+		} else {
3265
+			$offset = '+00:00';
3266
+		}
3113 3267
 		if ($airport_icao == '') {
3114 3268
 			if ($globalDBdriver == 'mysql') {
3115 3269
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3142,7 +3296,9 @@  discard block
 block discarded – undo
3142 3296
 			date_default_timezone_set($globalTimezone);
3143 3297
 			$datetime = new DateTime();
3144 3298
 			$offset = $datetime->format('P');
3145
-		} else $offset = '+00:00';
3299
+		} else {
3300
+			$offset = '+00:00';
3301
+		}
3146 3302
 		if ($airport_icao == '') {
3147 3303
 			if ($globalDBdriver == 'mysql') {
3148 3304
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3181,7 +3337,9 @@  discard block
 block discarded – undo
3181 3337
 			date_default_timezone_set($globalTimezone);
3182 3338
 			$datetime = new DateTime();
3183 3339
 			$offset = $datetime->format('P');
3184
-		} else $offset = '+00:00';
3340
+		} else {
3341
+			$offset = '+00:00';
3342
+		}
3185 3343
 		if ($airport_icao == '') {
3186 3344
 			if ($globalDBdriver == 'mysql') {
3187 3345
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3226,7 +3384,9 @@  discard block
 block discarded – undo
3226 3384
 			date_default_timezone_set($globalTimezone);
3227 3385
 			$datetime = new DateTime();
3228 3386
 			$offset = $datetime->format('P');
3229
-		} else $offset = '+00:00';
3387
+		} else {
3388
+			$offset = '+00:00';
3389
+		}
3230 3390
 		if ($airport_icao == '') {
3231 3391
 			if ($globalDBdriver == 'mysql') {
3232 3392
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3261,7 +3421,9 @@  discard block
 block discarded – undo
3261 3421
 			date_default_timezone_set($globalTimezone);
3262 3422
 			$datetime = new DateTime();
3263 3423
 			$offset = $datetime->format('P');
3264
-		} else $offset = '+00:00';
3424
+		} else {
3425
+			$offset = '+00:00';
3426
+		}
3265 3427
 		if ($airport_icao == '') {
3266 3428
 			if ($globalDBdriver == 'mysql') {
3267 3429
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3303,7 +3465,9 @@  discard block
 block discarded – undo
3303 3465
 			date_default_timezone_set($globalTimezone);
3304 3466
 			$datetime = new DateTime();
3305 3467
 			$offset = $datetime->format('P');
3306
-		} else $offset = '+00:00';
3468
+		} else {
3469
+			$offset = '+00:00';
3470
+		}
3307 3471
 		if ($airport_icao == '') {
3308 3472
 			if ($globalDBdriver == 'mysql') {
3309 3473
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3337,7 +3501,9 @@  discard block
 block discarded – undo
3337 3501
 			date_default_timezone_set($globalTimezone);
3338 3502
 			$datetime = new DateTime();
3339 3503
 			$offset = $datetime->format('P');
3340
-		} else $offset = '+00:00';
3504
+		} else {
3505
+			$offset = '+00:00';
3506
+		}
3341 3507
 		if ($airport_icao == '') {
3342 3508
 			if ($globalDBdriver == 'mysql') {
3343 3509
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3385,7 +3551,9 @@  discard block
 block discarded – undo
3385 3551
 			date_default_timezone_set($globalTimezone);
3386 3552
 			$datetime = new DateTime();
3387 3553
 			$offset = $datetime->format('P');
3388
-		} else $offset = '+00:00';
3554
+		} else {
3555
+			$offset = '+00:00';
3556
+		}
3389 3557
 
3390 3558
 		if ($globalDBdriver == 'mysql') {
3391 3559
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3505,7 +3673,9 @@  discard block
 block discarded – undo
3505 3673
 	*/	
3506 3674
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3507 3675
 	{
3508
-		if ($groundspeed == '') $groundspeed = NULL;
3676
+		if ($groundspeed == '') {
3677
+			$groundspeed = NULL;
3678
+		}
3509 3679
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3510 3680
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3511 3681
 
@@ -3555,10 +3725,18 @@  discard block
 block discarded – undo
3555 3725
 		$Image = new Image($this->db);
3556 3726
 		$Common = new Common();
3557 3727
 		
3558
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3559
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3560
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3561
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3728
+		if (!isset($globalIVAO)) {
3729
+			$globalIVAO = FALSE;
3730
+		}
3731
+		if (!isset($globalVATSIM)) {
3732
+			$globalVATSIM = FALSE;
3733
+		}
3734
+		if (!isset($globalphpVMS)) {
3735
+			$globalphpVMS = FALSE;
3736
+		}
3737
+		if (!isset($globalVAM)) {
3738
+			$globalVAM = FALSE;
3739
+		}
3562 3740
 		date_default_timezone_set('UTC');
3563 3741
 		
3564 3742
 		//getting the registration
@@ -3571,23 +3749,33 @@  discard block
 block discarded – undo
3571 3749
 				if ($ModeS != '') {
3572 3750
 					$timeelapsed = microtime(true);
3573 3751
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3574
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3752
+					if ($globalDebugTimeElapsed) {
3753
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3754
+					}
3575 3755
 				} else {
3576 3756
 					$myhex = explode('-',$flightaware_id);
3577 3757
 					if (count($myhex) > 0) {
3578 3758
 						$timeelapsed = microtime(true);
3579 3759
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3580
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3760
+						if ($globalDebugTimeElapsed) {
3761
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3762
+						}
3581 3763
 					}
3582 3764
 				}
3583 3765
 			}
3584 3766
 		}
3585 3767
 		$fromsource = NULL;
3586
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3587
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3588
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3589
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3590
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3768
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3769
+			$fromsource = $globalAirlinesSource;
3770
+		} elseif ($format_source == 'vatsimtxt') {
3771
+			$fromsource = 'vatsim';
3772
+		} elseif ($format_source == 'whazzup') {
3773
+			$fromsource = 'ivao';
3774
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3775
+			$fromsource = 'vatsim';
3776
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3777
+			$fromsource = 'ivao';
3778
+		}
3591 3779
 		//getting the airline information
3592 3780
 		if ($ident != "")
3593 3781
 		{
@@ -3611,15 +3799,21 @@  discard block
 block discarded – undo
3611 3799
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3612 3800
 						$airline_array = $this->getAllAirlineInfo("NA");
3613 3801
 					}
3614
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3802
+					if ($globalDebugTimeElapsed) {
3803
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3804
+					}
3615 3805
 
3616 3806
 				} else {
3617 3807
 					$timeelapsed = microtime(true);
3618 3808
 					$airline_array = $this->getAllAirlineInfo("NA");
3619
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3809
+					if ($globalDebugTimeElapsed) {
3810
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3811
+					}
3620 3812
 				}
3621 3813
 			}
3622
-		} else $airline_array = array();
3814
+		} else {
3815
+			$airline_array = array();
3816
+		}
3623 3817
 		
3624 3818
 		//getting the aircraft information
3625 3819
 		$aircraft_array = array();
@@ -3633,27 +3827,37 @@  discard block
 block discarded – undo
3633 3827
 				{
3634 3828
 					$timeelapsed = microtime(true);
3635 3829
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3636
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3830
+					if ($globalDebugTimeElapsed) {
3831
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3832
+					}
3637 3833
 				} else {
3638 3834
 					$timeelapsed = microtime(true);
3639 3835
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3640
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3836
+					if ($globalDebugTimeElapsed) {
3837
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3838
+					}
3641 3839
 				}
3642 3840
 			}
3643 3841
 		} else {
3644 3842
 			if ($ModeS != '') {
3645 3843
 				$timeelapsed = microtime(true);
3646 3844
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3647
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3845
+				if ($globalDebugTimeElapsed) {
3846
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3847
+				}
3648 3848
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3649 3849
 				{
3650 3850
 					$timeelapsed = microtime(true);
3651 3851
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3652
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3852
+					if ($globalDebugTimeElapsed) {
3853
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3854
+					}
3653 3855
 				} else {
3654 3856
 					$timeelapsed = microtime(true);
3655 3857
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3656
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3858
+					if ($globalDebugTimeElapsed) {
3859
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3860
+					}
3657 3861
 				}
3658 3862
 			}
3659 3863
 		}
@@ -3669,7 +3873,9 @@  discard block
 block discarded – undo
3669 3873
 			} else {
3670 3874
 				$timeelapsed = microtime(true);
3671 3875
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3672
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3876
+				if ($globalDebugTimeElapsed) {
3877
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3878
+				}
3673 3879
 			}
3674 3880
 		}
3675 3881
 		
@@ -3684,7 +3890,9 @@  discard block
 block discarded – undo
3684 3890
 			} else {
3685 3891
 				$timeelapsed = microtime(true);
3686 3892
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3687
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3893
+				if ($globalDebugTimeElapsed) {
3894
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3895
+				}
3688 3896
 			}
3689 3897
 		}
3690 3898
 
@@ -3718,7 +3926,9 @@  discard block
 block discarded – undo
3718 3926
 			{
3719 3927
 				return false;
3720 3928
 			}
3721
-		} else $altitude = 0;
3929
+		} else {
3930
+			$altitude = 0;
3931
+		}
3722 3932
 		
3723 3933
 		if ($heading != "")
3724 3934
 		{
@@ -3747,7 +3957,9 @@  discard block
 block discarded – undo
3747 3957
 		{
3748 3958
 			$timeelapsed = microtime(true);
3749 3959
 			$image_array = $Image->getSpotterImage($registration);
3750
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3960
+			if ($globalDebugTimeElapsed) {
3961
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3962
+			}
3751 3963
 			if (!isset($image_array[0]['registration']))
3752 3964
 			{
3753 3965
 				//echo "Add image !!!! \n";
@@ -3755,14 +3967,21 @@  discard block
 block discarded – undo
3755 3967
 			}
3756 3968
 			$timeelapsed = microtime(true);
3757 3969
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3758
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3759
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3970
+			if ($globalDebugTimeElapsed) {
3971
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3972
+			}
3973
+			if ($owner_info['owner'] != '') {
3974
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3975
+			}
3760 3976
 		}
3761 3977
     
3762 3978
 		if ($globalIVAO && $aircraft_icao != '')
3763 3979
 		{
3764
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3765
-            		else $airline_icao = '';
3980
+            		if (isset($airline_array[0]['icao'])) {
3981
+            			$airline_icao = $airline_array[0]['icao'];
3982
+            		} else {
3983
+            			$airline_icao = '';
3984
+            		}
3766 3985
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3767 3986
 			if (!isset($image_array[0]['registration']))
3768 3987
 			{
@@ -3807,16 +4026,28 @@  discard block
 block discarded – undo
3807 4026
                 {
3808 4027
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3809 4028
                 }
3810
-                if ($registration == '') $registration = 'NA';
4029
+                if ($registration == '') {
4030
+                	$registration = 'NA';
4031
+                }
3811 4032
                 if ($latitude == '' && $longitude == '') {
3812 4033
             		$latitude = 0;
3813 4034
             		$longitude = 0;
3814 4035
             	}
3815
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3816
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3817
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3818
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3819
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4036
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4037
+                	$squawk = NULL;
4038
+                }
4039
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4040
+                	$verticalrate = NULL;
4041
+                }
4042
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4043
+                	$heading = 0;
4044
+                }
4045
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4046
+                	$groundspeed = 0;
4047
+                }
4048
+                if (!isset($aircraft_owner)) {
4049
+                	$aircraft_owner = NULL;
4050
+                }
3820 4051
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3821 4052
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3822 4053
 
@@ -3827,9 +4058,13 @@  discard block
 block discarded – undo
3827 4058
 		if ($airline_type == '') {
3828 4059
 			$timeelapsed = microtime(true);
3829 4060
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3830
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4061
+			if ($globalDebugTimeElapsed) {
4062
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4063
+			}
4064
+		}
4065
+		if ($airline_type == null) {
4066
+			$airline_type = '';
3831 4067
 		}
3832
-		if ($airline_type == null) $airline_type = '';
3833 4068
                 $aircraft_type = $aircraft_array[0]['type'];
3834 4069
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3835 4070
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3993,7 +4228,9 @@  discard block
 block discarded – undo
3993 4228
 			}
3994 4229
 		}
3995 4230
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3996
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4231
+		if ($limit) {
4232
+			$query .= " LIMIT 10 OFFSET 0";
4233
+		}
3997 4234
 
3998 4235
 		$sth = $this->db->prepare($query);
3999 4236
 		$sth->execute($query_values);
@@ -4066,7 +4303,9 @@  discard block
 block discarded – undo
4066 4303
 		}
4067 4304
 		
4068 4305
 		$query .= " GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4069
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4306
+		if ($limit) {
4307
+			$query .= " LIMIT 10 OFFSET 0";
4308
+		}
4070 4309
       
4071 4310
 		
4072 4311
 		$sth = $this->db->prepare($query);
@@ -4110,7 +4349,9 @@  discard block
 block discarded – undo
4110 4349
 			}
4111 4350
 		}
4112 4351
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4113
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4352
+		if ($limit) {
4353
+			$query .= " LIMIT 10 OFFSET 0";
4354
+		}
4114 4355
       
4115 4356
 		
4116 4357
 		$sth = $this->db->prepare($query);
@@ -4186,7 +4427,9 @@  discard block
 block discarded – undo
4186 4427
 			}
4187 4428
 		}
4188 4429
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4189
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4430
+		if ($limit) {
4431
+			$query .= " LIMIT 10 OFFSET 0";
4432
+		}
4190 4433
 		
4191 4434
 		$sth = $this->db->prepare($query);
4192 4435
 		$sth->execute($query_values);
@@ -4228,7 +4471,9 @@  discard block
 block discarded – undo
4228 4471
 			}
4229 4472
 		}
4230 4473
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4231
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4474
+		if ($limit) {
4475
+			$query .= " LIMIT 10 OFFSET 0";
4476
+		}
4232 4477
       
4233 4478
 		
4234 4479
 		$sth = $this->db->prepare($query);
@@ -4471,7 +4716,9 @@  discard block
 block discarded – undo
4471 4716
 			date_default_timezone_set($globalTimezone);
4472 4717
 			$datetime = new DateTime($date);
4473 4718
 			$offset = $datetime->format('P');
4474
-		} else $offset = '+00:00';
4719
+		} else {
4720
+			$offset = '+00:00';
4721
+		}
4475 4722
 
4476 4723
 		if ($globalDBdriver == 'mysql') {
4477 4724
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4519,7 +4766,9 @@  discard block
 block discarded – undo
4519 4766
 			date_default_timezone_set($globalTimezone);
4520 4767
 			$datetime = new DateTime($date);
4521 4768
 			$offset = $datetime->format('P');
4522
-		} else $offset = '+00:00';
4769
+		} else {
4770
+			$offset = '+00:00';
4771
+		}
4523 4772
 		
4524 4773
 		if ($globalDBdriver == 'mysql') {
4525 4774
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4795,7 +5044,9 @@  discard block
 block discarded – undo
4795 5044
 		}
4796 5045
 		$query .= " GROUP BY spotter_output.airline_country
4797 5046
 					ORDER BY airline_country_count DESC";
4798
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5047
+		if ($limit) {
5048
+			$query .= " LIMIT 10 OFFSET 0";
5049
+		}
4799 5050
       
4800 5051
 		$sth = $this->db->prepare($query);
4801 5052
 		$sth->execute($query_values);
@@ -4823,7 +5074,9 @@  discard block
 block discarded – undo
4823 5074
 		global $globalDBdriver;
4824 5075
 		//$filter_query = $this->getFilter($filters,true,true);
4825 5076
 		$Connection= new Connection($this->db);
4826
-		if (!$Connection->tableExists('countries')) return array();
5077
+		if (!$Connection->tableExists('countries')) {
5078
+			return array();
5079
+		}
4827 5080
 		/*
4828 5081
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4829 5082
 					FROM countries c, spotter_output s
@@ -4855,7 +5108,9 @@  discard block
 block discarded – undo
4855 5108
 		}
4856 5109
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
4857 5110
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4858
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5111
+		if ($limit) {
5112
+			$query .= " LIMIT 10 OFFSET 0";
5113
+		}
4859 5114
       
4860 5115
 		
4861 5116
 		$sth = $this->db->prepare($query);
@@ -4932,7 +5187,9 @@  discard block
 block discarded – undo
4932 5187
 		}
4933 5188
 
4934 5189
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4935
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5190
+		if ($limit) {
5191
+			$query .= " LIMIT 10 OFFSET 0";
5192
+		}
4936 5193
  
4937 5194
 		$sth = $this->db->prepare($query);
4938 5195
 		$sth->execute($query_values);
@@ -5006,7 +5263,9 @@  discard block
 block discarded – undo
5006 5263
 		}
5007 5264
 
5008 5265
 		$query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5009
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5266
+		if ($limit) {
5267
+			$query .= " LIMIT 10 OFFSET 0";
5268
+		}
5010 5269
  
5011 5270
 		$sth = $this->db->prepare($query);
5012 5271
 		$sth->execute($query_values);
@@ -5053,7 +5312,9 @@  discard block
 block discarded – undo
5053 5312
 		}
5054 5313
 
5055 5314
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5056
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5315
+		if ($limit) {
5316
+			$query .= " LIMIT 10 OFFSET 0";
5317
+		}
5057 5318
  
5058 5319
 		$sth = $this->db->prepare($query);
5059 5320
 		$sth->execute();
@@ -5106,7 +5367,9 @@  discard block
 block discarded – undo
5106 5367
 			if($row['registration'] != "")
5107 5368
 			{
5108 5369
 				$image_array = $Image->getSpotterImage($row['registration']);
5109
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5370
+				if (isset($image_array[0]['image_thumbnail'])) {
5371
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5372
+				}
5110 5373
 			}
5111 5374
 			$temp_array['registration_count'] = $row['registration_count'];
5112 5375
 
@@ -5181,7 +5444,9 @@  discard block
 block discarded – undo
5181 5444
 			if($row['registration'] != "")
5182 5445
 			{
5183 5446
 				$image_array = $Image->getSpotterImage($row['registration']);
5184
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5447
+				if (isset($image_array[0]['image_thumbnail'])) {
5448
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5449
+				}
5185 5450
 			}
5186 5451
 			$temp_array['registration_count'] = $row['registration_count'];
5187 5452
 
@@ -5288,7 +5553,9 @@  discard block
 block discarded – undo
5288 5553
 			if($row['registration'] != "")
5289 5554
 			{
5290 5555
 				$image_array = $Image->getSpotterImage($row['registration']);
5291
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5556
+				if (isset($image_array[0]['image_thumbnail'])) {
5557
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5558
+				}
5292 5559
 			}
5293 5560
 			$temp_array['registration_count'] = $row['registration_count'];
5294 5561
 			$aircraft_array[] = $temp_array;
@@ -5413,7 +5680,9 @@  discard block
 block discarded – undo
5413 5680
 			date_default_timezone_set($globalTimezone);
5414 5681
 			$datetime = new DateTime($date);
5415 5682
 			$offset = $datetime->format('P');
5416
-		} else $offset = '+00:00';
5683
+		} else {
5684
+			$offset = '+00:00';
5685
+		}
5417 5686
 
5418 5687
 		if ($globalDBdriver == 'mysql') {
5419 5688
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5460,7 +5729,9 @@  discard block
 block discarded – undo
5460 5729
 			date_default_timezone_set($globalTimezone);
5461 5730
 			$datetime = new DateTime($date);
5462 5731
 			$offset = $datetime->format('P');
5463
-		} else $offset = '+00:00';
5732
+		} else {
5733
+			$offset = '+00:00';
5734
+		}
5464 5735
 
5465 5736
 		if ($globalDBdriver == 'mysql') {
5466 5737
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
@@ -5489,7 +5760,9 @@  discard block
 block discarded – undo
5489 5760
 			if($row['registration'] != "")
5490 5761
 			{
5491 5762
 				$image_array = $Image->getSpotterImage($row['registration']);
5492
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5763
+				if (isset($image_array[0]['image_thumbnail'])) {
5764
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5765
+				}
5493 5766
 			}
5494 5767
 			$temp_array['registration_count'] = $row['registration_count'];
5495 5768
  
@@ -5514,7 +5787,9 @@  discard block
 block discarded – undo
5514 5787
 			date_default_timezone_set($globalTimezone);
5515 5788
 			$datetime = new DateTime($date);
5516 5789
 			$offset = $datetime->format('P');
5517
-		} else $offset = '+00:00';
5790
+		} else {
5791
+			$offset = '+00:00';
5792
+		}
5518 5793
 
5519 5794
 		if ($globalDBdriver == 'mysql') {
5520 5795
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5652,8 +5927,11 @@  discard block
 block discarded – undo
5652 5927
 			if($row['registration'] != "")
5653 5928
 			{
5654 5929
 				$image_array = $Image->getSpotterImage($row['registration']);
5655
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5656
-				else $temp_array['image_thumbnail'] = '';
5930
+				if (isset($image_array[0]['image_thumbnail'])) {
5931
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5932
+				} else {
5933
+					$temp_array['image_thumbnail'] = '';
5934
+				}
5657 5935
 			}
5658 5936
 			$temp_array['registration_count'] = $row['registration_count'];
5659 5937
 			$aircraft_array[] = $temp_array;
@@ -5696,8 +5974,11 @@  discard block
 block discarded – undo
5696 5974
 			if($row['registration'] != "")
5697 5975
 			{
5698 5976
 				$image_array = $Image->getSpotterImage($row['registration']);
5699
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5700
-				else $temp_array['image_thumbnail'] = '';
5977
+				if (isset($image_array[0]['image_thumbnail'])) {
5978
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5979
+				} else {
5980
+					$temp_array['image_thumbnail'] = '';
5981
+				}
5701 5982
 			}
5702 5983
 			$temp_array['registration_count'] = $row['registration_count'];
5703 5984
 			$aircraft_array[] = $temp_array;
@@ -5740,8 +6021,11 @@  discard block
 block discarded – undo
5740 6021
 			if($row['registration'] != "")
5741 6022
 			{
5742 6023
 				$image_array = $Image->getSpotterImage($row['registration']);
5743
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5744
-				else $temp_array['image_thumbnail'] = '';
6024
+				if (isset($image_array[0]['image_thumbnail'])) {
6025
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6026
+				} else {
6027
+					$temp_array['image_thumbnail'] = '';
6028
+				}
5745 6029
 			}
5746 6030
 			$temp_array['registration_count'] = $row['registration_count'];
5747 6031
 			$aircraft_array[] = $temp_array;
@@ -5890,7 +6174,9 @@  discard block
 block discarded – undo
5890 6174
 			if($row['registration'] != "")
5891 6175
 			{
5892 6176
 				$image_array = $Image->getSpotterImage($row['registration']);
5893
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6177
+				if (isset($image_array[0]['image_thumbnail'])) {
6178
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6179
+				}
5894 6180
 			}
5895 6181
 			$temp_array['registration_count'] = $row['registration_count'];
5896 6182
           
@@ -6007,7 +6293,9 @@  discard block
 block discarded – undo
6007 6293
 			if($row['registration'] != "")
6008 6294
 			{
6009 6295
 				$image_array = $Image->getSpotterImage($row['registration']);
6010
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6296
+				if (isset($image_array[0]['image_thumbnail'])) {
6297
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6298
+				}
6011 6299
 			}
6012 6300
 			$temp_array['registration_count'] = $row['registration_count'];
6013 6301
           
@@ -6173,7 +6461,9 @@  discard block
 block discarded – undo
6173 6461
 			}
6174 6462
 		}
6175 6463
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6176
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6464
+		if ($limit) {
6465
+			$query .= " LIMIT 10 OFFSET 0";
6466
+		}
6177 6467
 		
6178 6468
 		$sth = $this->db->prepare($query);
6179 6469
 		$sth->execute($query_values);
@@ -6192,7 +6482,9 @@  discard block
 block discarded – undo
6192 6482
 			if($row['registration'] != "")
6193 6483
 			{
6194 6484
 				$image_array = $Image->getSpotterImage($row['registration']);
6195
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6485
+				if (isset($image_array[0]['image_thumbnail'])) {
6486
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6487
+				}
6196 6488
 			}
6197 6489
           
6198 6490
 			$aircraft_array[] = $temp_array;
@@ -6233,7 +6525,9 @@  discard block
 block discarded – undo
6233 6525
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6234 6526
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6235 6527
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6236
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6528
+		if ($limit) {
6529
+			$query .= " LIMIT 10 OFFSET 0";
6530
+		}
6237 6531
 		
6238 6532
 		$sth = $this->db->prepare($query);
6239 6533
 		$sth->execute();
@@ -6253,7 +6547,9 @@  discard block
 block discarded – undo
6253 6547
 			if($row['registration'] != "")
6254 6548
 			{
6255 6549
 				$image_array = $Image->getSpotterImage($row['registration']);
6256
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6550
+				if (isset($image_array[0]['image_thumbnail'])) {
6551
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6552
+				}
6257 6553
 			}
6258 6554
           
6259 6555
 			$aircraft_array[] = $temp_array;
@@ -6319,7 +6615,9 @@  discard block
 block discarded – undo
6319 6615
 		}
6320 6616
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6321 6617
 				ORDER BY airport_departure_icao_count DESC";
6322
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6618
+		if ($limit) {
6619
+			$query .= " LIMIT 10 OFFSET 0";
6620
+		}
6323 6621
 
6324 6622
 		$sth = $this->db->prepare($query);
6325 6623
 		$sth->execute($query_values);
@@ -6370,7 +6668,9 @@  discard block
 block discarded – undo
6370 6668
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6371 6669
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6372 6670
 				ORDER BY airport_departure_icao_count DESC";
6373
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6671
+		if ($limit) {
6672
+			$query .= " LIMIT 10 OFFSET 0";
6673
+		}
6374 6674
       
6375 6675
 		$sth = $this->db->prepare($query);
6376 6676
 		$sth->execute();
@@ -6448,7 +6748,9 @@  discard block
 block discarded – undo
6448 6748
 		}
6449 6749
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6450 6750
 				ORDER BY airport_departure_icao_count DESC";
6451
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6751
+		if ($limit) {
6752
+			$query .= " LIMIT 10 OFFSET 0";
6753
+		}
6452 6754
     		//echo $query;
6453 6755
 		$sth = $this->db->prepare($query);
6454 6756
 		$sth->execute($query_values);
@@ -6500,7 +6802,9 @@  discard block
 block discarded – undo
6500 6802
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6501 6803
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6502 6804
 				ORDER BY airport_departure_icao_count DESC";
6503
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6805
+		if ($limit) {
6806
+			$query .= " LIMIT 10 OFFSET 0";
6807
+		}
6504 6808
       
6505 6809
 		$sth = $this->db->prepare($query);
6506 6810
 		$sth->execute();
@@ -6895,7 +7199,9 @@  discard block
 block discarded – undo
6895 7199
 			date_default_timezone_set($globalTimezone);
6896 7200
 			$datetime = new DateTime($date);
6897 7201
 			$offset = $datetime->format('P');
6898
-		} else $offset = '+00:00';
7202
+		} else {
7203
+			$offset = '+00:00';
7204
+		}
6899 7205
 
6900 7206
 		if ($globalDBdriver == 'mysql') {
6901 7207
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
@@ -6945,7 +7251,9 @@  discard block
 block discarded – undo
6945 7251
 			date_default_timezone_set($globalTimezone);
6946 7252
 			$datetime = new DateTime($date);
6947 7253
 			$offset = $datetime->format('P');
6948
-		} else $offset = '+00:00';
7254
+		} else {
7255
+			$offset = '+00:00';
7256
+		}
6949 7257
 
6950 7258
 		if ($globalDBdriver == 'mysql') {
6951 7259
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7294,7 +7602,9 @@  discard block
 block discarded – undo
7294 7602
 		}
7295 7603
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7296 7604
 					ORDER BY airport_arrival_icao_count DESC";
7297
-		if ($limit) $query .= " LIMIT 10";
7605
+		if ($limit) {
7606
+			$query .= " LIMIT 10";
7607
+		}
7298 7608
       
7299 7609
 		
7300 7610
 		$sth = $this->db->prepare($query);
@@ -7314,7 +7624,9 @@  discard block
 block discarded – undo
7314 7624
 			if ($icaoaskey) {
7315 7625
 				$icao = $row['arrival_airport_icao'];
7316 7626
 				$airport_array[$icao] = $temp_array;
7317
-			} else $airport_array[] = $temp_array;
7627
+			} else {
7628
+				$airport_array[] = $temp_array;
7629
+			}
7318 7630
 		}
7319 7631
 
7320 7632
 		return $airport_array;
@@ -7351,7 +7663,9 @@  discard block
 block discarded – undo
7351 7663
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7352 7664
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7353 7665
 					ORDER BY airport_arrival_icao_count DESC";
7354
-		if ($limit) $query .= " LIMIT 10";
7666
+		if ($limit) {
7667
+			$query .= " LIMIT 10";
7668
+		}
7355 7669
       
7356 7670
 		
7357 7671
 		$sth = $this->db->prepare($query);
@@ -7372,7 +7686,9 @@  discard block
 block discarded – undo
7372 7686
 			if ($icaoaskey) {
7373 7687
 				$icao = $row['arrival_airport_icao'];
7374 7688
 				$airport_array[$icao] = $temp_array;
7375
-			} else $airport_array[] = $temp_array;
7689
+			} else {
7690
+				$airport_array[] = $temp_array;
7691
+			}
7376 7692
 		}
7377 7693
 
7378 7694
 		return $airport_array;
@@ -7435,7 +7751,9 @@  discard block
 block discarded – undo
7435 7751
 		}
7436 7752
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7437 7753
 					ORDER BY airport_arrival_icao_count DESC";
7438
-		if ($limit) $query .= " LIMIT 10";
7754
+		if ($limit) {
7755
+			$query .= " LIMIT 10";
7756
+		}
7439 7757
       
7440 7758
 		
7441 7759
 		$sth = $this->db->prepare($query);
@@ -7454,7 +7772,9 @@  discard block
 block discarded – undo
7454 7772
 			if ($icaoaskey) {
7455 7773
 				$icao = $row['arrival_airport_icao'];
7456 7774
 				$airport_array[$icao] = $temp_array;
7457
-			} else $airport_array[] = $temp_array;
7775
+			} else {
7776
+				$airport_array[] = $temp_array;
7777
+			}
7458 7778
 		}
7459 7779
 
7460 7780
 		return $airport_array;
@@ -7491,7 +7811,9 @@  discard block
 block discarded – undo
7491 7811
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7492 7812
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7493 7813
 					ORDER BY airport_arrival_icao_count DESC";
7494
-		if ($limit) $query .= " LIMIT 10";
7814
+		if ($limit) {
7815
+			$query .= " LIMIT 10";
7816
+		}
7495 7817
       
7496 7818
 		
7497 7819
 		$sth = $this->db->prepare($query);
@@ -7512,7 +7834,9 @@  discard block
 block discarded – undo
7512 7834
 			if ($icaoaskey) {
7513 7835
 				$icao = $row['arrival_airport_icao'];
7514 7836
 				$airport_array[$icao] = $temp_array;
7515
-			} else $airport_array[] = $temp_array;
7837
+			} else {
7838
+				$airport_array[] = $temp_array;
7839
+			}
7516 7840
 		}
7517 7841
 
7518 7842
 		return $airport_array;
@@ -7893,7 +8217,9 @@  discard block
 block discarded – undo
7893 8217
 			date_default_timezone_set($globalTimezone);
7894 8218
 			$datetime = new DateTime($date);
7895 8219
 			$offset = $datetime->format('P');
7896
-		} else $offset = '+00:00';
8220
+		} else {
8221
+			$offset = '+00:00';
8222
+		}
7897 8223
 
7898 8224
 		if ($globalDBdriver == 'mysql') {
7899 8225
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -7943,7 +8269,9 @@  discard block
 block discarded – undo
7943 8269
 			date_default_timezone_set($globalTimezone);
7944 8270
 			$datetime = new DateTime($date);
7945 8271
 			$offset = $datetime->format('P');
7946
-		} else $offset = '+00:00';
8272
+		} else {
8273
+			$offset = '+00:00';
8274
+		}
7947 8275
 
7948 8276
 		if ($globalDBdriver == 'mysql') {
7949 8277
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8334,7 +8662,9 @@  discard block
 block discarded – undo
8334 8662
 		}
8335 8663
 		$query .= " GROUP BY spotter_output.arrival_airport_country
8336 8664
 					ORDER BY airport_arrival_country_count DESC";
8337
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8665
+		if ($limit) {
8666
+			$query .= " LIMIT 10 OFFSET 0";
8667
+		}
8338 8668
       
8339 8669
 		
8340 8670
 		$sth = $this->db->prepare($query);
@@ -8621,7 +8951,9 @@  discard block
 block discarded – undo
8621 8951
 			date_default_timezone_set($globalTimezone);
8622 8952
 			$datetime = new DateTime($date);
8623 8953
 			$offset = $datetime->format('P');
8624
-		} else $offset = '+00:00';
8954
+		} else {
8955
+			$offset = '+00:00';
8956
+		}
8625 8957
 		
8626 8958
 		if ($globalDBdriver == 'mysql') {
8627 8959
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -8877,12 +9209,18 @@  discard block
 block discarded – undo
8877 9209
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8878 9210
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
8879 9211
 		 if ($olderthanmonths > 0) {
8880
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8881
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9212
+			if ($globalDBdriver == 'mysql') {
9213
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9214
+			} else {
9215
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9216
+			}
8882 9217
 		}
8883 9218
 		if ($sincedate != '') {
8884
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
8885
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9219
+			if ($globalDBdriver == 'mysql') {
9220
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9221
+			} else {
9222
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9223
+			}
8886 9224
 		}
8887 9225
 		$query_values = array();
8888 9226
 		if ($year != '') {
@@ -8913,7 +9251,9 @@  discard block
 block discarded – undo
8913 9251
 			}
8914 9252
 		}
8915 9253
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
8916
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9254
+		if ($limit) {
9255
+			$query .= " LIMIT 10 OFFSET 0";
9256
+		}
8917 9257
       		
8918 9258
 		$sth = $this->db->prepare($query);
8919 9259
 		$sth->execute($query_values);
@@ -8947,15 +9287,23 @@  discard block
 block discarded – undo
8947 9287
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8948 9288
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8949 9289
 		 if ($olderthanmonths > 0) {
8950
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8951
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9290
+			if ($globalDBdriver == 'mysql') {
9291
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9292
+			} else {
9293
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9294
+			}
8952 9295
 		}
8953 9296
 		if ($sincedate != '') {
8954
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
8955
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9297
+			if ($globalDBdriver == 'mysql') {
9298
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9299
+			} else {
9300
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9301
+			}
8956 9302
 		}
8957 9303
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
8958
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9304
+		if ($limit) {
9305
+			$query .= " LIMIT 10 OFFSET 0";
9306
+		}
8959 9307
       		
8960 9308
 		$sth = $this->db->prepare($query);
8961 9309
 		$sth->execute();
@@ -8992,7 +9340,9 @@  discard block
 block discarded – undo
8992 9340
 			date_default_timezone_set($globalTimezone);
8993 9341
 			$datetime = new DateTime();
8994 9342
 			$offset = $datetime->format('P');
8995
-		} else $offset = '+00:00';
9343
+		} else {
9344
+			$offset = '+00:00';
9345
+		}
8996 9346
 
8997 9347
 		if ($globalDBdriver == 'mysql') {
8998 9348
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9041,7 +9391,9 @@  discard block
 block discarded – undo
9041 9391
 			date_default_timezone_set($globalTimezone);
9042 9392
 			$datetime = new DateTime();
9043 9393
 			$offset = $datetime->format('P');
9044
-		} else $offset = '+00:00';
9394
+		} else {
9395
+			$offset = '+00:00';
9396
+		}
9045 9397
 		$filter_query = $this->getFilter($filters,true,true);
9046 9398
 		if ($globalDBdriver == 'mysql') {
9047 9399
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9090,7 +9442,9 @@  discard block
 block discarded – undo
9090 9442
 			date_default_timezone_set($globalTimezone);
9091 9443
 			$datetime = new DateTime();
9092 9444
 			$offset = $datetime->format('P');
9093
-		} else $offset = '+00:00';
9445
+		} else {
9446
+			$offset = '+00:00';
9447
+		}
9094 9448
 		$filter_query = $this->getFilter($filters,true,true);
9095 9449
 		if ($globalDBdriver == 'mysql') {
9096 9450
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9136,7 +9490,9 @@  discard block
 block discarded – undo
9136 9490
 			date_default_timezone_set($globalTimezone);
9137 9491
 			$datetime = new DateTime();
9138 9492
 			$offset = $datetime->format('P');
9139
-		} else $offset = '+00:00';
9493
+		} else {
9494
+			$offset = '+00:00';
9495
+		}
9140 9496
 		$filter_query = $this->getFilter($filters,true,true);
9141 9497
 		if ($globalDBdriver == 'mysql') {
9142 9498
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9184,7 +9540,9 @@  discard block
 block discarded – undo
9184 9540
 			date_default_timezone_set($globalTimezone);
9185 9541
 			$datetime = new DateTime();
9186 9542
 			$offset = $datetime->format('P');
9187
-		} else $offset = '+00:00';
9543
+		} else {
9544
+			$offset = '+00:00';
9545
+		}
9188 9546
 		
9189 9547
 		if ($globalDBdriver == 'mysql') {
9190 9548
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9232,7 +9590,9 @@  discard block
 block discarded – undo
9232 9590
 			date_default_timezone_set($globalTimezone);
9233 9591
 			$datetime = new DateTime();
9234 9592
 			$offset = $datetime->format('P');
9235
-		} else $offset = '+00:00';
9593
+		} else {
9594
+			$offset = '+00:00';
9595
+		}
9236 9596
 
9237 9597
 		if ($globalDBdriver == 'mysql') {
9238 9598
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9279,7 +9639,9 @@  discard block
 block discarded – undo
9279 9639
 			date_default_timezone_set($globalTimezone);
9280 9640
 			$datetime = new DateTime();
9281 9641
 			$offset = $datetime->format('P');
9282
-		} else $offset = '+00:00';
9642
+		} else {
9643
+			$offset = '+00:00';
9644
+		}
9283 9645
 
9284 9646
 		if ($globalDBdriver == 'mysql') {
9285 9647
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9327,7 +9689,9 @@  discard block
 block discarded – undo
9327 9689
 			date_default_timezone_set($globalTimezone);
9328 9690
 			$datetime = new DateTime();
9329 9691
 			$offset = $datetime->format('P');
9330
-		} else $offset = '+00:00';
9692
+		} else {
9693
+			$offset = '+00:00';
9694
+		}
9331 9695
 		$filter_query = $this->getFilter($filters,true,true);
9332 9696
 		if ($globalDBdriver == 'mysql') {
9333 9697
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9372,7 +9736,9 @@  discard block
 block discarded – undo
9372 9736
 			date_default_timezone_set($globalTimezone);
9373 9737
 			$datetime = new DateTime();
9374 9738
 			$offset = $datetime->format('P');
9375
-		} else $offset = '+00:00';
9739
+		} else {
9740
+			$offset = '+00:00';
9741
+		}
9376 9742
 		$filter_query = $this->getFilter($filters,true,true);
9377 9743
 
9378 9744
 		if ($globalDBdriver == 'mysql') {
@@ -9419,7 +9785,9 @@  discard block
 block discarded – undo
9419 9785
 			date_default_timezone_set($globalTimezone);
9420 9786
 			$datetime = new DateTime();
9421 9787
 			$offset = $datetime->format('P');
9422
-		} else $offset = '+00:00';
9788
+		} else {
9789
+			$offset = '+00:00';
9790
+		}
9423 9791
 
9424 9792
 		if ($globalDBdriver == 'mysql') {
9425 9793
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -9465,7 +9833,9 @@  discard block
 block discarded – undo
9465 9833
 			date_default_timezone_set($globalTimezone);
9466 9834
 			$datetime = new DateTime();
9467 9835
 			$offset = $datetime->format('P');
9468
-		} else $offset = '+00:00';
9836
+		} else {
9837
+			$offset = '+00:00';
9838
+		}
9469 9839
 		$filter_query = $this->getFilter($filters,true,true);
9470 9840
 
9471 9841
 		if ($globalDBdriver == 'mysql') {
@@ -9512,7 +9882,9 @@  discard block
 block discarded – undo
9512 9882
 			date_default_timezone_set($globalTimezone);
9513 9883
 			$datetime = new DateTime();
9514 9884
 			$offset = $datetime->format('P');
9515
-		} else $offset = '+00:00';
9885
+		} else {
9886
+			$offset = '+00:00';
9887
+		}
9516 9888
 
9517 9889
 		if ($globalDBdriver == 'mysql') {
9518 9890
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -9559,7 +9931,9 @@  discard block
 block discarded – undo
9559 9931
 			date_default_timezone_set($globalTimezone);
9560 9932
 			$datetime = new DateTime();
9561 9933
 			$offset = $datetime->format('P');
9562
-		} else $offset = '+00:00';
9934
+		} else {
9935
+			$offset = '+00:00';
9936
+		}
9563 9937
 
9564 9938
 		if ($globalDBdriver == 'mysql') {
9565 9939
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -9604,7 +9978,9 @@  discard block
 block discarded – undo
9604 9978
 			date_default_timezone_set($globalTimezone);
9605 9979
 			$datetime = new DateTime();
9606 9980
 			$offset = $datetime->format('P');
9607
-		} else $offset = '+00:00';
9981
+		} else {
9982
+			$offset = '+00:00';
9983
+		}
9608 9984
 		$filter_query = $this->getFilter($filters,true,true);
9609 9985
 
9610 9986
 		if ($globalDBdriver == 'mysql') {
@@ -9652,7 +10028,9 @@  discard block
 block discarded – undo
9652 10028
 			date_default_timezone_set($globalTimezone);
9653 10029
 			$datetime = new DateTime();
9654 10030
 			$offset = $datetime->format('P');
9655
-		} else $offset = '+00:00';
10031
+		} else {
10032
+			$offset = '+00:00';
10033
+		}
9656 10034
 
9657 10035
 		if ($globalDBdriver == 'mysql') {
9658 10036
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -9698,7 +10076,9 @@  discard block
 block discarded – undo
9698 10076
 			date_default_timezone_set($globalTimezone);
9699 10077
 			$datetime = new DateTime();
9700 10078
 			$offset = $datetime->format('P');
9701
-		} else $offset = '+00:00';
10079
+		} else {
10080
+			$offset = '+00:00';
10081
+		}
9702 10082
 		$filter_query = $this->getFilter($filters,true,true);
9703 10083
 
9704 10084
 		if ($globalDBdriver == 'mysql') {
@@ -9746,7 +10126,9 @@  discard block
 block discarded – undo
9746 10126
 			date_default_timezone_set($globalTimezone);
9747 10127
 			$datetime = new DateTime();
9748 10128
 			$offset = $datetime->format('P');
9749
-		} else $offset = '+00:00';
10129
+		} else {
10130
+			$offset = '+00:00';
10131
+		}
9750 10132
 
9751 10133
 		if ($globalDBdriver == 'mysql') {
9752 10134
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -9793,7 +10175,9 @@  discard block
 block discarded – undo
9793 10175
 			date_default_timezone_set($globalTimezone);
9794 10176
 			$datetime = new DateTime();
9795 10177
 			$offset = $datetime->format('P');
9796
-		} else $offset = '+00:00';
10178
+		} else {
10179
+			$offset = '+00:00';
10180
+		}
9797 10181
 		$filter_query = $this->getFilter($filters,true,true);
9798 10182
 		if ($globalDBdriver == 'mysql') {
9799 10183
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -9842,7 +10226,9 @@  discard block
 block discarded – undo
9842 10226
 			date_default_timezone_set($globalTimezone);
9843 10227
 			$datetime = new DateTime();
9844 10228
 			$offset = $datetime->format('P');
9845
-		} else $offset = '+00:00';
10229
+		} else {
10230
+			$offset = '+00:00';
10231
+		}
9846 10232
 
9847 10233
 		$orderby_sql = '';
9848 10234
 		if ($orderby == "hour")
@@ -9908,7 +10294,9 @@  discard block
 block discarded – undo
9908 10294
 			date_default_timezone_set($globalTimezone);
9909 10295
 			$datetime = new DateTime();
9910 10296
 			$offset = $datetime->format('P');
9911
-		} else $offset = '+00:00';
10297
+		} else {
10298
+			$offset = '+00:00';
10299
+		}
9912 10300
 
9913 10301
 		$orderby_sql = '';
9914 10302
 		if ($orderby == "hour")
@@ -9975,7 +10363,9 @@  discard block
 block discarded – undo
9975 10363
 			date_default_timezone_set($globalTimezone);
9976 10364
 			$datetime = new DateTime();
9977 10365
 			$offset = $datetime->format('P');
9978
-		} else $offset = '+00:00';
10366
+		} else {
10367
+			$offset = '+00:00';
10368
+		}
9979 10369
 
9980 10370
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9981 10371
 
@@ -10026,7 +10416,9 @@  discard block
 block discarded – undo
10026 10416
 			date_default_timezone_set($globalTimezone);
10027 10417
 			$datetime = new DateTime();
10028 10418
 			$offset = $datetime->format('P');
10029
-		} else $offset = '+00:00';
10419
+		} else {
10420
+			$offset = '+00:00';
10421
+		}
10030 10422
 
10031 10423
 		if ($globalDBdriver == 'mysql') {
10032 10424
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10073,7 +10465,9 @@  discard block
 block discarded – undo
10073 10465
 			date_default_timezone_set($globalTimezone);
10074 10466
 			$datetime = new DateTime();
10075 10467
 			$offset = $datetime->format('P');
10076
-		} else $offset = '+00:00';
10468
+		} else {
10469
+			$offset = '+00:00';
10470
+		}
10077 10471
 
10078 10472
 		if ($globalDBdriver == 'mysql') {
10079 10473
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10120,7 +10514,9 @@  discard block
 block discarded – undo
10120 10514
 			date_default_timezone_set($globalTimezone);
10121 10515
 			$datetime = new DateTime();
10122 10516
 			$offset = $datetime->format('P');
10123
-		} else $offset = '+00:00';
10517
+		} else {
10518
+			$offset = '+00:00';
10519
+		}
10124 10520
 
10125 10521
 		if ($globalDBdriver == 'mysql') {
10126 10522
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10168,7 +10564,9 @@  discard block
 block discarded – undo
10168 10564
 			date_default_timezone_set($globalTimezone);
10169 10565
 			$datetime = new DateTime();
10170 10566
 			$offset = $datetime->format('P');
10171
-		} else $offset = '+00:00';
10567
+		} else {
10568
+			$offset = '+00:00';
10569
+		}
10172 10570
 
10173 10571
 		if ($globalDBdriver == 'mysql') {
10174 10572
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10216,7 +10614,9 @@  discard block
 block discarded – undo
10216 10614
 			date_default_timezone_set($globalTimezone);
10217 10615
 			$datetime = new DateTime($date);
10218 10616
 			$offset = $datetime->format('P');
10219
-		} else $offset = '+00:00';
10617
+		} else {
10618
+			$offset = '+00:00';
10619
+		}
10220 10620
 
10221 10621
 		if ($globalDBdriver == 'mysql') {
10222 10622
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10264,7 +10664,9 @@  discard block
 block discarded – undo
10264 10664
 			date_default_timezone_set($globalTimezone);
10265 10665
 			$datetime = new DateTime();
10266 10666
 			$offset = $datetime->format('P');
10267
-		} else $offset = '+00:00';
10667
+		} else {
10668
+			$offset = '+00:00';
10669
+		}
10268 10670
 
10269 10671
 		if ($globalDBdriver == 'mysql') {
10270 10672
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10311,7 +10713,9 @@  discard block
 block discarded – undo
10311 10713
 			date_default_timezone_set($globalTimezone);
10312 10714
 			$datetime = new DateTime();
10313 10715
 			$offset = $datetime->format('P');
10314
-		} else $offset = '+00:00';
10716
+		} else {
10717
+			$offset = '+00:00';
10718
+		}
10315 10719
 
10316 10720
 		if ($globalDBdriver == 'mysql') {
10317 10721
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10358,7 +10762,9 @@  discard block
 block discarded – undo
10358 10762
 			date_default_timezone_set($globalTimezone);
10359 10763
 			$datetime = new DateTime();
10360 10764
 			$offset = $datetime->format('P');
10361
-		} else $offset = '+00:00';
10765
+		} else {
10766
+			$offset = '+00:00';
10767
+		}
10362 10768
 
10363 10769
 		if ($globalDBdriver == 'mysql') {
10364 10770
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10408,7 +10814,9 @@  discard block
 block discarded – undo
10408 10814
 			date_default_timezone_set($globalTimezone);
10409 10815
 			$datetime = new DateTime();
10410 10816
 			$offset = $datetime->format('P');
10411
-		} else $offset = '+00:00';
10817
+		} else {
10818
+			$offset = '+00:00';
10819
+		}
10412 10820
 
10413 10821
 		if ($globalDBdriver == 'mysql') {
10414 10822
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10455,7 +10863,9 @@  discard block
 block discarded – undo
10455 10863
 			date_default_timezone_set($globalTimezone);
10456 10864
 			$datetime = new DateTime();
10457 10865
 			$offset = $datetime->format('P');
10458
-		} else $offset = '+00:00';
10866
+		} else {
10867
+			$offset = '+00:00';
10868
+		}
10459 10869
 
10460 10870
 		if ($globalDBdriver == 'mysql') {
10461 10871
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10666,8 +11076,11 @@  discard block
 block discarded – undo
10666 11076
 				$query_values = array_merge($query_values,array(':month' => $month));
10667 11077
 			}
10668 11078
 		}
10669
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10670
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11079
+		if (empty($query_values)) {
11080
+			$queryi .= $this->getFilter($filters);
11081
+		} else {
11082
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11083
+		}
10671 11084
 		
10672 11085
 		//echo $query;
10673 11086
 		$sth = $this->db->prepare($queryi);
@@ -10746,8 +11159,11 @@  discard block
 block discarded – undo
10746 11159
 				$query_values = array_merge($query_values,array(':month' => $month));
10747 11160
 			}
10748 11161
 		}
10749
-                if ($query == '') $queryi .= $this->getFilter($filters);
10750
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11162
+                if ($query == '') {
11163
+                	$queryi .= $this->getFilter($filters);
11164
+                } else {
11165
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11166
+                }
10751 11167
 
10752 11168
 
10753 11169
 		$sth = $this->db->prepare($queryi);
@@ -10770,7 +11186,9 @@  discard block
 block discarded – undo
10770 11186
 			date_default_timezone_set($globalTimezone);
10771 11187
 			$datetime = new DateTime();
10772 11188
 			$offset = $datetime->format('P');
10773
-		} else $offset = '+00:00';
11189
+		} else {
11190
+			$offset = '+00:00';
11191
+		}
10774 11192
 
10775 11193
 		if ($globalDBdriver == 'mysql') {
10776 11194
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10956,7 +11374,9 @@  discard block
 block discarded – undo
10956 11374
 	*/
10957 11375
 	public function parseDirection($direction = 0)
10958 11376
 	{
10959
-		if ($direction == '') $direction = 0;
11377
+		if ($direction == '') {
11378
+			$direction = 0;
11379
+		}
10960 11380
 		$direction_array = array();
10961 11381
 		$temp_array = array();
10962 11382
 
@@ -11057,7 +11477,9 @@  discard block
 block discarded – undo
11057 11477
 		if (isset($result->AirlineFlightInfoResult))
11058 11478
 		{
11059 11479
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11060
-		} else return '';
11480
+		} else {
11481
+			return '';
11482
+		}
11061 11483
 		
11062 11484
 		$registration = $this->convertAircraftRegistration($registration);
11063 11485
 		
@@ -11086,7 +11508,9 @@  discard block
 block discarded – undo
11086 11508
 		if (count($row) > 0) {
11087 11509
 		    //return $row['Registration'];
11088 11510
 		    return $row['registration'];
11089
-		} else return '';
11511
+		} else {
11512
+			return '';
11513
+		}
11090 11514
 	
11091 11515
 	}
11092 11516
 
@@ -11109,9 +11533,14 @@  discard block
 block discarded – undo
11109 11533
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11110 11534
 		$sth->closeCursor();
11111 11535
 		if (count($row) > 0) {
11112
-		    if ($row['type_flight'] == null) return '';
11113
-		    else return $row['type_flight'];
11114
-		} else return '';
11536
+		    if ($row['type_flight'] == null) {
11537
+		    	return '';
11538
+		    } else {
11539
+		    	return $row['type_flight'];
11540
+		    }
11541
+		} else {
11542
+			return '';
11543
+		}
11115 11544
 	
11116 11545
 	}
11117 11546
 
@@ -11129,7 +11558,9 @@  discard block
 block discarded – undo
11129 11558
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11130 11559
 	
11131 11560
 		$Connection = new Connection($this->db);
11132
-		if (!$Connection->tableExists('countries')) return '';
11561
+		if (!$Connection->tableExists('countries')) {
11562
+			return '';
11563
+		}
11133 11564
 	
11134 11565
 		try {
11135 11566
 			/*
@@ -11149,9 +11580,13 @@  discard block
 block discarded – undo
11149 11580
 			$sth->closeCursor();
11150 11581
 			if (count($row) > 0) {
11151 11582
 				return $row;
11152
-			} else return '';
11583
+			} else {
11584
+				return '';
11585
+			}
11153 11586
 		} catch (PDOException $e) {
11154
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11587
+			if (isset($globalDebug) && $globalDebug) {
11588
+				echo 'Error : '.$e->getMessage()."\n";
11589
+			}
11155 11590
 			return '';
11156 11591
 		}
11157 11592
 	
@@ -11169,7 +11604,9 @@  discard block
 block discarded – undo
11169 11604
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11170 11605
 	
11171 11606
 		$Connection = new Connection($this->db);
11172
-		if (!$Connection->tableExists('countries')) return '';
11607
+		if (!$Connection->tableExists('countries')) {
11608
+			return '';
11609
+		}
11173 11610
 	
11174 11611
 		try {
11175 11612
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11181,9 +11618,13 @@  discard block
 block discarded – undo
11181 11618
 			$sth->closeCursor();
11182 11619
 			if (count($row) > 0) {
11183 11620
 				return $row;
11184
-			} else return '';
11621
+			} else {
11622
+				return '';
11623
+			}
11185 11624
 		} catch (PDOException $e) {
11186
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11625
+			if (isset($globalDebug) && $globalDebug) {
11626
+				echo 'Error : '.$e->getMessage()."\n";
11627
+			}
11187 11628
 			return '';
11188 11629
 		}
11189 11630
 	
@@ -11433,7 +11874,9 @@  discard block
 block discarded – undo
11433 11874
 	{
11434 11875
 		global $globalBitlyAccessToken;
11435 11876
 		
11436
-		if ($globalBitlyAccessToken == '') return $url;
11877
+		if ($globalBitlyAccessToken == '') {
11878
+			return $url;
11879
+		}
11437 11880
         
11438 11881
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11439 11882
 		
@@ -11582,7 +12025,9 @@  discard block
 block discarded – undo
11582 12025
 		
11583 12026
 
11584 12027
 		// routes
11585
-		if ($globalDebug) print "Routes...\n";
12028
+		if ($globalDebug) {
12029
+			print "Routes...\n";
12030
+		}
11586 12031
 		if ($globalDBdriver == 'mysql') {
11587 12032
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
11588 12033
 		} else {
@@ -11601,7 +12046,9 @@  discard block
 block discarded – undo
11601 12046
 			}
11602 12047
 		}
11603 12048
 		
11604
-		if ($globalDebug) print "Airlines...\n";
12049
+		if ($globalDebug) {
12050
+			print "Airlines...\n";
12051
+		}
11605 12052
 		//airlines
11606 12053
 		if ($globalDBdriver == 'mysql') {
11607 12054
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -11615,10 +12062,15 @@  discard block
 block discarded – undo
11615 12062
 			if (is_numeric(substr($row['ident'], -1, 1)))
11616 12063
 			{
11617 12064
 				$fromsource = NULL;
11618
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
11619
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11620
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11621
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12065
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12066
+					$fromsource = 'vatsim';
12067
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12068
+					$fromsource = 'ivao';
12069
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12070
+					$fromsource = 'vatsim';
12071
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12072
+					$fromsource = 'ivao';
12073
+				}
11622 12074
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11623 12075
 				if (isset($airline_array[0]['name'])) {
11624 12076
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -11628,13 +12080,17 @@  discard block
 block discarded – undo
11628 12080
 			}
11629 12081
 		}
11630 12082
 
11631
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12083
+		if ($globalDebug) {
12084
+			print "Remove Duplicate in aircraft_modes...\n";
12085
+		}
11632 12086
 		//duplicate modes
11633 12087
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
11634 12088
 		$sth = $this->db->prepare($query);
11635 12089
 		$sth->execute();
11636 12090
 		
11637
-		if ($globalDebug) print "Aircraft...\n";
12091
+		if ($globalDebug) {
12092
+			print "Aircraft...\n";
12093
+		}
11638 12094
 		//aircraft
11639 12095
 		if ($globalDBdriver == 'mysql') {
11640 12096
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -11677,26 +12133,38 @@  discard block
 block discarded – undo
11677 12133
 				 if (isset($closestAirports[0])) {
11678 12134
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
11679 12135
 						$airport_icao = $closestAirports[0]['icao'];
11680
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12136
+						if ($globalDebug) {
12137
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12138
+						}
11681 12139
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
11682 12140
 						foreach ($closestAirports as $airport) {
11683 12141
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
11684 12142
 								$airport_icao = $airport['icao'];
11685
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12143
+								if ($globalDebug) {
12144
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12145
+								}
11686 12146
 								break;
11687 12147
 							}
11688 12148
 						}
11689 12149
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11690 12150
 						$airport_icao = $closestAirports[0]['icao'];
11691
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12151
+						if ($globalDebug) {
12152
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12153
+						}
11692 12154
 					} else {
11693
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12155
+						if ($globalDebug) {
12156
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12157
+						}
11694 12158
 					}
11695 12159
 				} else {
11696
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12160
+					if ($globalDebug) {
12161
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12162
+					}
11697 12163
 				}
11698 12164
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11699
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12165
+					if ($globalDebug) {
12166
+						echo "Updating airport to ".$airport_icao."...\n";
12167
+					}
11700 12168
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11701 12169
 					$sthu = $this->db->prepare($update_query);
11702 12170
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
require/class.SpotterLive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
Please login to merge, or discard this patch.
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	/**
89
-	* Gets all the spotter information based on the latest data entry
90
-	*
91
-	* @return Array the spotter information
92
-	*
93
-	*/
89
+	 * Gets all the spotter information based on the latest data entry
90
+	 *
91
+	 * @return Array the spotter information
92
+	 *
93
+	 */
94 94
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
95 95
 	{
96 96
 		global $globalDBdriver, $globalLiveInterval;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Gets Minimal Live Spotter data
136
-	*
137
-	* @return Array the spotter information
138
-	*
139
-	*/
135
+	 * Gets Minimal Live Spotter data
136
+	 *
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getMinLiveSpotterData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	/**
192
-	* Gets Minimal Live Spotter data since xx seconds
193
-	*
194
-	* @return Array the spotter information
195
-	*
196
-	*/
192
+	 * Gets Minimal Live Spotter data since xx seconds
193
+	 *
194
+	 * @return Array the spotter information
195
+	 *
196
+	 */
197 197
 	public function getMinLastLiveSpotterData($filter = array())
198 198
 	{
199 199
 		global $globalDBdriver, $globalLiveInterval;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
212 212
 			FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
213 213
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
214
-                } else {
214
+				} else {
215 215
 /*
216 216
 			$query  = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
217 217
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 //			echo $query;
224 224
 		}
225 225
 
226
-    		try {
226
+			try {
227 227
 			$sth = $this->db->prepare($query);
228 228
 			$sth->execute();
229 229
 		} catch(PDOException $e) {
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	}
236 236
 
237 237
 	/**
238
-	* Gets number of latest data entry
239
-	*
240
-	* @return String number of entry
241
-	*
242
-	*/
238
+	 * Gets number of latest data entry
239
+	 *
240
+	 * @return String number of entry
241
+	 *
242
+	 */
243 243
 	public function getLiveSpotterCount($filter = array())
244 244
 	{
245 245
 		global $globalDBdriver, $globalLiveInterval;
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	}
267 267
 
268 268
 	/**
269
-	* Gets all the spotter information based on the latest data entry and coord
270
-	*
271
-	* @return Array the spotter information
272
-	*
273
-	*/
269
+	 * Gets all the spotter information based on the latest data entry and coord
270
+	 *
271
+	 * @return Array the spotter information
272
+	 *
273
+	 */
274 274
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
275 275
 	{
276 276
 		global $globalDBdriver, $globalLiveInterval;
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 	}
296 296
 
297 297
 	/**
298
-	* Gets all the spotter information based on a user's latitude and longitude
299
-	*
300
-	* @return Array the spotter information
301
-	*
302
-	*/
298
+	 * Gets all the spotter information based on a user's latitude and longitude
299
+	 *
300
+	 * @return Array the spotter information
301
+	 *
302
+	 */
303 303
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
304 304
 	{
305 305
 		$Spotter = new Spotter($this->db);
@@ -309,145 +309,145 @@  discard block
 block discarded – undo
309 309
 				return false;
310 310
 			}
311 311
 		}
312
-        if ($lng != '')
313
-                {
314
-                        if (!is_numeric($lng))
315
-                        {
316
-                                return false;
317
-                        }
318
-                }
319
-
320
-                if ($radius != '')
321
-                {
322
-                        if (!is_numeric($radius))
323
-                        {
324
-                                return false;
325
-                        }
326
-                }
312
+		if ($lng != '')
313
+				{
314
+						if (!is_numeric($lng))
315
+						{
316
+								return false;
317
+						}
318
+				}
319
+
320
+				if ($radius != '')
321
+				{
322
+						if (!is_numeric($radius))
323
+						{
324
+								return false;
325
+						}
326
+				}
327 327
 		$additional_query = '';
328
-        if ($interval != '')
329
-                {
330
-                        if (!is_string($interval))
331
-                        {
332
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
333
-			        return false;
334
-                        } else {
335
-                if ($interval == '1m')
336
-                {
337
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
338
-                } else if ($interval == '15m'){
339
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
340
-                } 
341
-            }
342
-                } else {
343
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
344
-        }
345
-
346
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
328
+		if ($interval != '')
329
+				{
330
+						if (!is_string($interval))
331
+						{
332
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
333
+					return false;
334
+						} else {
335
+				if ($interval == '1m')
336
+				{
337
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
338
+				} else if ($interval == '15m'){
339
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
340
+				} 
341
+			}
342
+				} else {
343
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
344
+		}
345
+
346
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
347 347
                    WHERE spotter_live.latitude <> '' 
348 348
                                    AND spotter_live.longitude <> '' 
349 349
                    ".$additional_query."
350 350
                    HAVING distance < :radius  
351 351
                                    ORDER BY distance";
352 352
 
353
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
353
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
354 354
 
355
-                return $spotter_array;
356
-        }
355
+				return $spotter_array;
356
+		}
357 357
 
358 358
     
359
-        /**
360
-	* Gets all the spotter information based on a particular callsign
361
-	*
362
-	* @return Array the spotter information
363
-	*
364
-	*/
359
+		/**
360
+		 * Gets all the spotter information based on a particular callsign
361
+		 *
362
+		 * @return Array the spotter information
363
+		 *
364
+		 */
365 365
 	public function getLastLiveSpotterDataByIdent($ident)
366 366
 	{
367 367
 		$Spotter = new Spotter($this->db);
368 368
 		date_default_timezone_set('UTC');
369 369
 
370 370
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
371
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
371
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
372 372
 
373 373
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
374 374
 
375 375
 		return $spotter_array;
376 376
 	}
377 377
 
378
-        /**
379
-	* Gets all the spotter information based on a particular callsign
380
-	*
381
-	* @return Array the spotter information
382
-	*
383
-	*/
378
+		/**
379
+		 * Gets all the spotter information based on a particular callsign
380
+		 *
381
+		 * @return Array the spotter information
382
+		 *
383
+		 */
384 384
 	public function getDateLiveSpotterDataByIdent($ident,$date)
385 385
 	{
386 386
 		$Spotter = new Spotter($this->db);
387 387
 		date_default_timezone_set('UTC');
388 388
 
389 389
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
390
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
390
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
391 391
 
392
-                $date = date('c',$date);
392
+				$date = date('c',$date);
393 393
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
394 394
 
395 395
 		return $spotter_array;
396 396
 	}
397 397
 
398
-        /**
399
-	* Gets last spotter information based on a particular callsign
400
-	*
401
-	* @return Array the spotter information
402
-	*
403
-	*/
398
+		/**
399
+		 * Gets last spotter information based on a particular callsign
400
+		 *
401
+		 * @return Array the spotter information
402
+		 *
403
+		 */
404 404
 	public function getLastLiveSpotterDataById($id)
405 405
 	{
406 406
 		$Spotter = new Spotter($this->db);
407 407
 		date_default_timezone_set('UTC');
408 408
 
409 409
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
410
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
410
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
411 411
 
412 412
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
413 413
 
414 414
 		return $spotter_array;
415 415
 	}
416 416
 
417
-        /**
418
-	* Gets last spotter information based on a particular callsign
419
-	*
420
-	* @return Array the spotter information
421
-	*
422
-	*/
417
+		/**
418
+		 * Gets last spotter information based on a particular callsign
419
+		 *
420
+		 * @return Array the spotter information
421
+		 *
422
+		 */
423 423
 	public function getDateLiveSpotterDataById($id,$date)
424 424
 	{
425 425
 		$Spotter = new Spotter($this->db);
426 426
 		date_default_timezone_set('UTC');
427 427
 
428 428
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
429
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
-                $date = date('c',$date);
429
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
+				$date = date('c',$date);
431 431
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
432 432
 
433 433
 		return $spotter_array;
434 434
 	}
435 435
 
436
-        /**
437
-	* Gets altitude information based on a particular callsign
438
-	*
439
-	* @return Array the spotter information
440
-	*
441
-	*/
436
+		/**
437
+		 * Gets altitude information based on a particular callsign
438
+		 *
439
+		 * @return Array the spotter information
440
+		 *
441
+		 */
442 442
 	public function getAltitudeLiveSpotterDataByIdent($ident)
443 443
 	{
444 444
 
445 445
 		date_default_timezone_set('UTC');
446 446
 
447 447
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
448
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
448
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
449 449
 
450
-    		try {
450
+			try {
451 451
 			
452 452
 			$sth = $this->db->prepare($query);
453 453
 			$sth->execute(array(':ident' => $ident));
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 		return $spotter_array;
461 461
 	}
462 462
 
463
-        /**
464
-	* Gets all the spotter information based on a particular id
465
-	*
466
-	* @return Array the spotter information
467
-	*
468
-	*/
463
+		/**
464
+		 * Gets all the spotter information based on a particular id
465
+		 *
466
+		 * @return Array the spotter information
467
+		 *
468
+		 */
469 469
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
470 470
 	{
471 471
 		global $globalDBdriver, $globalLiveInterval;
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 		return $spotter_array;
494 494
 	}
495 495
 
496
-        /**
497
-	* Gets all the spotter information based on a particular ident
498
-	*
499
-	* @return Array the spotter information
500
-	*
501
-	*/
496
+		/**
497
+		 * Gets all the spotter information based on a particular ident
498
+		 *
499
+		 * @return Array the spotter information
500
+		 *
501
+		 */
502 502
 	public function getAllLiveSpotterDataByIdent($ident)
503 503
 	{
504 504
 		date_default_timezone_set('UTC');
505 505
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
506 506
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
507
-    		try {
507
+			try {
508 508
 			
509 509
 			$sth = $this->db->prepare($query);
510 510
 			$sth->execute(array(':ident' => $ident));
@@ -518,23 +518,23 @@  discard block
 block discarded – undo
518 518
 
519 519
 
520 520
 	/**
521
-	* Deletes all info in the table
522
-	*
523
-	* @return String success or false
524
-	*
525
-	*/
521
+	 * Deletes all info in the table
522
+	 *
523
+	 * @return String success or false
524
+	 *
525
+	 */
526 526
 	public function deleteLiveSpotterData()
527 527
 	{
528 528
 		global $globalDBdriver;
529 529
 		if ($globalDBdriver == 'mysql') {
530 530
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
531 531
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
532
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
532
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
533 533
 		} else {
534 534
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
535 535
 		}
536 536
         
537
-    		try {
537
+			try {
538 538
 			
539 539
 			$sth = $this->db->prepare($query);
540 540
 			$sth->execute();
@@ -546,18 +546,18 @@  discard block
 block discarded – undo
546 546
 	}
547 547
 
548 548
 	/**
549
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
550
-	*
551
-	* @return String success or false
552
-	*
553
-	*/
549
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
550
+	 *
551
+	 * @return String success or false
552
+	 *
553
+	 */
554 554
 	public function deleteLiveSpotterDataNotUpdated()
555 555
 	{
556 556
 		global $globalDBdriver, $globalDebug;
557 557
 		if ($globalDBdriver == 'mysql') {
558 558
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
559
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
560
-    			try {
559
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
560
+				try {
561 561
 				
562 562
 				$sth = $this->db->prepare($query);
563 563
 				$sth->execute();
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 				return "error";
566 566
 			}
567 567
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
568
-                        $i = 0;
569
-                        $j =0;
568
+						$i = 0;
569
+						$j =0;
570 570
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
571 571
 			foreach($all as $row)
572 572
 			{
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
 				$j++;
575 575
 				if ($j == 30) {
576 576
 					if ($globalDebug) echo ".";
577
-				    	try {
577
+						try {
578 578
 						
579 579
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
580 580
 						$sth->execute();
581 581
 					} catch(PDOException $e) {
582 582
 						return "error";
583 583
 					}
584
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
585
-                                	$j = 0;
584
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
585
+									$j = 0;
586 586
 				}
587 587
 				$query_delete .= "'".$row['flightaware_id']."',";
588 588
 			}
589 589
 			if ($i > 0) {
590
-    				try {
590
+					try {
591 591
 					
592 592
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
593 593
 					$sth->execute();
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 			return "success";
599 599
 		} elseif ($globalDBdriver == 'pgsql') {
600 600
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
601
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
602
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
603
-    			try {
601
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
602
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
603
+				try {
604 604
 				
605 605
 				$sth = $this->db->prepare($query);
606 606
 				$sth->execute();
@@ -644,17 +644,17 @@  discard block
 block discarded – undo
644 644
 	}
645 645
 
646 646
 	/**
647
-	* Deletes all info in the table for an ident
648
-	*
649
-	* @return String success or false
650
-	*
651
-	*/
647
+	 * Deletes all info in the table for an ident
648
+	 *
649
+	 * @return String success or false
650
+	 *
651
+	 */
652 652
 	public function deleteLiveSpotterDataByIdent($ident)
653 653
 	{
654 654
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
655 655
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
656 656
         
657
-    		try {
657
+			try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
@@ -666,17 +666,17 @@  discard block
 block discarded – undo
666 666
 	}
667 667
 
668 668
 	/**
669
-	* Deletes all info in the table for an id
670
-	*
671
-	* @return String success or false
672
-	*
673
-	*/
669
+	 * Deletes all info in the table for an id
670
+	 *
671
+	 * @return String success or false
672
+	 *
673
+	 */
674 674
 	public function deleteLiveSpotterDataById($id)
675 675
 	{
676 676
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
677 677
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
678 678
         
679
-    		try {
679
+			try {
680 680
 			
681 681
 			$sth = $this->db->prepare($query);
682 682
 			$sth->execute(array(':id' => $id));
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
 
690 690
 
691 691
 	/**
692
-	* Gets the aircraft ident within the last hour
693
-	*
694
-	* @return String the ident
695
-	*
696
-	*/
692
+	 * Gets the aircraft ident within the last hour
693
+	 *
694
+	 * @return String the ident
695
+	 *
696
+	 */
697 697
 	public function getIdentFromLastHour($ident)
698 698
 	{
699 699
 		global $globalDBdriver, $globalTimezone;
@@ -719,14 +719,14 @@  discard block
 block discarded – undo
719 719
 			$ident_result = $row['ident'];
720 720
 		}
721 721
 		return $ident_result;
722
-        }
722
+		}
723 723
 
724 724
 	/**
725
-	* Check recent aircraft
726
-	*
727
-	* @return String the ident
728
-	*
729
-	*/
725
+	 * Check recent aircraft
726
+	 *
727
+	 * @return String the ident
728
+	 *
729
+	 */
730 730
 	public function checkIdentRecent($ident)
731 731
 	{
732 732
 		global $globalDBdriver, $globalTimezone;
@@ -752,14 +752,14 @@  discard block
 block discarded – undo
752 752
 			$ident_result = $row['flightaware_id'];
753 753
 		}
754 754
 		return $ident_result;
755
-        }
755
+		}
756 756
 
757 757
 	/**
758
-	* Check recent aircraft by id
759
-	*
760
-	* @return String the ident
761
-	*
762
-	*/
758
+	 * Check recent aircraft by id
759
+	 *
760
+	 * @return String the ident
761
+	 *
762
+	 */
763 763
 	public function checkIdRecent($id)
764 764
 	{
765 765
 		global $globalDBdriver, $globalTimezone;
@@ -785,14 +785,14 @@  discard block
 block discarded – undo
785 785
 			$ident_result = $row['flightaware_id'];
786 786
 		}
787 787
 		return $ident_result;
788
-        }
788
+		}
789 789
 
790 790
 	/**
791
-	* Check recent aircraft by ModeS
792
-	*
793
-	* @return String the ModeS
794
-	*
795
-	*/
791
+	 * Check recent aircraft by ModeS
792
+	 *
793
+	 * @return String the ModeS
794
+	 *
795
+	 */
796 796
 	public function checkModeSRecent($modes)
797 797
 	{
798 798
 		global $globalDBdriver, $globalTimezone;
@@ -819,19 +819,19 @@  discard block
 block discarded – undo
819 819
 			$ident_result = $row['flightaware_id'];
820 820
 		}
821 821
 		return $ident_result;
822
-        }
822
+		}
823 823
 
824 824
 	/**
825
-	* Adds a new spotter data
826
-	*
827
-	* @param String $flightaware_id the ID from flightaware
828
-	* @param String $ident the flight ident
829
-	* @param String $aircraft_icao the aircraft type
830
-	* @param String $departure_airport_icao the departure airport
831
-	* @param String $arrival_airport_icao the arrival airport
832
-	* @return String success or false
833
-	*
834
-	*/
825
+	 * Adds a new spotter data
826
+	 *
827
+	 * @param String $flightaware_id the ID from flightaware
828
+	 * @param String $ident the flight ident
829
+	 * @param String $aircraft_icao the aircraft type
830
+	 * @param String $departure_airport_icao the departure airport
831
+	 * @param String $arrival_airport_icao the arrival airport
832
+	 * @return String success or false
833
+	 *
834
+	 */
835 835
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
836 836
 	{
837 837
 		global $globalURL, $globalArchive, $globalDebug;
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
 		$arrival_airport_country = '';
967 967
 		
968 968
             	
969
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
969
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
973 973
             	
974 974
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
975 975
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -979,14 +979,14 @@  discard block
 block discarded – undo
979 979
 			
980 980
 			$sth = $this->db->prepare($query);
981 981
 			$sth->execute($query_values);
982
-                } catch(PDOException $e) {
983
-                	return "error : ".$e->getMessage();
984
-                }
982
+				} catch(PDOException $e) {
983
+					return "error : ".$e->getMessage();
984
+				}
985 985
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
986
-		    if ($globalDebug) echo '(Add to SBS archive : ';
987
-		    $SpotterArchive = new SpotterArchive($this->db);
988
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
989
-		    if ($globalDebug) echo $result.')';
986
+			if ($globalDebug) echo '(Add to SBS archive : ';
987
+			$SpotterArchive = new SpotterArchive($this->db);
988
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
989
+			if ($globalDebug) echo $result.')';
990 990
 		}
991 991
 		return "success";
992 992
 
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,45 +16,45 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
30 30
 		$filter_query_join = '';
31 31
 		$filter_query_where = '';
32
-		foreach($filters as $flt) {
32
+		foreach ($filters as $flt) {
33 33
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
34 34
 				if ($flt['airlines'][0] != '') {
35 35
 					if (isset($flt['source'])) {
36
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
36
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
37 37
 					} else {
38
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
38
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
39 39
 					}
40 40
 				}
41 41
 			}
42 42
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
43 43
 				if (isset($flt['source'])) {
44
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
44
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
45 45
 				} else {
46
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
46
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
47 47
 				}
48 48
 			}
49 49
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
50 50
 				if (isset($flt['source'])) {
51
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
51
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
52 52
 				}
53 53
 			}
54 54
 		}
55 55
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
56 56
 			if ($filter['airlines'][0] != '') {
57
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
57
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
58 58
 			}
59 59
 		}
60 60
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
65 65
 		}
66 66
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
67
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
67
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
68 68
 		}
69 69
 		if (isset($filter['source']) && !empty($filter['source'])) {
70
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
70
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
71 71
 		}
72 72
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
73 73
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
74 74
 		}
75 75
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
76 76
 			if ($filter_query_where == '') {
77
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 			} else {
79
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
79
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
80 80
 			}
81 81
 		}
82 82
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		if ($limit != '')
103 103
 		{
104 104
 			$limit_array = explode(',', $limit);
105
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
106
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
105
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
106
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
107 107
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
108 108
 			{
109 109
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		} else {
127 127
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
128 128
 		}
129
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
129
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
130 130
 
131 131
 		return $spotter_array;
132 132
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		global $globalDBdriver, $globalLiveInterval;
143 143
 		date_default_timezone_set('UTC');
144 144
 
145
-		$filter_query = $this->getFilter($filter,true,true);
145
+		$filter_query = $this->getFilter($filter, true, true);
146 146
 
147 147
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
148 148
 		if ($globalDBdriver == 'mysql') {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			$query  = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
154 154
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
155 155
 */
156
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
156
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
157 157
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
158 158
 
159 159
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
169 169
 */
170 170
 
171
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
171
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
172 172
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
173 173
 
174 174
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		try {
180 180
 			$sth = $this->db->prepare($query);
181 181
 			$sth->execute();
182
-		} catch(PDOException $e) {
182
+		} catch (PDOException $e) {
183 183
 			echo $e->getMessage();
184 184
 			die;
185 185
 		}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		global $globalDBdriver, $globalLiveInterval;
200 200
 		date_default_timezone_set('UTC');
201 201
 
202
-		$filter_query = $this->getFilter($filter,true,true);
202
+		$filter_query = $this->getFilter($filter, true, true);
203 203
 
204 204
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
205 205
 		if ($globalDBdriver == 'mysql') {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
209 209
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
210 210
 */
211
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
211
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
212 212
 			FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
213 213
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
214 214
                 } else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
218 218
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
219 219
 */
220
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
220
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
221 221
 			FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
222 222
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
223 223
 //			echo $query;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     		try {
227 227
 			$sth = $this->db->prepare($query);
228 228
 			$sth->execute();
229
-		} catch(PDOException $e) {
229
+		} catch (PDOException $e) {
230 230
 			echo $e->getMessage();
231 231
 			die;
232 232
 		}
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	public function getLiveSpotterCount($filter = array())
244 244
 	{
245 245
 		global $globalDBdriver, $globalLiveInterval;
246
-		$filter_query = $this->getFilter($filter,true,true);
246
+		$filter_query = $this->getFilter($filter, true, true);
247 247
 
248 248
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
249 249
 		if ($globalDBdriver == 'mysql') {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		try {
257 257
 			$sth = $this->db->prepare($query);
258 258
 			$sth->execute();
259
-		} catch(PDOException $e) {
259
+		} catch (PDOException $e) {
260 260
 			echo $e->getMessage();
261 261
 			die;
262 262
 		}
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 		$filter_query = $this->getFilter($filter);
280 280
 
281 281
 		if (is_array($coord)) {
282
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
283
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
284
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
285
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
282
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
283
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
284
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
285
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
286 286
 		} else return array();
287 287
 		if ($globalDBdriver == 'mysql') {
288 288
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                 if ($interval == '1m')
336 336
                 {
337 337
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
338
-                } else if ($interval == '15m'){
338
+                } else if ($interval == '15m') {
339 339
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
340 340
                 } 
341 341
             }
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
344 344
         }
345 345
 
346
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
346
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
347 347
                    WHERE spotter_live.latitude <> '' 
348 348
                                    AND spotter_live.longitude <> '' 
349 349
                    ".$additional_query."
350 350
                    HAVING distance < :radius  
351 351
                                    ORDER BY distance";
352 352
 
353
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
353
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
354 354
 
355 355
                 return $spotter_array;
356 356
         }
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 		date_default_timezone_set('UTC');
369 369
 
370 370
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
371
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
371
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
372 372
 
373
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
373
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
374 374
 
375 375
 		return $spotter_array;
376 376
 	}
@@ -381,16 +381,16 @@  discard block
 block discarded – undo
381 381
 	* @return Array the spotter information
382 382
 	*
383 383
 	*/
384
-	public function getDateLiveSpotterDataByIdent($ident,$date)
384
+	public function getDateLiveSpotterDataByIdent($ident, $date)
385 385
 	{
386 386
 		$Spotter = new Spotter($this->db);
387 387
 		date_default_timezone_set('UTC');
388 388
 
389 389
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
390
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
390
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
391 391
 
392
-                $date = date('c',$date);
393
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
392
+                $date = date('c', $date);
393
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
394 394
 
395 395
 		return $spotter_array;
396 396
 	}
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 		date_default_timezone_set('UTC');
408 408
 
409 409
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
410
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
410
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
411 411
 
412
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
412
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
413 413
 
414 414
 		return $spotter_array;
415 415
 	}
@@ -420,15 +420,15 @@  discard block
 block discarded – undo
420 420
 	* @return Array the spotter information
421 421
 	*
422 422
 	*/
423
-	public function getDateLiveSpotterDataById($id,$date)
423
+	public function getDateLiveSpotterDataById($id, $date)
424 424
 	{
425 425
 		$Spotter = new Spotter($this->db);
426 426
 		date_default_timezone_set('UTC');
427 427
 
428 428
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
429
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
-                $date = date('c',$date);
431
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
429
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
+                $date = date('c', $date);
431
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
432 432
 
433 433
 		return $spotter_array;
434 434
 	}
@@ -445,13 +445,13 @@  discard block
 block discarded – undo
445 445
 		date_default_timezone_set('UTC');
446 446
 
447 447
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
448
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
448
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
449 449
 
450 450
     		try {
451 451
 			
452 452
 			$sth = $this->db->prepare($query);
453 453
 			$sth->execute(array(':ident' => $ident));
454
-		} catch(PDOException $e) {
454
+		} catch (PDOException $e) {
455 455
 			echo $e->getMessage();
456 456
 			die;
457 457
 		}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	* @return Array the spotter information
467 467
 	*
468 468
 	*/
469
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
469
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
470 470
 	{
471 471
 		global $globalDBdriver, $globalLiveInterval;
472 472
 		date_default_timezone_set('UTC');
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 		try {
486 486
 			$sth = $this->db->prepare($query);
487 487
 			$sth->execute(array(':id' => $id));
488
-		} catch(PDOException $e) {
488
+		} catch (PDOException $e) {
489 489
 			echo $e->getMessage();
490 490
 			die;
491 491
 		}
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 	{
504 504
 		date_default_timezone_set('UTC');
505 505
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
506
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
506
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
507 507
     		try {
508 508
 			
509 509
 			$sth = $this->db->prepare($query);
510 510
 			$sth->execute(array(':ident' => $ident));
511
-		} catch(PDOException $e) {
511
+		} catch (PDOException $e) {
512 512
 			echo $e->getMessage();
513 513
 			die;
514 514
 		}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 			
539 539
 			$sth = $this->db->prepare($query);
540 540
 			$sth->execute();
541
-		} catch(PDOException $e) {
541
+		} catch (PDOException $e) {
542 542
 			return "error";
543 543
 		}
544 544
 
@@ -561,14 +561,14 @@  discard block
 block discarded – undo
561 561
 				
562 562
 				$sth = $this->db->prepare($query);
563 563
 				$sth->execute();
564
-			} catch(PDOException $e) {
564
+			} catch (PDOException $e) {
565 565
 				return "error";
566 566
 			}
567 567
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
568 568
                         $i = 0;
569
-                        $j =0;
569
+                        $j = 0;
570 570
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
571
-			foreach($all as $row)
571
+			foreach ($all as $row)
572 572
 			{
573 573
 				$i++;
574 574
 				$j++;
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 					if ($globalDebug) echo ".";
577 577
 				    	try {
578 578
 						
579
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
579
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
580 580
 						$sth->execute();
581
-					} catch(PDOException $e) {
581
+					} catch (PDOException $e) {
582 582
 						return "error";
583 583
 					}
584 584
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
 			if ($i > 0) {
590 590
     				try {
591 591
 					
592
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
592
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
593 593
 					$sth->execute();
594
-				} catch(PDOException $e) {
594
+				} catch (PDOException $e) {
595 595
 					return "error";
596 596
 				}
597 597
 			}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 				
605 605
 				$sth = $this->db->prepare($query);
606 606
 				$sth->execute();
607
-			} catch(PDOException $e) {
607
+			} catch (PDOException $e) {
608 608
 				return "error";
609 609
 			}
610 610
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
 	public function deleteLiveSpotterDataByIdent($ident)
653 653
 	{
654 654
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
655
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
655
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
656 656
         
657 657
     		try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
661
-		} catch(PDOException $e) {
661
+		} catch (PDOException $e) {
662 662
 			return "error";
663 663
 		}
664 664
 
@@ -674,13 +674,13 @@  discard block
 block discarded – undo
674 674
 	public function deleteLiveSpotterDataById($id)
675 675
 	{
676 676
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
677
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
677
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
678 678
         
679 679
     		try {
680 680
 			
681 681
 			$sth = $this->db->prepare($query);
682 682
 			$sth->execute(array(':id' => $id));
683
-		} catch(PDOException $e) {
683
+		} catch (PDOException $e) {
684 684
 			return "error";
685 685
 		}
686 686
 
@@ -698,13 +698,13 @@  discard block
 block discarded – undo
698 698
 	{
699 699
 		global $globalDBdriver, $globalTimezone;
700 700
 		if ($globalDBdriver == 'mysql') {
701
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
701
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
702 702
 				WHERE spotter_live.ident = :ident 
703 703
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
704 704
 				AND spotter_live.date < UTC_TIMESTAMP()';
705 705
 			$query_data = array(':ident' => $ident);
706 706
 		} else {
707
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
707
+			$query = "SELECT spotter_live.ident FROM spotter_live 
708 708
 				WHERE spotter_live.ident = :ident 
709 709
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
710 710
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 		
714 714
 		$sth = $this->db->prepare($query);
715 715
 		$sth->execute($query_data);
716
-		$ident_result='';
717
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
716
+		$ident_result = '';
717
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
718 718
 		{
719 719
 			$ident_result = $row['ident'];
720 720
 		}
@@ -731,13 +731,13 @@  discard block
 block discarded – undo
731 731
 	{
732 732
 		global $globalDBdriver, $globalTimezone;
733 733
 		if ($globalDBdriver == 'mysql') {
734
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
734
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
735 735
 				WHERE spotter_live.ident = :ident 
736 736
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
737 737
 //				AND spotter_live.date < UTC_TIMESTAMP()";
738 738
 			$query_data = array(':ident' => $ident);
739 739
 		} else {
740
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
740
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
741 741
 				WHERE spotter_live.ident = :ident 
742 742
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
743 743
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -746,8 +746,8 @@  discard block
 block discarded – undo
746 746
 		
747 747
 		$sth = $this->db->prepare($query);
748 748
 		$sth->execute($query_data);
749
-		$ident_result='';
750
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
749
+		$ident_result = '';
750
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
751 751
 		{
752 752
 			$ident_result = $row['flightaware_id'];
753 753
 		}
@@ -764,13 +764,13 @@  discard block
 block discarded – undo
764 764
 	{
765 765
 		global $globalDBdriver, $globalTimezone;
766 766
 		if ($globalDBdriver == 'mysql') {
767
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
767
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
768 768
 				WHERE spotter_live.flightaware_id = :id 
769 769
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
770 770
 //				AND spotter_live.date < UTC_TIMESTAMP()";
771 771
 			$query_data = array(':id' => $id);
772 772
 		} else {
773
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
773
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
774 774
 				WHERE spotter_live.flightaware_id = :id 
775 775
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
776 776
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 		
780 780
 		$sth = $this->db->prepare($query);
781 781
 		$sth->execute($query_data);
782
-		$ident_result='';
783
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
782
+		$ident_result = '';
783
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
784 784
 		{
785 785
 			$ident_result = $row['flightaware_id'];
786 786
 		}
@@ -797,13 +797,13 @@  discard block
 block discarded – undo
797 797
 	{
798 798
 		global $globalDBdriver, $globalTimezone;
799 799
 		if ($globalDBdriver == 'mysql') {
800
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
800
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
801 801
 				WHERE spotter_live.ModeS = :modes 
802 802
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
803 803
 //				AND spotter_live.date < UTC_TIMESTAMP()";
804 804
 			$query_data = array(':modes' => $modes);
805 805
 		} else {
806
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
806
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
807 807
 				WHERE spotter_live.ModeS = :modes 
808 808
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
809 809
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 		
813 813
 		$sth = $this->db->prepare($query);
814 814
 		$sth->execute($query_data);
815
-		$ident_result='';
816
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
815
+		$ident_result = '';
816
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
817 817
 		{
818 818
 			//$ident_result = $row['spotter_live_id'];
819 819
 			$ident_result = $row['flightaware_id'];
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 	* @return String success or false
833 833
 	*
834 834
 	*/
835
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
835
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
836 836
 	{
837 837
 		global $globalURL, $globalArchive, $globalDebug;
838 838
 		$Common = new Common();
@@ -925,26 +925,26 @@  discard block
 block discarded – undo
925 925
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
926 926
 
927 927
         
928
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
929
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
930
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
931
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
932
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
933
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
934
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
935
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
936
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
937
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
938
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
939
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
940
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
941
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
942
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
943
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
944
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
945
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
946
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
947
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
928
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
929
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
930
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
931
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
932
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
933
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
934
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
935
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
936
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
937
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
938
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
939
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
940
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
941
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
942
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
943
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
944
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
945
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
946
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
947
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
948 948
 
949 949
 		$airline_name = '';
950 950
 		$airline_icao = '';
@@ -966,26 +966,26 @@  discard block
 block discarded – undo
966 966
 		$arrival_airport_country = '';
967 967
 		
968 968
             	
969
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
969
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
970
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
971
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
972
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
973 973
             	
974
-		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
974
+		$query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
975 975
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
976 976
 
977
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
977
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
978 978
 		try {
979 979
 			
980 980
 			$sth = $this->db->prepare($query);
981 981
 			$sth->execute($query_values);
982
-                } catch(PDOException $e) {
982
+                } catch (PDOException $e) {
983 983
                 	return "error : ".$e->getMessage();
984 984
                 }
985 985
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
986 986
 		    if ($globalDebug) echo '(Add to SBS archive : ';
987 987
 		    $SpotterArchive = new SpotterArchive($this->db);
988
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
988
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
989 989
 		    if ($globalDebug) echo $result.')';
990 990
 		}
991 991
 		return "success";
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 
995 995
 	public function getOrderBy()
996 996
 	{
997
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
997
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
998 998
 		return $orderby;
999 999
 	}
1000 1000
 
Please login to merge, or discard this patch.
Braces   +71 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -79,8 +81,11 @@  discard block
 block discarded – undo
79 81
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
80 82
 			}
81 83
 		}
82
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
83
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
84
+		if ($filter_query_where == '' && $where) {
85
+			$filter_query_where = ' WHERE';
86
+		} elseif ($filter_query_where != '' && $and) {
87
+			$filter_query_where .= ' AND';
88
+		}
84 89
 		$filter_query = $filter_query_join.$filter_query_where;
85 90
 		return $filter_query;
86 91
 	}
@@ -119,7 +124,9 @@  discard block
 block discarded – undo
119 124
 			}
120 125
 		}
121 126
 
122
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
127
+		if (!isset($globalLiveInterval)) {
128
+			$globalLiveInterval = '200';
129
+		}
123 130
 		if ($globalDBdriver == 'mysql') {
124 131
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
125 132
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -144,7 +151,9 @@  discard block
 block discarded – undo
144 151
 
145 152
 		$filter_query = $this->getFilter($filter,true,true);
146 153
 
147
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
154
+		if (!isset($globalLiveInterval)) {
155
+			$globalLiveInterval = '200';
156
+		}
148 157
 		if ($globalDBdriver == 'mysql') {
149 158
 //			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
150 159
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -201,7 +210,9 @@  discard block
 block discarded – undo
201 210
 
202 211
 		$filter_query = $this->getFilter($filter,true,true);
203 212
 
204
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
213
+		if (!isset($globalLiveInterval)) {
214
+			$globalLiveInterval = '200';
215
+		}
205 216
 		if ($globalDBdriver == 'mysql') {
206 217
 /*
207 218
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -245,7 +256,9 @@  discard block
 block discarded – undo
245 256
 		global $globalDBdriver, $globalLiveInterval;
246 257
 		$filter_query = $this->getFilter($filter,true,true);
247 258
 
248
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
259
+		if (!isset($globalLiveInterval)) {
260
+			$globalLiveInterval = '200';
261
+		}
249 262
 		if ($globalDBdriver == 'mysql') {
250 263
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
251 264
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -275,7 +288,9 @@  discard block
 block discarded – undo
275 288
 	{
276 289
 		global $globalDBdriver, $globalLiveInterval;
277 290
 		$Spotter = new Spotter($this->db);
278
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
291
+		if (!isset($globalLiveInterval)) {
292
+			$globalLiveInterval = '200';
293
+		}
279 294
 		$filter_query = $this->getFilter($filter);
280 295
 
281 296
 		if (is_array($coord)) {
@@ -283,7 +298,9 @@  discard block
 block discarded – undo
283 298
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
284 299
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
285 300
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
286
-		} else return array();
301
+		} else {
302
+			return array();
303
+		}
287 304
 		if ($globalDBdriver == 'mysql') {
288 305
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
289 306
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -474,11 +491,15 @@  discard block
 block discarded – undo
474 491
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
475 492
 		if ($globalDBdriver == 'mysql') {
476 493
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
477
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
494
+			if ($liveinterval) {
495
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
496
+			}
478 497
 			$query .= ' ORDER BY date';
479 498
 		} else {
480 499
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
481
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
500
+			if ($liveinterval) {
501
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
502
+			}
482 503
 			$query .= ' ORDER BY date';
483 504
 		}
484 505
 
@@ -573,7 +594,9 @@  discard block
 block discarded – undo
573 594
 				$i++;
574 595
 				$j++;
575 596
 				if ($j == 30) {
576
-					if ($globalDebug) echo ".";
597
+					if ($globalDebug) {
598
+						echo ".";
599
+					}
577 600
 				    	try {
578 601
 						
579 602
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -880,7 +903,9 @@  discard block
 block discarded – undo
880 903
 			{
881 904
 				return false;
882 905
 			}
883
-		} else return '';
906
+		} else {
907
+			return '';
908
+		}
884 909
 
885 910
 		if ($longitude != '')
886 911
 		{
@@ -888,7 +913,9 @@  discard block
 block discarded – undo
888 913
 			{
889 914
 				return false;
890 915
 			}
891
-		} else return '';
916
+		} else {
917
+			return '';
918
+		}
892 919
 
893 920
 		if ($waypoints != '')
894 921
 		{
@@ -904,7 +931,9 @@  discard block
 block discarded – undo
904 931
 			{
905 932
 				return false;
906 933
 			}
907
-		} else $altitude = 0;
934
+		} else {
935
+			$altitude = 0;
936
+		}
908 937
 
909 938
 		if ($heading != '')
910 939
 		{
@@ -912,7 +941,9 @@  discard block
 block discarded – undo
912 941
 			{
913 942
 				return false;
914 943
 			}
915
-		} else $heading = 0;
944
+		} else {
945
+			$heading = 0;
946
+		}
916 947
 
917 948
 		if ($groundspeed != '')
918 949
 		{
@@ -920,9 +951,13 @@  discard block
 block discarded – undo
920 951
 			{
921 952
 				return false;
922 953
 			}
923
-		} else $groundspeed = 0;
954
+		} else {
955
+			$groundspeed = 0;
956
+		}
924 957
 		date_default_timezone_set('UTC');
925
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
958
+		if ($date == '') {
959
+			$date = date("Y-m-d H:i:s", time());
960
+		}
926 961
 
927 962
         
928 963
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -966,10 +1001,18 @@  discard block
 block discarded – undo
966 1001
 		$arrival_airport_country = '';
967 1002
 		
968 1003
             	
969
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1004
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1005
+            		$squawk = NULL;
1006
+            	}
1007
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1008
+            		$verticalrate = NULL;
1009
+            	}
1010
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1011
+            		$groundspeed = 0;
1012
+            	}
1013
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1014
+            		$heading = 0;
1015
+            	}
973 1016
             	
974 1017
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
975 1018
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -983,10 +1026,14 @@  discard block
 block discarded – undo
983 1026
                 	return "error : ".$e->getMessage();
984 1027
                 }
985 1028
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
986
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1029
+		    if ($globalDebug) {
1030
+		    	echo '(Add to SBS archive : ';
1031
+		    }
987 1032
 		    $SpotterArchive = new SpotterArchive($this->db);
988 1033
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
989
-		    if ($globalDebug) echo $result.')';
1034
+		    if ($globalDebug) {
1035
+		    	echo $result.')';
1036
+		    }
990 1037
 		}
991 1038
 		return "success";
992 1039
 
Please login to merge, or discard this patch.
require/libs/simple_html_dom.php 4 patches
Doc Comments   +40 added lines patch added patch discarded remove patch
@@ -125,6 +125,9 @@  discard block
 block discarded – undo
125 125
 	public $tag_start = 0;
126 126
 	private $dom = null;
127 127
 
128
+	/**
129
+	 * @param simple_html_dom $dom
130
+	 */
128 131
 	function __construct($dom)
129 132
 	{
130 133
 		$this->dom = $dom;
@@ -1501,6 +1504,11 @@  discard block
 block discarded – undo
1501 1504
 	}
1502 1505
 
1503 1506
 	// parse attributes
1507
+
1508
+	/**
1509
+	 * @param simple_html_dom_node $node
1510
+	 * @param string[] $space
1511
+	 */
1504 1512
 	protected function parse_attr($node, $name, &$space)
1505 1513
 	{
1506 1514
 		// Per sourceforge: http://sourceforge.net/tracker/?func=detail&aid=3061408&group_id=218559&atid=1044037
@@ -1538,6 +1546,11 @@  discard block
 block discarded – undo
1538 1546
 	}
1539 1547
 
1540 1548
 	// link node's parent
1549
+
1550
+	/**
1551
+	 * @param simple_html_dom_node $node
1552
+	 * @param boolean $is_child
1553
+	 */
1541 1554
 	protected function link_nodes(&$node, $is_child)
1542 1555
 	{
1543 1556
 		$node->parent = $this->parent;
@@ -1549,6 +1562,10 @@  discard block
 block discarded – undo
1549 1562
 	}
1550 1563
 
1551 1564
 	// as a text node
1565
+
1566
+	/**
1567
+	 * @param string $tag
1568
+	 */
1552 1569
 	protected function as_text_node($tag)
1553 1570
 	{
1554 1571
 		$node = new simple_html_dom_node($this);
@@ -1559,12 +1576,18 @@  discard block
 block discarded – undo
1559 1576
 		return true;
1560 1577
 	}
1561 1578
 
1579
+	/**
1580
+	 * @param string $chars
1581
+	 */
1562 1582
 	protected function skip($chars)
1563 1583
 	{
1564 1584
 		$this->pos += strspn($this->doc, $chars, $this->pos);
1565 1585
 		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1566 1586
 	}
1567 1587
 
1588
+	/**
1589
+	 * @param string $chars
1590
+	 */
1568 1591
 	protected function copy_skip($chars)
1569 1592
 	{
1570 1593
 		$pos = $this->pos;
@@ -1575,6 +1598,9 @@  discard block
 block discarded – undo
1575 1598
 		return substr($this->doc, $pos, $len);
1576 1599
 	}
1577 1600
 
1601
+	/**
1602
+	 * @param string $chars
1603
+	 */
1578 1604
 	protected function copy_until($chars)
1579 1605
 	{
1580 1606
 		$pos = $this->pos;
@@ -1584,6 +1610,9 @@  discard block
 block discarded – undo
1584 1610
 		return substr($this->doc, $pos, $len);
1585 1611
 	}
1586 1612
 
1613
+	/**
1614
+	 * @param string $char
1615
+	 */
1587 1616
 	protected function copy_until_char($char)
1588 1617
 	{
1589 1618
 		if ($this->char===null) return '';
@@ -1602,6 +1631,9 @@  discard block
 block discarded – undo
1602 1631
 		return substr($this->doc, $pos_old, $pos-$pos_old);
1603 1632
 	}
1604 1633
 
1634
+	/**
1635
+	 * @param string $char
1636
+	 */
1605 1637
 	protected function copy_until_char_escape($char)
1606 1638
 	{
1607 1639
 		if ($this->char===null) return '';
@@ -1633,6 +1665,10 @@  discard block
 block discarded – undo
1633 1665
 
1634 1666
 	// remove noise from html content
1635 1667
 	// save the noise in the $this->noise array.
1668
+
1669
+	/**
1670
+	 * @param string $pattern
1671
+	 */
1636 1672
 	protected function remove_noise($pattern, $remove_tag=false)
1637 1673
 	{
1638 1674
 		global $debug_object;
@@ -1658,6 +1694,10 @@  discard block
 block discarded – undo
1658 1694
 	}
1659 1695
 
1660 1696
 	// restore noise to html content
1697
+
1698
+	/**
1699
+	 * @param string|null $text
1700
+	 */
1661 1701
 	function restore_noise($text)
1662 1702
 	{
1663 1703
 		global $debug_object;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -824,11 +824,11 @@
 block discarded – undo
824 824
 	}
825 825
 
826 826
 	/**
827
-	* Returns true if $string is valid UTF-8 and false otherwise.
828
-	*
829
-	* @param mixed $str String to be tested
830
-	* @return boolean
831
-	*/
827
+	 * Returns true if $string is valid UTF-8 and false otherwise.
828
+	 *
829
+	 * @param mixed $str String to be tested
830
+	 * @return boolean
831
+	 */
832 832
 	static function is_utf8($str)
833 833
 	{
834 834
 		$c=0; $b=0;
Please login to merge, or discard this patch.
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -45,21 +45,21 @@  discard block
 block discarded – undo
45 45
  */
46 46
 define('HDOM_TYPE_ELEMENT', 1);
47 47
 define('HDOM_TYPE_COMMENT', 2);
48
-define('HDOM_TYPE_TEXT',	3);
49
-define('HDOM_TYPE_ENDTAG',  4);
50
-define('HDOM_TYPE_ROOT',	5);
48
+define('HDOM_TYPE_TEXT', 3);
49
+define('HDOM_TYPE_ENDTAG', 4);
50
+define('HDOM_TYPE_ROOT', 5);
51 51
 define('HDOM_TYPE_UNKNOWN', 6);
52 52
 define('HDOM_QUOTE_DOUBLE', 0);
53 53
 define('HDOM_QUOTE_SINGLE', 1);
54
-define('HDOM_QUOTE_NO',	 3);
55
-define('HDOM_INFO_BEGIN',   0);
56
-define('HDOM_INFO_END',	 1);
57
-define('HDOM_INFO_QUOTE',   2);
58
-define('HDOM_INFO_SPACE',   3);
59
-define('HDOM_INFO_TEXT',	4);
60
-define('HDOM_INFO_INNER',   5);
61
-define('HDOM_INFO_OUTER',   6);
62
-define('HDOM_INFO_ENDSPACE',7);
54
+define('HDOM_QUOTE_NO', 3);
55
+define('HDOM_INFO_BEGIN', 0);
56
+define('HDOM_INFO_END', 1);
57
+define('HDOM_INFO_QUOTE', 2);
58
+define('HDOM_INFO_SPACE', 3);
59
+define('HDOM_INFO_TEXT', 4);
60
+define('HDOM_INFO_INNER', 5);
61
+define('HDOM_INFO_OUTER', 6);
62
+define('HDOM_INFO_ENDSPACE', 7);
63 63
 define('DEFAULT_TARGET_CHARSET', 'UTF-8');
64 64
 define('DEFAULT_BR_TEXT', "\r\n");
65 65
 define('DEFAULT_SPAN_TEXT', " ");
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 // -----------------------------------------------------------------------------
69 69
 // get html dom from file
70 70
 // $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1.
71
-function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
71
+function file_get_html($url, $use_include_path = false, $context = null, $offset = -1, $maxLen = -1, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
72 72
 {
73 73
 	// We DO force the tags to be terminated.
74 74
 	$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 // get html dom from string
89
-function str_get_html($str, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
89
+function str_get_html($str, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
90 90
 {
91 91
 	$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
92 92
 	if (empty($str) || strlen($str) > MAX_FILE_SIZE)
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 // dump html dom tree
102
-function dump_html_tree($node, $show_attr=true, $deep=0)
102
+function dump_html_tree($node, $show_attr = true, $deep = 0)
103 103
 {
104 104
 	$node->dump($node);
105 105
 }
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	// dump node's tree
154
-	function dump($show_attr=true, $deep=0)
154
+	function dump($show_attr = true, $deep = 0)
155 155
 	{
156 156
 		$lead = str_repeat('	', $deep);
157 157
 
158 158
 		echo $lead.$this->tag;
159
-		if ($show_attr && count($this->attr)>0)
159
+		if ($show_attr && count($this->attr) > 0)
160 160
 		{
161 161
 			echo '(';
162 162
 			foreach ($this->attr as $k=>$v)
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 		{
170 170
 			foreach ($this->nodes as $c)
171 171
 			{
172
-				$c->dump($show_attr, $deep+1);
172
+				$c->dump($show_attr, $deep + 1);
173 173
 			}
174 174
 		}
175 175
 	}
176 176
 
177 177
 
178 178
 	// Debugging function to dump a single dom node with a bunch of information about it.
179
-	function dump_node($echo=true)
179
+	function dump_node($echo = true)
180 180
 	{
181 181
 
182 182
 		$string = $this->tag;
183
-		if (count($this->attr)>0)
183
+		if (count($this->attr) > 0)
184 184
 		{
185 185
 			$string .= '(';
186 186
 			foreach ($this->attr as $k=>$v)
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			}
190 190
 			$string .= ')';
191 191
 		}
192
-		if (count($this->_)>0)
192
+		if (count($this->_) > 0)
193 193
 		{
194 194
 			$string .= ' $_ (';
195 195
 			foreach ($this->_ as $k=>$v)
@@ -211,22 +211,22 @@  discard block
 block discarded – undo
211 211
 
212 212
 		if (isset($this->text))
213 213
 		{
214
-			$string .= " text: (" . $this->text . ")";
214
+			$string .= " text: (".$this->text.")";
215 215
 		}
216 216
 
217 217
 		$string .= " HDOM_INNER_INFO: '";
218 218
 		if (isset($node->_[HDOM_INFO_INNER]))
219 219
 		{
220
-			$string .= $node->_[HDOM_INFO_INNER] . "'";
220
+			$string .= $node->_[HDOM_INFO_INNER]."'";
221 221
 		}
222 222
 		else
223 223
 		{
224 224
 			$string .= ' NULL ';
225 225
 		}
226 226
 
227
-		$string .= " children: " . count($this->children);
228
-		$string .= " nodes: " . count($this->nodes);
229
-		$string .= " tag_start: " . $this->tag_start;
227
+		$string .= " children: ".count($this->children);
228
+		$string .= " nodes: ".count($this->nodes);
229
+		$string .= " tag_start: ".$this->tag_start;
230 230
 		$string .= "\n";
231 231
 
232 232
 		if ($echo)
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 	// returns the parent of node
244 244
 	// If a node is passed in, it will reset the parent of the current node to that one.
245
-	function parent($parent=null)
245
+	function parent($parent = null)
246 246
 	{
247 247
 		// I am SURE that this doesn't work properly.
248 248
 		// It fails to unset the current node from it's current parents nodes or children list first.
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	}
264 264
 
265 265
 	// returns children of node
266
-	function children($idx=-1)
266
+	function children($idx = -1)
267 267
 	{
268
-		if ($idx===-1)
268
+		if ($idx === -1)
269 269
 		{
270 270
 			return $this->children;
271 271
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	// returns the first child of node
280 280
 	function first_child()
281 281
 	{
282
-		if (count($this->children)>0)
282
+		if (count($this->children) > 0)
283 283
 		{
284 284
 			return $this->children[0];
285 285
 		}
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
 	// returns the last child of node
290 290
 	function last_child()
291 291
 	{
292
-		if (($count=count($this->children))>0)
292
+		if (($count = count($this->children)) > 0)
293 293
 		{
294
-			return $this->children[$count-1];
294
+			return $this->children[$count - 1];
295 295
 		}
296 296
 		return null;
297 297
 	}
@@ -299,18 +299,18 @@  discard block
 block discarded – undo
299 299
 	// returns the next sibling of node
300 300
 	function next_sibling()
301 301
 	{
302
-		if ($this->parent===null)
302
+		if ($this->parent === null)
303 303
 		{
304 304
 			return null;
305 305
 		}
306 306
 
307 307
 		$idx = 0;
308 308
 		$count = count($this->parent->children);
309
-		while ($idx<$count && $this!==$this->parent->children[$idx])
309
+		while ($idx < $count && $this !== $this->parent->children[$idx])
310 310
 		{
311 311
 			++$idx;
312 312
 		}
313
-		if (++$idx>=$count)
313
+		if (++$idx >= $count)
314 314
 		{
315 315
 			return null;
316 316
 		}
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
 	// returns the previous sibling of node
321 321
 	function prev_sibling()
322 322
 	{
323
-		if ($this->parent===null) return null;
323
+		if ($this->parent === null) return null;
324 324
 		$idx = 0;
325 325
 		$count = count($this->parent->children);
326
-		while ($idx<$count && $this!==$this->parent->children[$idx])
326
+		while ($idx < $count && $this !== $this->parent->children[$idx])
327 327
 			++$idx;
328
-		if (--$idx<0) return null;
328
+		if (--$idx < 0) return null;
329 329
 		return $this->parent->children[$idx];
330 330
 	}
331 331
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
 		while (!is_null($returnDom))
342 342
 		{
343
-			if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); }
343
+			if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: ".$returnDom->tag); }
344 344
 
345 345
 			if ($returnDom->tag == $tag)
346 346
 			{
@@ -374,16 +374,16 @@  discard block
 block discarded – undo
374 374
 			{
375 375
 				if (!empty($this->text))
376 376
 				{
377
-					$text = " with text: " . $this->text;
377
+					$text = " with text: ".$this->text;
378 378
 				}
379 379
 			}
380
-			$debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
380
+			$debug_object->debug_log(1, 'Innertext of tag: '.$this->tag.$text);
381 381
 		}
382 382
 
383
-		if ($this->tag==='root') return $this->innertext();
383
+		if ($this->tag === 'root') return $this->innertext();
384 384
 
385 385
 		// trigger callback
386
-		if ($this->dom && $this->dom->callback!==null)
386
+		if ($this->dom && $this->dom->callback !== null)
387 387
 		{
388 388
 			call_user_func_array($this->dom->callback, array($this));
389 389
 		}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 		}
419 419
 
420 420
 		// render end tag
421
-		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
421
+		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END] != 0)
422 422
 			$ret .= '</'.$this->tag.'>';
423 423
 		return $ret;
424 424
 	}
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 			case HDOM_TYPE_COMMENT: return '';
434 434
 			case HDOM_TYPE_UNKNOWN: return '';
435 435
 		}
436
-		if (strcasecmp($this->tag, 'script')===0) return '';
437
-		if (strcasecmp($this->tag, 'style')===0) return '';
436
+		if (strcasecmp($this->tag, 'script') === 0) return '';
437
+		if (strcasecmp($this->tag, 'style') === 0) return '';
438 438
 
439 439
 		$ret = '';
440 440
 		// In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 			++$i;
481 481
 
482 482
 			// skip removed attribute
483
-			if ($val===null || $val===false)
483
+			if ($val === null || $val === false)
484 484
 				continue;
485 485
 
486 486
 			$ret .= $this->_[HDOM_INFO_SPACE][$i][0];
487 487
 			//no value attr: nowrap, checked selected...
488
-			if ($val===true)
488
+			if ($val === true)
489 489
 				$ret .= $key;
490 490
 			else {
491 491
 				switch ($this->_[HDOM_INFO_QUOTE][$i])
@@ -498,34 +498,34 @@  discard block
 block discarded – undo
498 498
 			}
499 499
 		}
500 500
 		$ret = $this->dom->restore_noise($ret);
501
-		return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>';
501
+		return $ret.$this->_[HDOM_INFO_ENDSPACE].'>';
502 502
 	}
503 503
 
504 504
 	// find elements by css selector
505 505
 	//PaperG - added ability for find to lowercase the value of the selector.
506
-	function find($selector, $idx=null, $lowercase=false)
506
+	function find($selector, $idx = null, $lowercase = false)
507 507
 	{
508 508
 		$selectors = $this->parse_selector($selector);
509
-		if (($count=count($selectors))===0) return array();
509
+		if (($count = count($selectors)) === 0) return array();
510 510
 		$found_keys = array();
511 511
 
512 512
 		// find each selector
513
-		for ($c=0; $c<$count; ++$c)
513
+		for ($c = 0; $c < $count; ++$c)
514 514
 		{
515 515
 			// The change on the below line was documented on the sourceforge code tracker id 2788009
516 516
 			// used to be: if (($levle=count($selectors[0]))===0) return array();
517
-			if (($levle=count($selectors[$c]))===0) return array();
517
+			if (($levle = count($selectors[$c])) === 0) return array();
518 518
 			if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
519 519
 
520 520
 			$head = array($this->_[HDOM_INFO_BEGIN]=>1);
521 521
 
522 522
 			// handle descendant selectors, no recursive!
523
-			for ($l=0; $l<$levle; ++$l)
523
+			for ($l = 0; $l < $levle; ++$l)
524 524
 			{
525 525
 				$ret = array();
526 526
 				foreach ($head as $k=>$v)
527 527
 				{
528
-					$n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k];
528
+					$n = ($k === -1) ? $this->dom->root : $this->dom->nodes[$k];
529 529
 					//PaperG - Pass this optional parameter on to the seek function.
530 530
 					$n->seek($selectors[$c][$l], $ret, $lowercase);
531 531
 				}
@@ -550,13 +550,13 @@  discard block
 block discarded – undo
550 550
 
551 551
 		// return nth-element or array
552 552
 		if (is_null($idx)) return $found;
553
-		else if ($idx<0) $idx = count($found) + $idx;
553
+		else if ($idx < 0) $idx = count($found) + $idx;
554 554
 		return (isset($found[$idx])) ? $found[$idx] : null;
555 555
 	}
556 556
 
557 557
 	// seek for given conditions
558 558
 	// PaperG - added parameter to allow for case insensitive testing of the value of a selector.
559
-	protected function seek($selector, &$ret, $lowercase=false)
559
+	protected function seek($selector, &$ret, $lowercase = false)
560 560
 	{
561 561
 		global $debug_object;
562 562
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 			$count = 0;
570 570
 			foreach ($this->children as $c)
571 571
 			{
572
-				if ($tag==='*' || $tag===$c->tag) {
573
-					if (++$count==$key) {
572
+				if ($tag === '*' || $tag === $c->tag) {
573
+					if (++$count == $key) {
574 574
 						$ret[$c->_[HDOM_INFO_BEGIN]] = 1;
575 575
 						return;
576 576
 					}
@@ -580,38 +580,38 @@  discard block
 block discarded – undo
580 580
 		}
581 581
 
582 582
 		$end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0;
583
-		if ($end==0) {
583
+		if ($end == 0) {
584 584
 			$parent = $this->parent;
585
-			while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) {
585
+			while (!isset($parent->_[HDOM_INFO_END]) && $parent !== null) {
586 586
 				$end -= 1;
587 587
 				$parent = $parent->parent;
588 588
 			}
589 589
 			$end += $parent->_[HDOM_INFO_END];
590 590
 		}
591 591
 
592
-		for ($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) {
592
+		for ($i = $this->_[HDOM_INFO_BEGIN] + 1; $i < $end; ++$i) {
593 593
 			$node = $this->dom->nodes[$i];
594 594
 
595 595
 			$pass = true;
596 596
 
597
-			if ($tag==='*' && !$key) {
597
+			if ($tag === '*' && !$key) {
598 598
 				if (in_array($node, $this->children, true))
599 599
 					$ret[$i] = 1;
600 600
 				continue;
601 601
 			}
602 602
 
603 603
 			// compare tag
604
-			if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;}
604
+			if ($tag && $tag != $node->tag && $tag !== '*') {$pass = false; }
605 605
 			// compare key
606 606
 			if ($pass && $key) {
607 607
 				if ($no_key) {
608
-					if (isset($node->attr[$key])) $pass=false;
608
+					if (isset($node->attr[$key])) $pass = false;
609 609
 				} else {
610
-					if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false;
610
+					if (($key != "plaintext") && !isset($node->attr[$key])) $pass = false;
611 611
 				}
612 612
 			}
613 613
 			// compare value
614
-			if ($pass && $key && $val  && $val!=='*') {
614
+			if ($pass && $key && $val && $val !== '*') {
615 615
 				// If they have told us that this is a "plaintext" search then we want the plaintext of the node - right?
616 616
 				if ($key == "plaintext") {
617 617
 					// $node->plaintext actually returns $node->text();
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 					// this is a normal search, we want the value of that attribute of the tag.
621 621
 					$nodeKeyValue = $node->attr[$key];
622 622
 				}
623
-				if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}
623
+				if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: ".$node->tag." for attribute: ".$key.$exp.$val." where nodes value is: ".$nodeKeyValue); }
624 624
 
625 625
 				//PaperG - If lowercase is set, do a case insensitive test of the value of the selector.
626 626
 				if ($lowercase) {
@@ -628,11 +628,11 @@  discard block
 block discarded – undo
628 628
 				} else {
629 629
 					$check = $this->match($exp, $val, $nodeKeyValue);
630 630
 				}
631
-				if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: " . ($check ? "true" : "false"));}
631
+				if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: ".($check ? "true" : "false")); }
632 632
 
633 633
 				// handle multiple class
634
-				if (!$check && strcasecmp($key, 'class')===0) {
635
-					foreach (explode(' ',$node->attr[$key]) as $k) {
634
+				if (!$check && strcasecmp($key, 'class') === 0) {
635
+					foreach (explode(' ', $node->attr[$key]) as $k) {
636 636
 						// Without this, there were cases where leading, trailing, or double spaces lead to our comparing blanks - bad form.
637 637
 						if (!empty($k)) {
638 638
 							if ($lowercase) {
@@ -650,24 +650,24 @@  discard block
 block discarded – undo
650 650
 			unset($node);
651 651
 		}
652 652
 		// It's passed by reference so this is actually what this function returns.
653
-		if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret);}
653
+		if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret); }
654 654
 	}
655 655
 
656 656
 	protected function match($exp, $pattern, $value) {
657 657
 		global $debug_object;
658
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
658
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
659 659
 
660 660
 		switch ($exp) {
661 661
 			case '=':
662
-				return ($value===$pattern);
662
+				return ($value === $pattern);
663 663
 			case '!=':
664
-				return ($value!==$pattern);
664
+				return ($value !== $pattern);
665 665
 			case '^=':
666
-				return preg_match("/^".preg_quote($pattern,'/')."/", $value);
666
+				return preg_match("/^".preg_quote($pattern, '/')."/", $value);
667 667
 			case '$=':
668
-				return preg_match("/".preg_quote($pattern,'/')."$/", $value);
668
+				return preg_match("/".preg_quote($pattern, '/')."$/", $value);
669 669
 			case '*=':
670
-				if ($pattern[0]=='/') {
670
+				if ($pattern[0] == '/') {
671 671
 					return preg_match($pattern, $value);
672 672
 				}
673 673
 				return preg_match("/".$pattern."/i", $value);
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 
678 678
 	protected function parse_selector($selector_string) {
679 679
 		global $debug_object;
680
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
680
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
681 681
 
682 682
 		// pattern of CSS selectors, modified from mootools
683 683
 		// Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does.
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 //		$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
689 689
 		$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
690 690
 		preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
691
-		if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);}
691
+		if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches); }
692 692
 
693 693
 		$selectors = array();
694 694
 		$result = array();
@@ -696,29 +696,29 @@  discard block
 block discarded – undo
696 696
 
697 697
 		foreach ($matches as $m) {
698 698
 			$m[0] = trim($m[0]);
699
-			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
699
+			if ($m[0] === '' || $m[0] === '/' || $m[0] === '//') continue;
700 700
 			// for browser generated xpath
701
-			if ($m[1]==='tbody') continue;
701
+			if ($m[1] === 'tbody') continue;
702 702
 
703 703
 			list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
704
-			if (!empty($m[2])) {$key='id'; $val=$m[2];}
705
-			if (!empty($m[3])) {$key='class'; $val=$m[3];}
706
-			if (!empty($m[4])) {$key=$m[4];}
707
-			if (!empty($m[5])) {$exp=$m[5];}
708
-			if (!empty($m[6])) {$val=$m[6];}
704
+			if (!empty($m[2])) {$key = 'id'; $val = $m[2]; }
705
+			if (!empty($m[3])) {$key = 'class'; $val = $m[3]; }
706
+			if (!empty($m[4])) {$key = $m[4]; }
707
+			if (!empty($m[5])) {$exp = $m[5]; }
708
+			if (!empty($m[6])) {$val = $m[6]; }
709 709
 
710 710
 			// convert to lowercase
711
-			if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);}
711
+			if ($this->dom->lowercase) {$tag = strtolower($tag); $key = strtolower($key); }
712 712
 			//elements that do NOT have the specified attribute
713
-			if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;}
713
+			if (isset($key[0]) && $key[0] === '!') {$key = substr($key, 1); $no_key = true; }
714 714
 
715 715
 			$result[] = array($tag, $key, $val, $exp, $no_key);
716
-			if (trim($m[7])===',') {
716
+			if (trim($m[7]) === ',') {
717 717
 				$selectors[] = $result;
718 718
 				$result = array();
719 719
 			}
720 720
 		}
721
-		if (count($result)>0)
721
+		if (count($result) > 0)
722 722
 			$selectors[] = $result;
723 723
 		return $selectors;
724 724
 	}
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 	function __set($name, $value)
743 743
 	{
744 744
 		global $debug_object;
745
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
745
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
746 746
 
747 747
 		switch ($name)
748 748
 		{
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	function convert_text($text)
781 781
 	{
782 782
 		global $debug_object;
783
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
783
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
784 784
 
785 785
 		$converted_text = $text;
786 786
 
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 			$sourceCharset = strtoupper($this->dom->_charset);
793 793
 			$targetCharset = strtoupper($this->dom->_target_charset);
794 794
 		}
795
-		if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}
795
+		if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: ".$sourceCharset." target charaset: ".$targetCharset); }
796 796
 
797 797
 		if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0))
798 798
 		{
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	*/
832 832
 	static function is_utf8($str)
833 833
 	{
834
-		$c=0; $b=0;
835
-		$bits=0;
836
-		$len=strlen($str);
837
-		for($i=0; $i<$len; $i++)
834
+		$c = 0; $b = 0;
835
+		$bits = 0;
836
+		$len = strlen($str);
837
+		for ($i = 0; $i < $len; $i++)
838 838
 		{
839
-			$c=ord($str[$i]);
840
-			if($c > 128)
839
+			$c = ord($str[$i]);
840
+			if ($c > 128)
841 841
 			{
842
-				if(($c >= 254)) return false;
843
-				elseif($c >= 252) $bits=6;
844
-				elseif($c >= 248) $bits=5;
845
-				elseif($c >= 240) $bits=4;
846
-				elseif($c >= 224) $bits=3;
847
-				elseif($c >= 192) $bits=2;
842
+				if (($c >= 254)) return false;
843
+				elseif ($c >= 252) $bits = 6;
844
+				elseif ($c >= 248) $bits = 5;
845
+				elseif ($c >= 240) $bits = 4;
846
+				elseif ($c >= 224) $bits = 3;
847
+				elseif ($c >= 192) $bits = 2;
848 848
 				else return false;
849
-				if(($i+$bits) > $len) return false;
850
-				while($bits > 1)
849
+				if (($i + $bits) > $len) return false;
850
+				while ($bits > 1)
851 851
 				{
852 852
 					$i++;
853
-					$b=ord($str[$i]);
854
-					if($b < 128 || $b > 191) return false;
853
+					$b = ord($str[$i]);
854
+					if ($b < 128 || $b > 191) return false;
855 855
 					$bits--;
856 856
 				}
857 857
 			}
@@ -955,24 +955,24 @@  discard block
 block discarded – undo
955 955
 	}
956 956
 
957 957
 	// camel naming conventions
958
-	function getAllAttributes() {return $this->attr;}
959
-	function getAttribute($name) {return $this->__get($name);}
960
-	function setAttribute($name, $value) {$this->__set($name, $value);}
961
-	function hasAttribute($name) {return $this->__isset($name);}
962
-	function removeAttribute($name) {$this->__set($name, null);}
963
-	function getElementById($id) {return $this->find("#$id", 0);}
964
-	function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
965
-	function getElementByTagName($name) {return $this->find($name, 0);}
966
-	function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);}
967
-	function parentNode() {return $this->parent();}
968
-	function childNodes($idx=-1) {return $this->children($idx);}
969
-	function firstChild() {return $this->first_child();}
970
-	function lastChild() {return $this->last_child();}
971
-	function nextSibling() {return $this->next_sibling();}
972
-	function previousSibling() {return $this->prev_sibling();}
973
-	function hasChildNodes() {return $this->has_child();}
974
-	function nodeName() {return $this->tag;}
975
-	function appendChild($node) {$node->parent($this); return $node;}
958
+	function getAllAttributes() {return $this->attr; }
959
+	function getAttribute($name) {return $this->__get($name); }
960
+	function setAttribute($name, $value) {$this->__set($name, $value); }
961
+	function hasAttribute($name) {return $this->__isset($name); }
962
+	function removeAttribute($name) {$this->__set($name, null); }
963
+	function getElementById($id) {return $this->find("#$id", 0); }
964
+	function getElementsById($id, $idx = null) {return $this->find("#$id", $idx); }
965
+	function getElementByTagName($name) {return $this->find($name, 0); }
966
+	function getElementsByTagName($name, $idx = null) {return $this->find($name, $idx); }
967
+	function parentNode() {return $this->parent(); }
968
+	function childNodes($idx = -1) {return $this->children($idx); }
969
+	function firstChild() {return $this->first_child(); }
970
+	function lastChild() {return $this->last_child(); }
971
+	function nextSibling() {return $this->next_sibling(); }
972
+	function previousSibling() {return $this->prev_sibling(); }
973
+	function hasChildNodes() {return $this->has_child(); }
974
+	function nodeName() {return $this->tag; }
975
+	function appendChild($node) {$node->parent($this); return $node; }
976 976
 
977 977
 }
978 978
 
@@ -1028,11 +1028,11 @@  discard block
 block discarded – undo
1028 1028
 		'option'=>array('option'=>1),
1029 1029
 	);
1030 1030
 
1031
-	function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1031
+	function __construct($str = null, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1032 1032
 	{
1033 1033
 		if ($str)
1034 1034
 		{
1035
-			if (preg_match("/^http:\/\//i",$str) || is_file($str))
1035
+			if (preg_match("/^http:\/\//i", $str) || is_file($str))
1036 1036
 			{
1037 1037
 				$this->load_file($str);
1038 1038
 			}
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 		}
1044 1044
 		// Forcing tags to be closed implies that we don't trust the html, but it can lead to parsing errors if we SHOULD trust the html.
1045 1045
 		if (!$forceTagsClosed) {
1046
-			$this->optional_closing_array=array();
1046
+			$this->optional_closing_array = array();
1047 1047
 		}
1048 1048
 		$this->_target_charset = $target_charset;
1049 1049
 	}
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 	}
1055 1055
 
1056 1056
 	// load html from string
1057
-	function load($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1057
+	function load($str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1058 1058
 	{
1059 1059
 		global $debug_object;
1060 1060
 
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 		$args = func_get_args();
1097 1097
 		$this->load(call_user_func_array('file_get_contents', $args), true);
1098 1098
 		// Throw an error if we can't properly load the dom.
1099
-		if (($error=error_get_last())!==null) {
1099
+		if (($error = error_get_last()) !== null) {
1100 1100
 			$this->clear();
1101 1101
 			return false;
1102 1102
 		}
@@ -1115,16 +1115,16 @@  discard block
 block discarded – undo
1115 1115
 	}
1116 1116
 
1117 1117
 	// save dom as string
1118
-	function save($filepath='')
1118
+	function save($filepath = '')
1119 1119
 	{
1120 1120
 		$ret = $this->root->innertext();
1121
-		if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX);
1121
+		if ($filepath !== '') file_put_contents($filepath, $ret, LOCK_EX);
1122 1122
 		return $ret;
1123 1123
 	}
1124 1124
 
1125 1125
 	// find dom node by css selector
1126 1126
 	// Paperg - allow us to specify that we want case insensitive testing of the value of the selector.
1127
-	function find($selector, $idx=null, $lowercase=false)
1127
+	function find($selector, $idx = null, $lowercase = false)
1128 1128
 	{
1129 1129
 		return $this->root->find($selector, $idx, $lowercase);
1130 1130
 	}
@@ -1132,22 +1132,22 @@  discard block
 block discarded – undo
1132 1132
 	// clean up memory due to php5 circular references memory leak...
1133 1133
 	function clear()
1134 1134
 	{
1135
-		foreach ($this->nodes as $n) {$n->clear(); $n = null;}
1135
+		foreach ($this->nodes as $n) {$n->clear(); $n = null; }
1136 1136
 		// This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.
1137
-		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}
1138
-		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
1139
-		if (isset($this->root)) {$this->root->clear(); unset($this->root);}
1137
+		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null; }
1138
+		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent); }
1139
+		if (isset($this->root)) {$this->root->clear(); unset($this->root); }
1140 1140
 		unset($this->doc);
1141 1141
 		unset($this->noise);
1142 1142
 	}
1143 1143
 
1144
-	function dump($show_attr=true)
1144
+	function dump($show_attr = true)
1145 1145
 	{
1146 1146
 		$this->root->dump($show_attr);
1147 1147
 	}
1148 1148
 
1149 1149
 	// prepare HTML data and init everything
1150
-	protected function prepare($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1150
+	protected function prepare($str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1151 1151
 	{
1152 1152
 		$this->clear();
1153 1153
 
@@ -1178,13 +1178,13 @@  discard block
 block discarded – undo
1178 1178
 		$this->root->_[HDOM_INFO_BEGIN] = -1;
1179 1179
 		$this->root->nodetype = HDOM_TYPE_ROOT;
1180 1180
 		$this->parent = $this->root;
1181
-		if ($this->size>0) $this->char = $this->doc[0];
1181
+		if ($this->size > 0) $this->char = $this->doc[0];
1182 1182
 	}
1183 1183
 
1184 1184
 	// parse html content
1185 1185
 	protected function parse()
1186 1186
 	{
1187
-		if (($s = $this->copy_until_char('<'))==='')
1187
+		if (($s = $this->copy_until_char('<')) === '')
1188 1188
 		{
1189 1189
 			return $this->read_tag();
1190 1190
 		}
@@ -1213,18 +1213,18 @@  discard block
 block discarded – undo
1213 1213
 			if ($success)
1214 1214
 			{
1215 1215
 				$charset = $matches[1];
1216
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: ' . $charset);}
1216
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: '.$charset); }
1217 1217
 			}
1218 1218
 
1219 1219
 		}
1220 1220
 
1221 1221
 		if (empty($charset))
1222 1222
 		{
1223
-			$el = $this->root->find('meta[http-equiv=Content-Type]',0, true);
1223
+			$el = $this->root->find('meta[http-equiv=Content-Type]', 0, true);
1224 1224
 			if (!empty($el))
1225 1225
 			{
1226 1226
 				$fullvalue = $el->content;
1227
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found' . $fullvalue);}
1227
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found'.$fullvalue); }
1228 1228
 
1229 1229
 				if (!empty($fullvalue))
1230 1230
 				{
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 					else
1237 1237
 					{
1238 1238
 						// If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
1239
-						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
1239
+						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.'); }
1240 1240
 						$charset = 'ISO-8859-1';
1241 1241
 					}
1242 1242
 				}
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
 			if (function_exists('mb_detect_encoding'))
1252 1252
 			{
1253 1253
 				// Have php try to detect the encoding from the text given to us.
1254
-				$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
1255
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: ' . $charset);}
1254
+				$charset = mb_detect_encoding($this->root->plaintext."ascii", $encoding_list = array("UTF-8", "CP1252"));
1255
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: '.$charset); }
1256 1256
 			}
1257 1257
 
1258 1258
 			// and if this doesn't work...  then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need...
1259 1259
 			if ($charset === false)
1260 1260
 			{
1261
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8');}
1261
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8'); }
1262 1262
 				$charset = 'UTF-8';
1263 1263
 			}
1264 1264
 		}
@@ -1266,11 +1266,11 @@  discard block
 block discarded – undo
1266 1266
 		// Since CP1252 is a superset, if we get one of it's subsets, we want it instead.
1267 1267
 		if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1')))
1268 1268
 		{
1269
-			if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}
1269
+			if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing '.$charset.' with CP1252 as its a superset'); }
1270 1270
 			$charset = 'CP1252';
1271 1271
 		}
1272 1272
 
1273
-		if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - ' . $charset);}
1273
+		if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - '.$charset); }
1274 1274
 
1275 1275
 		return $this->_charset = $charset;
1276 1276
 	}
@@ -1278,41 +1278,41 @@  discard block
 block discarded – undo
1278 1278
 	// read tag info
1279 1279
 	protected function read_tag()
1280 1280
 	{
1281
-		if ($this->char!=='<')
1281
+		if ($this->char !== '<')
1282 1282
 		{
1283 1283
 			$this->root->_[HDOM_INFO_END] = $this->cursor;
1284 1284
 			return false;
1285 1285
 		}
1286 1286
 		$begin_tag_pos = $this->pos;
1287
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1287
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1288 1288
 
1289 1289
 		// end tag
1290
-		if ($this->char==='/')
1290
+		if ($this->char === '/')
1291 1291
 		{
1292
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1292
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1293 1293
 			// This represents the change in the simple_html_dom trunk from revision 180 to 181.
1294 1294
 			// $this->skip($this->token_blank_t);
1295 1295
 			$this->skip($this->token_blank);
1296 1296
 			$tag = $this->copy_until_char('>');
1297 1297
 
1298 1298
 			// skip attributes in end tag
1299
-			if (($pos = strpos($tag, ' '))!==false)
1299
+			if (($pos = strpos($tag, ' ')) !== false)
1300 1300
 				$tag = substr($tag, 0, $pos);
1301 1301
 
1302 1302
 			$parent_lower = strtolower($this->parent->tag);
1303 1303
 			$tag_lower = strtolower($tag);
1304 1304
 
1305
-			if ($parent_lower!==$tag_lower)
1305
+			if ($parent_lower !== $tag_lower)
1306 1306
 			{
1307 1307
 				if (isset($this->optional_closing_tags[$parent_lower]) && isset($this->block_tags[$tag_lower]))
1308 1308
 				{
1309 1309
 					$this->parent->_[HDOM_INFO_END] = 0;
1310 1310
 					$org_parent = $this->parent;
1311 1311
 
1312
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1312
+					while (($this->parent->parent) && strtolower($this->parent->tag) !== $tag_lower)
1313 1313
 						$this->parent = $this->parent->parent;
1314 1314
 
1315
-					if (strtolower($this->parent->tag)!==$tag_lower) {
1315
+					if (strtolower($this->parent->tag) !== $tag_lower) {
1316 1316
 						$this->parent = $org_parent; // restore origonal parent
1317 1317
 						if ($this->parent->parent) $this->parent = $this->parent->parent;
1318 1318
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
@@ -1324,17 +1324,17 @@  discard block
 block discarded – undo
1324 1324
 					$this->parent->_[HDOM_INFO_END] = 0;
1325 1325
 					$org_parent = $this->parent;
1326 1326
 
1327
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1327
+					while (($this->parent->parent) && strtolower($this->parent->tag) !== $tag_lower)
1328 1328
 						$this->parent = $this->parent->parent;
1329 1329
 
1330
-					if (strtolower($this->parent->tag)!==$tag_lower)
1330
+					if (strtolower($this->parent->tag) !== $tag_lower)
1331 1331
 					{
1332 1332
 						$this->parent = $org_parent; // restore origonal parent
1333 1333
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1334 1334
 						return $this->as_text_node($tag);
1335 1335
 					}
1336 1336
 				}
1337
-				else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1337
+				else if (($this->parent->parent) && strtolower($this->parent->parent->tag) === $tag_lower)
1338 1338
 				{
1339 1339
 					$this->parent->_[HDOM_INFO_END] = 0;
1340 1340
 					$this->parent = $this->parent->parent;
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 			$this->parent->_[HDOM_INFO_END] = $this->cursor;
1347 1347
 			if ($this->parent->parent) $this->parent = $this->parent->parent;
1348 1348
 
1349
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1349
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1350 1350
 			return true;
1351 1351
 		}
1352 1352
 
@@ -1357,25 +1357,25 @@  discard block
 block discarded – undo
1357 1357
 		$node->tag_start = $begin_tag_pos;
1358 1358
 
1359 1359
 		// doctype, cdata & comments...
1360
-		if (isset($tag[0]) && $tag[0]==='!') {
1361
-			$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
1360
+		if (isset($tag[0]) && $tag[0] === '!') {
1361
+			$node->_[HDOM_INFO_TEXT] = '<'.$tag.$this->copy_until_char('>');
1362 1362
 
1363
-			if (isset($tag[2]) && $tag[1]==='-' && $tag[2]==='-') {
1363
+			if (isset($tag[2]) && $tag[1] === '-' && $tag[2] === '-') {
1364 1364
 				$node->nodetype = HDOM_TYPE_COMMENT;
1365 1365
 				$node->tag = 'comment';
1366 1366
 			} else {
1367 1367
 				$node->nodetype = HDOM_TYPE_UNKNOWN;
1368 1368
 				$node->tag = 'unknown';
1369 1369
 			}
1370
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1370
+			if ($this->char === '>') $node->_[HDOM_INFO_TEXT] .= '>';
1371 1371
 			$this->link_nodes($node, true);
1372
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1372
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1373 1373
 			return true;
1374 1374
 		}
1375 1375
 
1376 1376
 		// text
1377
-		if ($pos=strpos($tag, '<')!==false) {
1378
-			$tag = '<' . substr($tag, 0, -1);
1377
+		if ($pos = strpos($tag, '<') !== false) {
1378
+			$tag = '<'.substr($tag, 0, -1);
1379 1379
 			$node->_[HDOM_INFO_TEXT] = $tag;
1380 1380
 			$this->link_nodes($node, false);
1381 1381
 			$this->char = $this->doc[--$this->pos]; // prev
@@ -1383,15 +1383,15 @@  discard block
 block discarded – undo
1383 1383
 		}
1384 1384
 
1385 1385
 		if (!preg_match("/^[\w-:]+$/", $tag)) {
1386
-			$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
1387
-			if ($this->char==='<') {
1386
+			$node->_[HDOM_INFO_TEXT] = '<'.$tag.$this->copy_until('<>');
1387
+			if ($this->char === '<') {
1388 1388
 				$this->link_nodes($node, false);
1389 1389
 				return true;
1390 1390
 			}
1391 1391
 
1392
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1392
+			if ($this->char === '>') $node->_[HDOM_INFO_TEXT] .= '>';
1393 1393
 			$this->link_nodes($node, false);
1394
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1394
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1395 1395
 			return true;
1396 1396
 		}
1397 1397
 
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 		$node->tag = ($this->lowercase) ? $tag_lower : $tag;
1402 1402
 
1403 1403
 		// handle optional closing tags
1404
-		if (isset($this->optional_closing_tags[$tag_lower]) )
1404
+		if (isset($this->optional_closing_tags[$tag_lower]))
1405 1405
 		{
1406 1406
 			while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)]))
1407 1407
 			{
@@ -1417,67 +1417,67 @@  discard block
 block discarded – undo
1417 1417
 		// attributes
1418 1418
 		do
1419 1419
 		{
1420
-			if ($this->char!==null && $space[0]==='')
1420
+			if ($this->char !== null && $space[0] === '')
1421 1421
 			{
1422 1422
 				break;
1423 1423
 			}
1424 1424
 			$name = $this->copy_until($this->token_equal);
1425
-			if ($guard===$this->pos)
1425
+			if ($guard === $this->pos)
1426 1426
 			{
1427
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1427
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1428 1428
 				continue;
1429 1429
 			}
1430 1430
 			$guard = $this->pos;
1431 1431
 
1432 1432
 			// handle endless '<'
1433
-			if ($this->pos>=$this->size-1 && $this->char!=='>') {
1433
+			if ($this->pos >= $this->size - 1 && $this->char !== '>') {
1434 1434
 				$node->nodetype = HDOM_TYPE_TEXT;
1435 1435
 				$node->_[HDOM_INFO_END] = 0;
1436
-				$node->_[HDOM_INFO_TEXT] = '<'.$tag . $space[0] . $name;
1436
+				$node->_[HDOM_INFO_TEXT] = '<'.$tag.$space[0].$name;
1437 1437
 				$node->tag = 'text';
1438 1438
 				$this->link_nodes($node, false);
1439 1439
 				return true;
1440 1440
 			}
1441 1441
 
1442 1442
 			// handle mismatch '<'
1443
-			if ($this->doc[$this->pos-1]=='<') {
1443
+			if ($this->doc[$this->pos - 1] == '<') {
1444 1444
 				$node->nodetype = HDOM_TYPE_TEXT;
1445 1445
 				$node->tag = 'text';
1446 1446
 				$node->attr = array();
1447 1447
 				$node->_[HDOM_INFO_END] = 0;
1448
-				$node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos-$begin_tag_pos-1);
1448
+				$node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos - $begin_tag_pos - 1);
1449 1449
 				$this->pos -= 2;
1450
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1450
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1451 1451
 				$this->link_nodes($node, false);
1452 1452
 				return true;
1453 1453
 			}
1454 1454
 
1455
-			if ($name!=='/' && $name!=='') {
1455
+			if ($name !== '/' && $name !== '') {
1456 1456
 				$space[1] = $this->copy_skip($this->token_blank);
1457 1457
 				$name = $this->restore_noise($name);
1458 1458
 				if ($this->lowercase) $name = strtolower($name);
1459
-				if ($this->char==='=') {
1460
-					$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1459
+				if ($this->char === '=') {
1460
+					$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1461 1461
 					$this->parse_attr($node, $name, $space);
1462 1462
 				}
1463 1463
 				else {
1464 1464
 					//no value attr: nowrap, checked selected...
1465 1465
 					$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1466 1466
 					$node->attr[$name] = true;
1467
-					if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
1467
+					if ($this->char != '>') $this->char = $this->doc[--$this->pos]; // prev
1468 1468
 				}
1469 1469
 				$node->_[HDOM_INFO_SPACE][] = $space;
1470 1470
 				$space = array($this->copy_skip($this->token_blank), '', '');
1471 1471
 			}
1472 1472
 			else
1473 1473
 				break;
1474
-		} while ($this->char!=='>' && $this->char!=='/');
1474
+		} while ($this->char !== '>' && $this->char !== '/');
1475 1475
 
1476 1476
 		$this->link_nodes($node, true);
1477 1477
 		$node->_[HDOM_INFO_ENDSPACE] = $space[0];
1478 1478
 
1479 1479
 		// check self closing
1480
-		if ($this->copy_until_char_escape('>')==='/')
1480
+		if ($this->copy_until_char_escape('>') === '/')
1481 1481
 		{
1482 1482
 			$node->_[HDOM_INFO_ENDSPACE] .= '/';
1483 1483
 			$node->_[HDOM_INFO_END] = 0;
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 			// reset parent
1488 1488
 			if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
1489 1489
 		}
1490
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1490
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1491 1491
 
1492 1492
 		// If it's a BR tag, we need to set it's text to the default text.
1493 1493
 		// This way when we see it in plaintext, we can generate formatting that the user wants.
@@ -1514,15 +1514,15 @@  discard block
 block discarded – undo
1514 1514
 		switch ($this->char) {
1515 1515
 			case '"':
1516 1516
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
1517
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1517
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1518 1518
 				$node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('"'));
1519
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1519
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1520 1520
 				break;
1521 1521
 			case '\'':
1522 1522
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE;
1523
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1523
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1524 1524
 				$node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('\''));
1525
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1525
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1526 1526
 				break;
1527 1527
 			default:
1528 1528
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
@@ -1553,16 +1553,16 @@  discard block
 block discarded – undo
1553 1553
 	{
1554 1554
 		$node = new simple_html_dom_node($this);
1555 1555
 		++$this->cursor;
1556
-		$node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
1556
+		$node->_[HDOM_INFO_TEXT] = '</'.$tag.'>';
1557 1557
 		$this->link_nodes($node, false);
1558
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1558
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1559 1559
 		return true;
1560 1560
 	}
1561 1561
 
1562 1562
 	protected function skip($chars)
1563 1563
 	{
1564 1564
 		$this->pos += strspn($this->doc, $chars, $this->pos);
1565
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1565
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1566 1566
 	}
1567 1567
 
1568 1568
 	protected function copy_skip($chars)
@@ -1570,8 +1570,8 @@  discard block
 block discarded – undo
1570 1570
 		$pos = $this->pos;
1571 1571
 		$len = strspn($this->doc, $chars, $pos);
1572 1572
 		$this->pos += $len;
1573
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1574
-		if ($len===0) return '';
1573
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1574
+		if ($len === 0) return '';
1575 1575
 		return substr($this->doc, $pos, $len);
1576 1576
 	}
1577 1577
 
@@ -1580,70 +1580,70 @@  discard block
 block discarded – undo
1580 1580
 		$pos = $this->pos;
1581 1581
 		$len = strcspn($this->doc, $chars, $pos);
1582 1582
 		$this->pos += $len;
1583
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1583
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1584 1584
 		return substr($this->doc, $pos, $len);
1585 1585
 	}
1586 1586
 
1587 1587
 	protected function copy_until_char($char)
1588 1588
 	{
1589
-		if ($this->char===null) return '';
1589
+		if ($this->char === null) return '';
1590 1590
 
1591
-		if (($pos = strpos($this->doc, $char, $this->pos))===false) {
1592
-			$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1591
+		if (($pos = strpos($this->doc, $char, $this->pos)) === false) {
1592
+			$ret = substr($this->doc, $this->pos, $this->size - $this->pos);
1593 1593
 			$this->char = null;
1594 1594
 			$this->pos = $this->size;
1595 1595
 			return $ret;
1596 1596
 		}
1597 1597
 
1598
-		if ($pos===$this->pos) return '';
1598
+		if ($pos === $this->pos) return '';
1599 1599
 		$pos_old = $this->pos;
1600 1600
 		$this->char = $this->doc[$pos];
1601 1601
 		$this->pos = $pos;
1602
-		return substr($this->doc, $pos_old, $pos-$pos_old);
1602
+		return substr($this->doc, $pos_old, $pos - $pos_old);
1603 1603
 	}
1604 1604
 
1605 1605
 	protected function copy_until_char_escape($char)
1606 1606
 	{
1607
-		if ($this->char===null) return '';
1607
+		if ($this->char === null) return '';
1608 1608
 
1609 1609
 		$start = $this->pos;
1610 1610
 		while (1)
1611 1611
 		{
1612
-			if (($pos = strpos($this->doc, $char, $start))===false)
1612
+			if (($pos = strpos($this->doc, $char, $start)) === false)
1613 1613
 			{
1614
-				$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1614
+				$ret = substr($this->doc, $this->pos, $this->size - $this->pos);
1615 1615
 				$this->char = null;
1616 1616
 				$this->pos = $this->size;
1617 1617
 				return $ret;
1618 1618
 			}
1619 1619
 
1620
-			if ($pos===$this->pos) return '';
1620
+			if ($pos === $this->pos) return '';
1621 1621
 
1622
-			if ($this->doc[$pos-1]==='\\') {
1623
-				$start = $pos+1;
1622
+			if ($this->doc[$pos - 1] === '\\') {
1623
+				$start = $pos + 1;
1624 1624
 				continue;
1625 1625
 			}
1626 1626
 
1627 1627
 			$pos_old = $this->pos;
1628 1628
 			$this->char = $this->doc[$pos];
1629 1629
 			$this->pos = $pos;
1630
-			return substr($this->doc, $pos_old, $pos-$pos_old);
1630
+			return substr($this->doc, $pos_old, $pos - $pos_old);
1631 1631
 		}
1632 1632
 	}
1633 1633
 
1634 1634
 	// remove noise from html content
1635 1635
 	// save the noise in the $this->noise array.
1636
-	protected function remove_noise($pattern, $remove_tag=false)
1636
+	protected function remove_noise($pattern, $remove_tag = false)
1637 1637
 	{
1638 1638
 		global $debug_object;
1639 1639
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1640 1640
 
1641 1641
 		$count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
1642 1642
 
1643
-		for ($i=$count-1; $i>-1; --$i)
1643
+		for ($i = $count - 1; $i > -1; --$i)
1644 1644
 		{
1645
-			$key = '___noise___'.sprintf('% 5d', count($this->noise)+1000);
1646
-			if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: ' . $key); }
1645
+			$key = '___noise___'.sprintf('% 5d', count($this->noise) + 1000);
1646
+			if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: '.$key); }
1647 1647
 			$idx = ($remove_tag) ? 0 : 1;
1648 1648
 			$this->noise[$key] = $matches[$i][$idx][0];
1649 1649
 			$this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 
1652 1652
 		// reset the length of content
1653 1653
 		$this->size = strlen($this->doc);
1654
-		if ($this->size>0)
1654
+		if ($this->size > 0)
1655 1655
 		{
1656 1656
 			$this->char = $this->doc[0];
1657 1657
 		}
@@ -1663,28 +1663,28 @@  discard block
 block discarded – undo
1663 1663
 		global $debug_object;
1664 1664
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1665 1665
 
1666
-		while (($pos=strpos($text, '___noise___'))!==false)
1666
+		while (($pos = strpos($text, '___noise___')) !== false)
1667 1667
 		{
1668 1668
 			// Sometimes there is a broken piece of markup, and we don't GET the pos+11 etc... token which indicates a problem outside of us...
1669
-			if (strlen($text) > $pos+15)
1669
+			if (strlen($text) > $pos + 15)
1670 1670
 			{
1671
-				$key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15];
1672
-				if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: ' . $key); }
1671
+				$key = '___noise___'.$text[$pos + 11].$text[$pos + 12].$text[$pos + 13].$text[$pos + 14].$text[$pos + 15];
1672
+				if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: '.$key); }
1673 1673
 
1674 1674
 				if (isset($this->noise[$key]))
1675 1675
 				{
1676
-					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16);
1676
+					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos + 16);
1677 1677
 				}
1678 1678
 				else
1679 1679
 				{
1680 1680
 					// do this to prevent an infinite loop.
1681
-					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16);
1681
+					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key.substr($text, $pos + 16);
1682 1682
 				}
1683 1683
 			}
1684 1684
 			else
1685 1685
 			{
1686 1686
 				// There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
1687
-				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11);
1687
+				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY'.substr($text, $pos + 11);
1688 1688
 			}
1689 1689
 		}
1690 1690
 		return $text;
@@ -1696,9 +1696,9 @@  discard block
 block discarded – undo
1696 1696
 		global $debug_object;
1697 1697
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1698 1698
 
1699
-		foreach($this->noise as $noiseElement)
1699
+		foreach ($this->noise as $noiseElement)
1700 1700
 		{
1701
-			if (strpos($noiseElement, $text)!==false)
1701
+			if (strpos($noiseElement, $text) !== false)
1702 1702
 			{
1703 1703
 				return $noiseElement;
1704 1704
 			}
@@ -1727,16 +1727,16 @@  discard block
 block discarded – undo
1727 1727
 	}
1728 1728
 
1729 1729
 	// camel naming conventions
1730
-	function childNodes($idx=-1) {return $this->root->childNodes($idx);}
1731
-	function firstChild() {return $this->root->first_child();}
1732
-	function lastChild() {return $this->root->last_child();}
1733
-	function createElement($name, $value=null) {return @str_get_html("<$name>$value</$name>")->first_child();}
1734
-	function createTextNode($value) {return @end(str_get_html($value)->nodes);}
1735
-	function getElementById($id) {return $this->find("#$id", 0);}
1736
-	function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
1737
-	function getElementByTagName($name) {return $this->find($name, 0);}
1738
-	function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);}
1739
-	function loadFile() {$args = func_get_args();$this->load_file($args);}
1730
+	function childNodes($idx = -1) {return $this->root->childNodes($idx); }
1731
+	function firstChild() {return $this->root->first_child(); }
1732
+	function lastChild() {return $this->root->last_child(); }
1733
+	function createElement($name, $value = null) {return @str_get_html("<$name>$value</$name>")->first_child(); }
1734
+	function createTextNode($value) {return @end(str_get_html($value)->nodes); }
1735
+	function getElementById($id) {return $this->find("#$id", 0); }
1736
+	function getElementsById($id, $idx = null) {return $this->find("#$id", $idx); }
1737
+	function getElementByTagName($name) {return $this->find($name, 0); }
1738
+	function getElementsByTagName($name, $idx = -1) {return $this->find($name, $idx); }
1739
+	function loadFile() {$args = func_get_args(); $this->load_file($args); }
1740 1740
 }
1741 1741
 
1742 1742
 ?>
1743 1743
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +193 added lines, -101 removed lines patch added patch discarded remove patch
@@ -159,8 +159,9 @@  discard block
 block discarded – undo
159 159
 		if ($show_attr && count($this->attr)>0)
160 160
 		{
161 161
 			echo '(';
162
-			foreach ($this->attr as $k=>$v)
163
-				echo "[$k]=>\"".$this->$k.'", ';
162
+			foreach ($this->attr as $k=>$v) {
163
+							echo "[$k]=>\"".$this->$k.'", ';
164
+			}
164 165
 			echo ')';
165 166
 		}
166 167
 		echo "\n";
@@ -218,8 +219,7 @@  discard block
 block discarded – undo
218 219
 		if (isset($node->_[HDOM_INFO_INNER]))
219 220
 		{
220 221
 			$string .= $node->_[HDOM_INFO_INNER] . "'";
221
-		}
222
-		else
222
+		} else
223 223
 		{
224 224
 			$string .= ' NULL ';
225 225
 		}
@@ -233,8 +233,7 @@  discard block
 block discarded – undo
233 233
 		{
234 234
 			echo $string;
235 235
 			return;
236
-		}
237
-		else
236
+		} else
238 237
 		{
239 238
 			return $string;
240 239
 		}
@@ -320,12 +319,17 @@  discard block
 block discarded – undo
320 319
 	// returns the previous sibling of node
321 320
 	function prev_sibling()
322 321
 	{
323
-		if ($this->parent===null) return null;
322
+		if ($this->parent===null) {
323
+			return null;
324
+		}
324 325
 		$idx = 0;
325 326
 		$count = count($this->parent->children);
326
-		while ($idx<$count && $this!==$this->parent->children[$idx])
327
-			++$idx;
328
-		if (--$idx<0) return null;
327
+		while ($idx<$count && $this!==$this->parent->children[$idx]) {
328
+					++$idx;
329
+		}
330
+		if (--$idx<0) {
331
+			return null;
332
+		}
329 333
 		return $this->parent->children[$idx];
330 334
 	}
331 335
 
@@ -354,12 +358,17 @@  discard block
 block discarded – undo
354 358
 	// get dom node's inner html
355 359
 	function innertext()
356 360
 	{
357
-		if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
358
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
361
+		if (isset($this->_[HDOM_INFO_INNER])) {
362
+			return $this->_[HDOM_INFO_INNER];
363
+		}
364
+		if (isset($this->_[HDOM_INFO_TEXT])) {
365
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
366
+		}
359 367
 
360 368
 		$ret = '';
361
-		foreach ($this->nodes as $n)
362
-			$ret .= $n->outertext();
369
+		foreach ($this->nodes as $n) {
370
+					$ret .= $n->outertext();
371
+		}
363 372
 		return $ret;
364 373
 	}
365 374
 
@@ -380,7 +389,9 @@  discard block
 block discarded – undo
380 389
 			$debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
381 390
 		}
382 391
 
383
-		if ($this->tag==='root') return $this->innertext();
392
+		if ($this->tag==='root') {
393
+			return $this->innertext();
394
+		}
384 395
 
385 396
 		// trigger callback
386 397
 		if ($this->dom && $this->dom->callback!==null)
@@ -388,8 +399,12 @@  discard block
 block discarded – undo
388 399
 			call_user_func_array($this->dom->callback, array($this));
389 400
 		}
390 401
 
391
-		if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER];
392
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
402
+		if (isset($this->_[HDOM_INFO_OUTER])) {
403
+			return $this->_[HDOM_INFO_OUTER];
404
+		}
405
+		if (isset($this->_[HDOM_INFO_TEXT])) {
406
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
407
+		}
393 408
 
394 409
 		// render begin tag
395 410
 		if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]])
@@ -418,23 +433,30 @@  discard block
 block discarded – undo
418 433
 		}
419 434
 
420 435
 		// render end tag
421
-		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
422
-			$ret .= '</'.$this->tag.'>';
436
+		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) {
437
+					$ret .= '</'.$this->tag.'>';
438
+		}
423 439
 		return $ret;
424 440
 	}
425 441
 
426 442
 	// get dom node's plain text
427 443
 	function text()
428 444
 	{
429
-		if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
445
+		if (isset($this->_[HDOM_INFO_INNER])) {
446
+			return $this->_[HDOM_INFO_INNER];
447
+		}
430 448
 		switch ($this->nodetype)
431 449
 		{
432 450
 			case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
433 451
 			case HDOM_TYPE_COMMENT: return '';
434 452
 			case HDOM_TYPE_UNKNOWN: return '';
435 453
 		}
436
-		if (strcasecmp($this->tag, 'script')===0) return '';
437
-		if (strcasecmp($this->tag, 'style')===0) return '';
454
+		if (strcasecmp($this->tag, 'script')===0) {
455
+			return '';
456
+		}
457
+		if (strcasecmp($this->tag, 'style')===0) {
458
+			return '';
459
+		}
438 460
 
439 461
 		$ret = '';
440 462
 		// In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
@@ -470,7 +492,9 @@  discard block
 block discarded – undo
470 492
 	function makeup()
471 493
 	{
472 494
 		// text, comment, unknown
473
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
495
+		if (isset($this->_[HDOM_INFO_TEXT])) {
496
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
497
+		}
474 498
 
475 499
 		$ret = '<'.$this->tag;
476 500
 		$i = -1;
@@ -480,14 +504,15 @@  discard block
 block discarded – undo
480 504
 			++$i;
481 505
 
482 506
 			// skip removed attribute
483
-			if ($val===null || $val===false)
484
-				continue;
507
+			if ($val===null || $val===false) {
508
+							continue;
509
+			}
485 510
 
486 511
 			$ret .= $this->_[HDOM_INFO_SPACE][$i][0];
487 512
 			//no value attr: nowrap, checked selected...
488
-			if ($val===true)
489
-				$ret .= $key;
490
-			else {
513
+			if ($val===true) {
514
+							$ret .= $key;
515
+			} else {
491 516
 				switch ($this->_[HDOM_INFO_QUOTE][$i])
492 517
 				{
493 518
 					case HDOM_QUOTE_DOUBLE: $quote = '"'; break;
@@ -506,7 +531,9 @@  discard block
 block discarded – undo
506 531
 	function find($selector, $idx=null, $lowercase=false)
507 532
 	{
508 533
 		$selectors = $this->parse_selector($selector);
509
-		if (($count=count($selectors))===0) return array();
534
+		if (($count=count($selectors))===0) {
535
+			return array();
536
+		}
510 537
 		$found_keys = array();
511 538
 
512 539
 		// find each selector
@@ -514,8 +541,12 @@  discard block
 block discarded – undo
514 541
 		{
515 542
 			// The change on the below line was documented on the sourceforge code tracker id 2788009
516 543
 			// used to be: if (($levle=count($selectors[0]))===0) return array();
517
-			if (($levle=count($selectors[$c]))===0) return array();
518
-			if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
544
+			if (($levle=count($selectors[$c]))===0) {
545
+				return array();
546
+			}
547
+			if (!isset($this->_[HDOM_INFO_BEGIN])) {
548
+				return array();
549
+			}
519 550
 
520 551
 			$head = array($this->_[HDOM_INFO_BEGIN]=>1);
521 552
 
@@ -545,12 +576,16 @@  discard block
 block discarded – undo
545 576
 		ksort($found_keys);
546 577
 
547 578
 		$found = array();
548
-		foreach ($found_keys as $k=>$v)
549
-			$found[] = $this->dom->nodes[$k];
579
+		foreach ($found_keys as $k=>$v) {
580
+					$found[] = $this->dom->nodes[$k];
581
+		}
550 582
 
551 583
 		// return nth-element or array
552
-		if (is_null($idx)) return $found;
553
-		else if ($idx<0) $idx = count($found) + $idx;
584
+		if (is_null($idx)) {
585
+			return $found;
586
+		} else if ($idx<0) {
587
+			$idx = count($found) + $idx;
588
+		}
554 589
 		return (isset($found[$idx])) ? $found[$idx] : null;
555 590
 	}
556 591
 
@@ -595,8 +630,9 @@  discard block
 block discarded – undo
595 630
 			$pass = true;
596 631
 
597 632
 			if ($tag==='*' && !$key) {
598
-				if (in_array($node, $this->children, true))
599
-					$ret[$i] = 1;
633
+				if (in_array($node, $this->children, true)) {
634
+									$ret[$i] = 1;
635
+				}
600 636
 				continue;
601 637
 			}
602 638
 
@@ -605,9 +641,13 @@  discard block
 block discarded – undo
605 641
 			// compare key
606 642
 			if ($pass && $key) {
607 643
 				if ($no_key) {
608
-					if (isset($node->attr[$key])) $pass=false;
644
+					if (isset($node->attr[$key])) {
645
+						$pass=false;
646
+					}
609 647
 				} else {
610
-					if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false;
648
+					if (($key != "plaintext") && !isset($node->attr[$key])) {
649
+						$pass=false;
650
+					}
611 651
 				}
612 652
 			}
613 653
 			// compare value
@@ -640,13 +680,19 @@  discard block
 block discarded – undo
640 680
 							} else {
641 681
 								$check = $this->match($exp, $val, $k);
642 682
 							}
643
-							if ($check) break;
683
+							if ($check) {
684
+								break;
685
+							}
644 686
 						}
645 687
 					}
646 688
 				}
647
-				if (!$check) $pass = false;
689
+				if (!$check) {
690
+					$pass = false;
691
+				}
692
+			}
693
+			if ($pass) {
694
+				$ret[$i] = 1;
648 695
 			}
649
-			if ($pass) $ret[$i] = 1;
650 696
 			unset($node);
651 697
 		}
652 698
 		// It's passed by reference so this is actually what this function returns.
@@ -696,9 +742,13 @@  discard block
 block discarded – undo
696 742
 
697 743
 		foreach ($matches as $m) {
698 744
 			$m[0] = trim($m[0]);
699
-			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
745
+			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') {
746
+				continue;
747
+			}
700 748
 			// for browser generated xpath
701
-			if ($m[1]==='tbody') continue;
749
+			if ($m[1]==='tbody') {
750
+				continue;
751
+			}
702 752
 
703 753
 			list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
704 754
 			if (!empty($m[2])) {$key='id'; $val=$m[2];}
@@ -718,8 +768,9 @@  discard block
 block discarded – undo
718 768
 				$result = array();
719 769
 			}
720 770
 		}
721
-		if (count($result)>0)
722
-			$selectors[] = $result;
771
+		if (count($result)>0) {
772
+					$selectors[] = $result;
773
+		}
723 774
 		return $selectors;
724 775
 	}
725 776
 
@@ -748,7 +799,9 @@  discard block
 block discarded – undo
748 799
 		{
749 800
 			case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;
750 801
 			case 'innertext':
751
-				if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value;
802
+				if (isset($this->_[HDOM_INFO_TEXT])) {
803
+					return $this->_[HDOM_INFO_TEXT] = $value;
804
+				}
752 805
 				return $this->_[HDOM_INFO_INNER] = $value;
753 806
 		}
754 807
 		if (!isset($this->attr[$name]))
@@ -772,8 +825,9 @@  discard block
 block discarded – undo
772 825
 	}
773 826
 
774 827
 	function __unset($name) {
775
-		if (isset($this->attr[$name]))
776
-			unset($this->attr[$name]);
828
+		if (isset($this->attr[$name])) {
829
+					unset($this->attr[$name]);
830
+		}
777 831
 	}
778 832
 
779 833
 	// PaperG - Function to convert the text from one character set to another if the two sets are not the same.
@@ -800,8 +854,7 @@  discard block
 block discarded – undo
800 854
 			if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text)))
801 855
 			{
802 856
 				$converted_text = $text;
803
-			}
804
-			else
857
+			} else
805 858
 			{
806 859
 				$converted_text = iconv($sourceCharset, $targetCharset, $text);
807 860
 			}
@@ -839,19 +892,31 @@  discard block
 block discarded – undo
839 892
 			$c=ord($str[$i]);
840 893
 			if($c > 128)
841 894
 			{
842
-				if(($c >= 254)) return false;
843
-				elseif($c >= 252) $bits=6;
844
-				elseif($c >= 248) $bits=5;
845
-				elseif($c >= 240) $bits=4;
846
-				elseif($c >= 224) $bits=3;
847
-				elseif($c >= 192) $bits=2;
848
-				else return false;
849
-				if(($i+$bits) > $len) return false;
895
+				if(($c >= 254)) {
896
+					return false;
897
+				} elseif($c >= 252) {
898
+					$bits=6;
899
+				} elseif($c >= 248) {
900
+					$bits=5;
901
+				} elseif($c >= 240) {
902
+					$bits=4;
903
+				} elseif($c >= 224) {
904
+					$bits=3;
905
+				} elseif($c >= 192) {
906
+					$bits=2;
907
+				} else {
908
+					return false;
909
+				}
910
+				if(($i+$bits) > $len) {
911
+					return false;
912
+				}
850 913
 				while($bits > 1)
851 914
 				{
852 915
 					$i++;
853 916
 					$b=ord($str[$i]);
854
-					if($b < 128 || $b > 191) return false;
917
+					if($b < 128 || $b > 191) {
918
+						return false;
919
+					}
855 920
 					$bits--;
856 921
 				}
857 922
 			}
@@ -1035,8 +1100,7 @@  discard block
 block discarded – undo
1035 1100
 			if (preg_match("/^http:\/\//i",$str) || is_file($str))
1036 1101
 			{
1037 1102
 				$this->load_file($str);
1038
-			}
1039
-			else
1103
+			} else
1040 1104
 			{
1041 1105
 				$this->load($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);
1042 1106
 			}
@@ -1118,7 +1182,9 @@  discard block
 block discarded – undo
1118 1182
 	function save($filepath='')
1119 1183
 	{
1120 1184
 		$ret = $this->root->innertext();
1121
-		if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX);
1185
+		if ($filepath!=='') {
1186
+			file_put_contents($filepath, $ret, LOCK_EX);
1187
+		}
1122 1188
 		return $ret;
1123 1189
 	}
1124 1190
 
@@ -1134,7 +1200,10 @@  discard block
 block discarded – undo
1134 1200
 	{
1135 1201
 		foreach ($this->nodes as $n) {$n->clear(); $n = null;}
1136 1202
 		// This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.
1137
-		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}
1203
+		if (isset($this->children)) {
1204
+			foreach ($this->children as $n) {$n->clear();
1205
+		}
1206
+		$n = null;}
1138 1207
 		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
1139 1208
 		if (isset($this->root)) {$this->root->clear(); unset($this->root);}
1140 1209
 		unset($this->doc);
@@ -1178,7 +1247,9 @@  discard block
 block discarded – undo
1178 1247
 		$this->root->_[HDOM_INFO_BEGIN] = -1;
1179 1248
 		$this->root->nodetype = HDOM_TYPE_ROOT;
1180 1249
 		$this->parent = $this->root;
1181
-		if ($this->size>0) $this->char = $this->doc[0];
1250
+		if ($this->size>0) {
1251
+			$this->char = $this->doc[0];
1252
+		}
1182 1253
 	}
1183 1254
 
1184 1255
 	// parse html content
@@ -1232,8 +1303,7 @@  discard block
 block discarded – undo
1232 1303
 					if ($success)
1233 1304
 					{
1234 1305
 						$charset = $matches[1];
1235
-					}
1236
-					else
1306
+					} else
1237 1307
 					{
1238 1308
 						// If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
1239 1309
 						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
@@ -1296,8 +1366,9 @@  discard block
 block discarded – undo
1296 1366
 			$tag = $this->copy_until_char('>');
1297 1367
 
1298 1368
 			// skip attributes in end tag
1299
-			if (($pos = strpos($tag, ' '))!==false)
1300
-				$tag = substr($tag, 0, $pos);
1369
+			if (($pos = strpos($tag, ' '))!==false) {
1370
+							$tag = substr($tag, 0, $pos);
1371
+			}
1301 1372
 
1302 1373
 			$parent_lower = strtolower($this->parent->tag);
1303 1374
 			$tag_lower = strtolower($tag);
@@ -1309,23 +1380,26 @@  discard block
 block discarded – undo
1309 1380
 					$this->parent->_[HDOM_INFO_END] = 0;
1310 1381
 					$org_parent = $this->parent;
1311 1382
 
1312
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1313
-						$this->parent = $this->parent->parent;
1383
+					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) {
1384
+											$this->parent = $this->parent->parent;
1385
+					}
1314 1386
 
1315 1387
 					if (strtolower($this->parent->tag)!==$tag_lower) {
1316 1388
 						$this->parent = $org_parent; // restore origonal parent
1317
-						if ($this->parent->parent) $this->parent = $this->parent->parent;
1389
+						if ($this->parent->parent) {
1390
+							$this->parent = $this->parent->parent;
1391
+						}
1318 1392
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1319 1393
 						return $this->as_text_node($tag);
1320 1394
 					}
1321
-				}
1322
-				else if (($this->parent->parent) && isset($this->block_tags[$tag_lower]))
1395
+				} else if (($this->parent->parent) && isset($this->block_tags[$tag_lower]))
1323 1396
 				{
1324 1397
 					$this->parent->_[HDOM_INFO_END] = 0;
1325 1398
 					$org_parent = $this->parent;
1326 1399
 
1327
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1328
-						$this->parent = $this->parent->parent;
1400
+					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) {
1401
+											$this->parent = $this->parent->parent;
1402
+					}
1329 1403
 
1330 1404
 					if (strtolower($this->parent->tag)!==$tag_lower)
1331 1405
 					{
@@ -1333,18 +1407,19 @@  discard block
 block discarded – undo
1333 1407
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1334 1408
 						return $this->as_text_node($tag);
1335 1409
 					}
1336
-				}
1337
-				else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1410
+				} else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1338 1411
 				{
1339 1412
 					$this->parent->_[HDOM_INFO_END] = 0;
1340 1413
 					$this->parent = $this->parent->parent;
1414
+				} else {
1415
+									return $this->as_text_node($tag);
1341 1416
 				}
1342
-				else
1343
-					return $this->as_text_node($tag);
1344 1417
 			}
1345 1418
 
1346 1419
 			$this->parent->_[HDOM_INFO_END] = $this->cursor;
1347
-			if ($this->parent->parent) $this->parent = $this->parent->parent;
1420
+			if ($this->parent->parent) {
1421
+				$this->parent = $this->parent->parent;
1422
+			}
1348 1423
 
1349 1424
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1350 1425
 			return true;
@@ -1367,7 +1442,9 @@  discard block
 block discarded – undo
1367 1442
 				$node->nodetype = HDOM_TYPE_UNKNOWN;
1368 1443
 				$node->tag = 'unknown';
1369 1444
 			}
1370
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1445
+			if ($this->char==='>') {
1446
+				$node->_[HDOM_INFO_TEXT].='>';
1447
+			}
1371 1448
 			$this->link_nodes($node, true);
1372 1449
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1373 1450
 			return true;
@@ -1389,7 +1466,9 @@  discard block
 block discarded – undo
1389 1466
 				return true;
1390 1467
 			}
1391 1468
 
1392
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1469
+			if ($this->char==='>') {
1470
+				$node->_[HDOM_INFO_TEXT].='>';
1471
+			}
1393 1472
 			$this->link_nodes($node, false);
1394 1473
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1395 1474
 			return true;
@@ -1455,22 +1534,26 @@  discard block
 block discarded – undo
1455 1534
 			if ($name!=='/' && $name!=='') {
1456 1535
 				$space[1] = $this->copy_skip($this->token_blank);
1457 1536
 				$name = $this->restore_noise($name);
1458
-				if ($this->lowercase) $name = strtolower($name);
1537
+				if ($this->lowercase) {
1538
+					$name = strtolower($name);
1539
+				}
1459 1540
 				if ($this->char==='=') {
1460 1541
 					$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1461 1542
 					$this->parse_attr($node, $name, $space);
1462
-				}
1463
-				else {
1543
+				} else {
1464 1544
 					//no value attr: nowrap, checked selected...
1465 1545
 					$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1466 1546
 					$node->attr[$name] = true;
1467
-					if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
1547
+					if ($this->char!='>') {
1548
+						$this->char = $this->doc[--$this->pos];
1549
+					}
1550
+					// prev
1468 1551
 				}
1469 1552
 				$node->_[HDOM_INFO_SPACE][] = $space;
1470 1553
 				$space = array($this->copy_skip($this->token_blank), '', '');
1554
+			} else {
1555
+							break;
1471 1556
 			}
1472
-			else
1473
-				break;
1474 1557
 		} while ($this->char!=='>' && $this->char!=='/');
1475 1558
 
1476 1559
 		$this->link_nodes($node, true);
@@ -1481,11 +1564,12 @@  discard block
 block discarded – undo
1481 1564
 		{
1482 1565
 			$node->_[HDOM_INFO_ENDSPACE] .= '/';
1483 1566
 			$node->_[HDOM_INFO_END] = 0;
1484
-		}
1485
-		else
1567
+		} else
1486 1568
 		{
1487 1569
 			// reset parent
1488
-			if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
1570
+			if (!isset($this->self_closing_tags[strtolower($node->tag)])) {
1571
+				$this->parent = $node;
1572
+			}
1489 1573
 		}
1490 1574
 		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1491 1575
 
@@ -1571,7 +1655,9 @@  discard block
 block discarded – undo
1571 1655
 		$len = strspn($this->doc, $chars, $pos);
1572 1656
 		$this->pos += $len;
1573 1657
 		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1574
-		if ($len===0) return '';
1658
+		if ($len===0) {
1659
+			return '';
1660
+		}
1575 1661
 		return substr($this->doc, $pos, $len);
1576 1662
 	}
1577 1663
 
@@ -1586,7 +1672,9 @@  discard block
 block discarded – undo
1586 1672
 
1587 1673
 	protected function copy_until_char($char)
1588 1674
 	{
1589
-		if ($this->char===null) return '';
1675
+		if ($this->char===null) {
1676
+			return '';
1677
+		}
1590 1678
 
1591 1679
 		if (($pos = strpos($this->doc, $char, $this->pos))===false) {
1592 1680
 			$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
@@ -1595,7 +1683,9 @@  discard block
 block discarded – undo
1595 1683
 			return $ret;
1596 1684
 		}
1597 1685
 
1598
-		if ($pos===$this->pos) return '';
1686
+		if ($pos===$this->pos) {
1687
+			return '';
1688
+		}
1599 1689
 		$pos_old = $this->pos;
1600 1690
 		$this->char = $this->doc[$pos];
1601 1691
 		$this->pos = $pos;
@@ -1604,7 +1694,9 @@  discard block
 block discarded – undo
1604 1694
 
1605 1695
 	protected function copy_until_char_escape($char)
1606 1696
 	{
1607
-		if ($this->char===null) return '';
1697
+		if ($this->char===null) {
1698
+			return '';
1699
+		}
1608 1700
 
1609 1701
 		$start = $this->pos;
1610 1702
 		while (1)
@@ -1617,7 +1709,9 @@  discard block
 block discarded – undo
1617 1709
 				return $ret;
1618 1710
 			}
1619 1711
 
1620
-			if ($pos===$this->pos) return '';
1712
+			if ($pos===$this->pos) {
1713
+				return '';
1714
+			}
1621 1715
 
1622 1716
 			if ($this->doc[$pos-1]==='\\') {
1623 1717
 				$start = $pos+1;
@@ -1674,14 +1768,12 @@  discard block
 block discarded – undo
1674 1768
 				if (isset($this->noise[$key]))
1675 1769
 				{
1676 1770
 					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16);
1677
-				}
1678
-				else
1771
+				} else
1679 1772
 				{
1680 1773
 					// do this to prevent an infinite loop.
1681 1774
 					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16);
1682 1775
 				}
1683
-			}
1684
-			else
1776
+			} else
1685 1777
 			{
1686 1778
 				// There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
1687 1779
 				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11);
Please login to merge, or discard this patch.
date-statistics-manufacturer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING);
8
-$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING);
8
+$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort);
9 9
 
10 10
 if (!empty($spotter_array))
11 11
 {
12
-	$title = sprintf(_("Most Common Aircraft Manufacturer on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
12
+	$title = sprintf(_("Most Common Aircraft Manufacturer on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
13 13
 
14 14
 	require_once('header.php');
15 15
 	print '<div class="select-item">';
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>';
28 28
 	print '<br />';
29 29
 	print '<div class="info column">';
30
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
30
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
31 31
 	print '</div>';
32 32
 
33 33
 	include('date-sub-menu.php');
34 34
 	print '<div class="column">';
35 35
 	print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
36
-	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
36
+	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
37 37
 
38 38
 	$manufacturers_array = $Spotter->countAllAircraftManufacturerByDate($date);
39 39
 	if (!empty($manufacturers_array))
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		print '</thead>';
49 49
 		print '<tbody>';
50 50
 		$i = 1;
51
-		foreach($manufacturers_array as $manufacturer_item)
51
+		foreach ($manufacturers_array as $manufacturer_item)
52 52
 		{
53 53
 			print '<tr>';
54 54
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.