Completed
Push — master ( 6eadb9...5e27ff )
by Yannick
09:33
created
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 $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 $e->getMessage()."\n";
148
+				if (isset($globalDebug) && $globalDebug) {
149
+					echo $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   +1318 added lines, -1318 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Executes the SQL statements to get the spotter information
91
-	*
92
-	* @param String $query the SQL query
93
-	* @param Array $params parameter of the query
94
-	* @param String $limitQuery the limit query
95
-	* @return Array the spotter information
96
-	*
97
-	*/
90
+	 * Executes the SQL statements to get the spotter information
91
+	 *
92
+	 * @param String $query the SQL query
93
+	 * @param Array $params parameter of the query
94
+	 * @param String $limitQuery the limit query
95
+	 * @return Array the spotter information
96
+	 *
97
+	 */
98 98
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
99 99
 	{
100 100
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
259 259
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
260 260
 					} else $temp_array['aircraft_shadow'] = 'default.png';
261
-                                } else {
262
-                            		$temp_array['aircraft_shadow'] = 'default.png';
261
+								} else {
262
+									$temp_array['aircraft_shadow'] = 'default.png';
263 263
 					$temp_array['aircraft_name'] = 'N/A';
264 264
 					$temp_array['aircraft_manufacturer'] = 'N/A';
265
-                            	}
265
+								}
266 266
 			}
267 267
 			$fromsource = NULL;
268 268
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
 	
459 459
 	
460 460
 	/**
461
-	* Gets all the spotter information
462
-	*
463
-	* @return Array the spotter information
464
-	*
465
-	*/
461
+	 * Gets all the spotter information
462
+	 *
463
+	 * @return Array the spotter information
464
+	 *
465
+	 */
466 466
 	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())
467 467
 	{
468 468
 		global $globalTimezone, $globalDBdriver;
@@ -809,11 +809,11 @@  discard block
 block discarded – undo
809 809
 	
810 810
 	
811 811
 	/**
812
-	* Gets all the spotter information based on the latest data entry
813
-	*
814
-	* @return Array the spotter information
815
-	*
816
-	*/
812
+	 * Gets all the spotter information based on the latest data entry
813
+	 *
814
+	 * @return Array the spotter information
815
+	 *
816
+	 */
817 817
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
818 818
 	{
819 819
 		global $global_query;
@@ -852,12 +852,12 @@  discard block
 block discarded – undo
852 852
 	}
853 853
     
854 854
     
855
-    /**
856
-	* Gets all the spotter information based on a user's latitude and longitude
857
-	*
858
-	* @return Array the spotter information
859
-	*
860
-	*/
855
+	/**
856
+	 * Gets all the spotter information based on a user's latitude and longitude
857
+	 *
858
+	 * @return Array the spotter information
859
+	 *
860
+	 */
861 861
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
862 862
 	{
863 863
 		date_default_timezone_set('UTC');
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 				return false;
886 886
 			}
887 887
 		}
888
-    		$additional_query = '';
888
+			$additional_query = '';
889 889
 		if ($interval != "")
890 890
 		{
891 891
 			if (!is_string($interval))
@@ -925,12 +925,12 @@  discard block
 block discarded – undo
925 925
 	}
926 926
     
927 927
     
928
-    /**
929
-	* Gets all the spotter information sorted by the newest aircraft type
930
-	*
931
-	* @return Array the spotter information
932
-	*
933
-	*/
928
+	/**
929
+	 * Gets all the spotter information sorted by the newest aircraft type
930
+	 *
931
+	 * @return Array the spotter information
932
+	 *
933
+	 */
934 934
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
935 935
 	{
936 936
 		global $global_query;
@@ -971,11 +971,11 @@  discard block
 block discarded – undo
971 971
     
972 972
     
973 973
 	/**
974
-	* Gets all the spotter information sorted by the newest aircraft registration
975
-	*
976
-	* @return Array the spotter information
977
-	*
978
-	*/
974
+	 * Gets all the spotter information sorted by the newest aircraft registration
975
+	 *
976
+	 * @return Array the spotter information
977
+	 *
978
+	 */
979 979
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
980 980
 	{
981 981
 		global $global_query;
@@ -1015,11 +1015,11 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
 
1017 1017
 	/**
1018
-	* Gets all the spotter information sorted by the newest airline
1019
-	*
1020
-	* @return Array the spotter information
1021
-	*
1022
-	*/
1018
+	 * Gets all the spotter information sorted by the newest airline
1019
+	 *
1020
+	 * @return Array the spotter information
1021
+	 *
1022
+	 */
1023 1023
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1024 1024
 	{
1025 1025
 		global $global_query;
@@ -1058,12 +1058,12 @@  discard block
 block discarded – undo
1058 1058
 	}
1059 1059
     
1060 1060
     
1061
-    /**
1062
-	* Gets all the spotter information sorted by the newest departure airport
1063
-	*
1064
-	* @return Array the spotter information
1065
-	*
1066
-	*/
1061
+	/**
1062
+	 * Gets all the spotter information sorted by the newest departure airport
1063
+	 *
1064
+	 * @return Array the spotter information
1065
+	 *
1066
+	 */
1067 1067
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1068 1068
 	{
1069 1069
 		global $global_query;
@@ -1105,11 +1105,11 @@  discard block
 block discarded – undo
1105 1105
 
1106 1106
 
1107 1107
 	/**
1108
-	* Gets all the spotter information sorted by the newest arrival airport
1109
-	*
1110
-	* @return Array the spotter information
1111
-	*
1112
-	*/
1108
+	 * Gets all the spotter information sorted by the newest arrival airport
1109
+	 *
1110
+	 * @return Array the spotter information
1111
+	 *
1112
+	 */
1113 1113
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1114 1114
 	{
1115 1115
 		global $global_query;
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
 	
1149 1149
 
1150 1150
 	/**
1151
-	* Gets all the spotter information based on the spotter id
1152
-	*
1153
-	* @return Array the spotter information
1154
-	*
1155
-	*/
1151
+	 * Gets all the spotter information based on the spotter id
1152
+	 *
1153
+	 * @return Array the spotter information
1154
+	 *
1155
+	 */
1156 1156
 	public function getSpotterDataByID($id = '')
1157 1157
 	{
1158 1158
 		global $global_query;
@@ -1174,11 +1174,11 @@  discard block
 block discarded – undo
1174 1174
 	
1175 1175
 	
1176 1176
 	/**
1177
-	* Gets all the spotter information based on the callsign
1178
-	*
1179
-	* @return Array the spotter information
1180
-	*
1181
-	*/
1177
+	 * Gets all the spotter information based on the callsign
1178
+	 *
1179
+	 * @return Array the spotter information
1180
+	 *
1181
+	 */
1182 1182
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1183 1183
 	{
1184 1184
 		global $global_query;
@@ -1231,11 +1231,11 @@  discard block
 block discarded – undo
1231 1231
 	
1232 1232
 	
1233 1233
 	/**
1234
-	* Gets all the spotter information based on the aircraft type
1235
-	*
1236
-	* @return Array the spotter information
1237
-	*
1238
-	*/
1234
+	 * Gets all the spotter information based on the aircraft type
1235
+	 *
1236
+	 * @return Array the spotter information
1237
+	 *
1238
+	 */
1239 1239
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1240 1240
 	{
1241 1241
 		global $global_query;
@@ -1289,11 +1289,11 @@  discard block
 block discarded – undo
1289 1289
 	
1290 1290
 	
1291 1291
 	/**
1292
-	* Gets all the spotter information based on the aircraft registration
1293
-	*
1294
-	* @return Array the spotter information
1295
-	*
1296
-	*/
1292
+	 * Gets all the spotter information based on the aircraft registration
1293
+	 *
1294
+	 * @return Array the spotter information
1295
+	 *
1296
+	 */
1297 1297
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1298 1298
 	{
1299 1299
 		global $global_query;
@@ -1350,11 +1350,11 @@  discard block
 block discarded – undo
1350 1350
 	
1351 1351
 	
1352 1352
 	/**
1353
-	* Gets all the spotter information based on the airline
1354
-	*
1355
-	* @return Array the spotter information
1356
-	*
1357
-	*/
1353
+	 * Gets all the spotter information based on the airline
1354
+	 *
1355
+	 * @return Array the spotter information
1356
+	 *
1357
+	 */
1358 1358
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1359 1359
 	{
1360 1360
 		global $global_query;
@@ -1407,11 +1407,11 @@  discard block
 block discarded – undo
1407 1407
 	
1408 1408
 	
1409 1409
 	/**
1410
-	* Gets all the spotter information based on the airport
1411
-	*
1412
-	* @return Array the spotter information
1413
-	*
1414
-	*/
1410
+	 * Gets all the spotter information based on the airport
1411
+	 *
1412
+	 * @return Array the spotter information
1413
+	 *
1414
+	 */
1415 1415
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1416 1416
 	{
1417 1417
 		global $global_query;
@@ -1465,11 +1465,11 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
 
1467 1467
 	/**
1468
-	* Gets all the spotter information based on the date
1469
-	*
1470
-	* @return Array the spotter information
1471
-	*
1472
-	*/
1468
+	 * Gets all the spotter information based on the date
1469
+	 *
1470
+	 * @return Array the spotter information
1471
+	 *
1472
+	 */
1473 1473
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1474 1474
 	{
1475 1475
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1533,11 +1533,11 @@  discard block
 block discarded – undo
1533 1533
 
1534 1534
 
1535 1535
 	/**
1536
-	* Gets all the spotter information based on the country name
1537
-	*
1538
-	* @return Array the spotter information
1539
-	*
1540
-	*/
1536
+	 * Gets all the spotter information based on the country name
1537
+	 *
1538
+	 * @return Array the spotter information
1539
+	 *
1540
+	 */
1541 1541
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1542 1542
 	{
1543 1543
 		global $global_query;
@@ -1591,11 +1591,11 @@  discard block
 block discarded – undo
1591 1591
 	
1592 1592
 	
1593 1593
 	/**
1594
-	* Gets all the spotter information based on the manufacturer name
1595
-	*
1596
-	* @return Array the spotter information
1597
-	*
1598
-	*/
1594
+	 * Gets all the spotter information based on the manufacturer name
1595
+	 *
1596
+	 * @return Array the spotter information
1597
+	 *
1598
+	 */
1599 1599
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1600 1600
 	{
1601 1601
 		global $global_query;
@@ -1651,13 +1651,13 @@  discard block
 block discarded – undo
1651 1651
   
1652 1652
   
1653 1653
 	/**
1654
-	* Gets a list of all aircraft that take a route
1655
-	*
1656
-	* @param String $departure_airport_icao ICAO code of departure airport
1657
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1658
-	* @return Array the spotter information
1659
-	*
1660
-	*/
1654
+	 * Gets a list of all aircraft that take a route
1655
+	 *
1656
+	 * @param String $departure_airport_icao ICAO code of departure airport
1657
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1658
+	 * @return Array the spotter information
1659
+	 *
1660
+	 */
1661 1661
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1662 1662
 	{
1663 1663
 		global $global_query;
@@ -1726,11 +1726,11 @@  discard block
 block discarded – undo
1726 1726
 	
1727 1727
 	
1728 1728
 	/**
1729
-	* Gets all the spotter information based on the special column in the table
1730
-	*
1731
-	* @return Array the spotter information
1732
-	*
1733
-	*/
1729
+	 * Gets all the spotter information based on the special column in the table
1730
+	 *
1731
+	 * @return Array the spotter information
1732
+	 *
1733
+	 */
1734 1734
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1735 1735
 	{
1736 1736
 		global $global_query;
@@ -1769,11 +1769,11 @@  discard block
 block discarded – undo
1769 1769
 	}
1770 1770
 
1771 1771
 	/**
1772
-	* Gets all the highlight based on a aircraft registration
1773
-	*
1774
-	* @return String the highlight text
1775
-	*
1776
-	*/
1772
+	 * Gets all the highlight based on a aircraft registration
1773
+	 *
1774
+	 * @return String the highlight text
1775
+	 *
1776
+	 */
1777 1777
 	public function getHighlightByRegistration($registration,$filter = array())
1778 1778
 	{
1779 1779
 		global $global_query;
@@ -1795,13 +1795,13 @@  discard block
 block discarded – undo
1795 1795
 
1796 1796
 	
1797 1797
 	/**
1798
-	* Gets the squawk usage from squawk code
1799
-	*
1800
-	* @param String $squawk squawk code
1801
-	* @param String $country country
1802
-	* @return String usage
1803
-	*
1804
-	*/
1798
+	 * Gets the squawk usage from squawk code
1799
+	 *
1800
+	 * @param String $squawk squawk code
1801
+	 * @param String $country country
1802
+	 * @return String usage
1803
+	 *
1804
+	 */
1805 1805
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1806 1806
 	{
1807 1807
 		
@@ -1822,12 +1822,12 @@  discard block
 block discarded – undo
1822 1822
 	}
1823 1823
 
1824 1824
 	/**
1825
-	* Gets the airport icao from the iata
1826
-	*
1827
-	* @param String $airport_iata the iata code of the airport
1828
-	* @return String airport iata
1829
-	*
1830
-	*/
1825
+	 * Gets the airport icao from the iata
1826
+	 *
1827
+	 * @param String $airport_iata the iata code of the airport
1828
+	 * @return String airport iata
1829
+	 *
1830
+	 */
1831 1831
 	public function getAirportIcao($airport_iata = '')
1832 1832
 	{
1833 1833
 		
@@ -1847,14 +1847,14 @@  discard block
 block discarded – undo
1847 1847
 	}
1848 1848
 
1849 1849
 	/**
1850
-	* Gets the airport distance
1851
-	*
1852
-	* @param String $airport_icao the icao code of the airport
1853
-	* @param Float $latitude the latitude
1854
-	* @param Float $longitude the longitude
1855
-	* @return Float distance to the airport
1856
-	*
1857
-	*/
1850
+	 * Gets the airport distance
1851
+	 *
1852
+	 * @param String $airport_icao the icao code of the airport
1853
+	 * @param Float $latitude the latitude
1854
+	 * @param Float $longitude the longitude
1855
+	 * @return Float distance to the airport
1856
+	 *
1857
+	 */
1858 1858
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1859 1859
 	{
1860 1860
 		
@@ -1875,12 +1875,12 @@  discard block
 block discarded – undo
1875 1875
 	}
1876 1876
 	
1877 1877
 	/**
1878
-	* Gets the airport info based on the icao
1879
-	*
1880
-	* @param String $airport the icao code of the airport
1881
-	* @return Array airport information
1882
-	*
1883
-	*/
1878
+	 * Gets the airport info based on the icao
1879
+	 *
1880
+	 * @param String $airport the icao code of the airport
1881
+	 * @return Array airport information
1882
+	 *
1883
+	 */
1884 1884
 	public function getAllAirportInfo($airport = '')
1885 1885
 	{
1886 1886
 		
@@ -1926,12 +1926,12 @@  discard block
 block discarded – undo
1926 1926
 	}
1927 1927
 	
1928 1928
 	/**
1929
-	* Gets the airport info based on the country
1930
-	*
1931
-	* @param Array $countries Airports countries
1932
-	* @return Array airport information
1933
-	*
1934
-	*/
1929
+	 * Gets the airport info based on the country
1930
+	 *
1931
+	 * @param Array $countries Airports countries
1932
+	 * @return Array airport information
1933
+	 *
1934
+	 */
1935 1935
 	public function getAllAirportInfobyCountry($countries)
1936 1936
 	{
1937 1937
 		$lst_countries = '';
@@ -1969,12 +1969,12 @@  discard block
 block discarded – undo
1969 1969
 	}
1970 1970
 	
1971 1971
 	/**
1972
-	* Gets airports info based on the coord
1973
-	*
1974
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1975
-	* @return Array airport information
1976
-	*
1977
-	*/
1972
+	 * Gets airports info based on the coord
1973
+	 *
1974
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1975
+	 * @return Array airport information
1976
+	 *
1977
+	 */
1978 1978
 	public function getAllAirportInfobyCoord($coord)
1979 1979
 	{
1980 1980
 		global $globalDBdriver;
@@ -2005,12 +2005,12 @@  discard block
 block discarded – undo
2005 2005
 	}
2006 2006
 
2007 2007
 	/**
2008
-	* Gets waypoints info based on the coord
2009
-	*
2010
-	* @param Array $coord waypoints coord
2011
-	* @return Array airport information
2012
-	*
2013
-	*/
2008
+	 * Gets waypoints info based on the coord
2009
+	 *
2010
+	 * @param Array $coord waypoints coord
2011
+	 * @return Array airport information
2012
+	 *
2013
+	 */
2014 2014
 	public function getAllWaypointsInfobyCoord($coord)
2015 2015
 	{
2016 2016
 		if (is_array($coord)) {
@@ -2044,12 +2044,12 @@  discard block
 block discarded – undo
2044 2044
 	
2045 2045
 	
2046 2046
 	/**
2047
-	* Gets the airline info based on the icao code or iata code
2048
-	*
2049
-	* @param String $airline_icao the iata code of the airport
2050
-	* @return Array airport information
2051
-	*
2052
-	*/
2047
+	 * Gets the airline info based on the icao code or iata code
2048
+	 *
2049
+	 * @param String $airline_icao the iata code of the airport
2050
+	 * @return Array airport information
2051
+	 *
2052
+	 */
2053 2053
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2054 2054
 	{
2055 2055
 		global $globalUseRealAirlines;
@@ -2080,7 +2080,7 @@  discard block
 block discarded – undo
2080 2080
 			} else {
2081 2081
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2082 2082
 			}
2083
-                        /*
2083
+						/*
2084 2084
 			$airline_array = array();
2085 2085
 			$temp_array = array();
2086 2086
 		
@@ -2110,12 +2110,12 @@  discard block
 block discarded – undo
2110 2110
 	}
2111 2111
 	
2112 2112
 	/**
2113
-	* Gets the airline info based on the airline name
2114
-	*
2115
-	* @param String $airline_name the name of the airline
2116
-	* @return Array airline information
2117
-	*
2118
-	*/
2113
+	 * Gets the airline info based on the airline name
2114
+	 *
2115
+	 * @param String $airline_name the name of the airline
2116
+	 * @return Array airline information
2117
+	 *
2118
+	 */
2119 2119
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2120 2120
 	{
2121 2121
 		global $globalUseRealAirlines;
@@ -2143,12 +2143,12 @@  discard block
 block discarded – undo
2143 2143
 	
2144 2144
 	
2145 2145
 	/**
2146
-	* Gets the aircraft info based on the aircraft type
2147
-	*
2148
-	* @param String $aircraft_type the aircraft type
2149
-	* @return Array aircraft information
2150
-	*
2151
-	*/
2146
+	 * Gets the aircraft info based on the aircraft type
2147
+	 *
2148
+	 * @param String $aircraft_type the aircraft type
2149
+	 * @return Array aircraft information
2150
+	 *
2151
+	 */
2152 2152
 	public function getAllAircraftInfo($aircraft_type)
2153 2153
 	{
2154 2154
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2180,12 +2180,12 @@  discard block
 block discarded – undo
2180 2180
 	}
2181 2181
 
2182 2182
 	/**
2183
-	* Gets the aircraft icao based on the aircraft name/type
2184
-	*
2185
-	* @param String $aircraft_type the aircraft type
2186
-	* @return String aircraft information
2187
-	*
2188
-	*/
2183
+	 * Gets the aircraft icao based on the aircraft name/type
2184
+	 *
2185
+	 * @param String $aircraft_type the aircraft type
2186
+	 * @return String aircraft information
2187
+	 *
2188
+	 */
2189 2189
 	public function getAircraftIcao($aircraft_type)
2190 2190
 	{
2191 2191
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2210,12 +2210,12 @@  discard block
 block discarded – undo
2210 2210
 	}
2211 2211
 	
2212 2212
 	/**
2213
-	* Gets the aircraft info based on the aircraft modes
2214
-	*
2215
-	* @param String $aircraft_modes the aircraft ident (hex)
2216
-	* @return String aircraft type
2217
-	*
2218
-	*/
2213
+	 * Gets the aircraft info based on the aircraft modes
2214
+	 *
2215
+	 * @param String $aircraft_modes the aircraft ident (hex)
2216
+	 * @return String aircraft type
2217
+	 *
2218
+	 */
2219 2219
 	public function getAllAircraftType($aircraft_modes)
2220 2220
 	{
2221 2221
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2233,12 +2233,12 @@  discard block
 block discarded – undo
2233 2233
 	}
2234 2234
 
2235 2235
 	/**
2236
-	* Gets the aircraft info based on the aircraft registration
2237
-	*
2238
-	* @param String $registration the aircraft registration
2239
-	* @return String aircraft type
2240
-	*
2241
-	*/
2236
+	 * Gets the aircraft info based on the aircraft registration
2237
+	 *
2238
+	 * @param String $registration the aircraft registration
2239
+	 * @return String aircraft type
2240
+	 *
2241
+	 */
2242 2242
 	public function getAllAircraftTypeByRegistration($registration)
2243 2243
 	{
2244 2244
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2256,12 +2256,12 @@  discard block
 block discarded – undo
2256 2256
 	}
2257 2257
 
2258 2258
 	/**
2259
-	* Gets correct aircraft operator corde
2260
-	*
2261
-	* @param String $operator the aircraft operator code (callsign)
2262
-	* @return String aircraft operator code
2263
-	*
2264
-	*/
2259
+	 * Gets correct aircraft operator corde
2260
+	 *
2261
+	 * @param String $operator the aircraft operator code (callsign)
2262
+	 * @return String aircraft operator code
2263
+	 *
2264
+	 */
2265 2265
 	public function getOperator($operator)
2266 2266
 	{
2267 2267
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2278,16 +2278,16 @@  discard block
 block discarded – undo
2278 2278
 	}
2279 2279
 
2280 2280
 	/**
2281
-	* Gets the aircraft route based on the aircraft callsign
2282
-	*
2283
-	* @param String $callsign the aircraft callsign
2284
-	* @return Array aircraft type
2285
-	*
2286
-	*/
2281
+	 * Gets the aircraft route based on the aircraft callsign
2282
+	 *
2283
+	 * @param String $callsign the aircraft callsign
2284
+	 * @return Array aircraft type
2285
+	 *
2286
+	 */
2287 2287
 	public function getRouteInfo($callsign)
2288 2288
 	{
2289 2289
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2290
-                if ($callsign == '') return array();
2290
+				if ($callsign == '') return array();
2291 2291
 		$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";
2292 2292
 		
2293 2293
 		$sth = $this->db->prepare($query);
@@ -2301,12 +2301,12 @@  discard block
 block discarded – undo
2301 2301
 	}
2302 2302
 	
2303 2303
 	/**
2304
-	* Gets the aircraft info based on the aircraft registration
2305
-	*
2306
-	* @param String $registration the aircraft registration
2307
-	* @return Array aircraft information
2308
-	*
2309
-	*/
2304
+	 * Gets the aircraft info based on the aircraft registration
2305
+	 *
2306
+	 * @param String $registration the aircraft registration
2307
+	 * @return Array aircraft information
2308
+	 *
2309
+	 */
2310 2310
 	public function getAircraftInfoByRegistration($registration)
2311 2311
 	{
2312 2312
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2333,12 +2333,12 @@  discard block
 block discarded – undo
2333 2333
 	}
2334 2334
 	
2335 2335
 	/**
2336
-	* Gets the aircraft owner & base based on the aircraft registration
2337
-	*
2338
-	* @param String $registration the aircraft registration
2339
-	* @return Array aircraft information
2340
-	*
2341
-	*/
2336
+	 * Gets the aircraft owner & base based on the aircraft registration
2337
+	 *
2338
+	 * @param String $registration the aircraft registration
2339
+	 * @return Array aircraft information
2340
+	 *
2341
+	 */
2342 2342
 	public function getAircraftOwnerByRegistration($registration)
2343 2343
 	{
2344 2344
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2355,11 +2355,11 @@  discard block
 block discarded – undo
2355 2355
 	
2356 2356
   
2357 2357
   /**
2358
-	* Gets all flights (but with only little info)
2359
-	*
2360
-	* @return Array basic flight information
2361
-	*
2362
-	*/
2358
+   * Gets all flights (but with only little info)
2359
+   *
2360
+   * @return Array basic flight information
2361
+   *
2362
+   */
2363 2363
 	public function getAllFlightsforSitemap()
2364 2364
 	{
2365 2365
 		//$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 ";
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 		
2368 2368
 		$sth = $this->db->prepare($query);
2369 2369
 		$sth->execute();
2370
-                  /*
2370
+				  /*
2371 2371
 		$flight_array = array();
2372 2372
 		$temp_array = array();
2373 2373
 		
@@ -2389,11 +2389,11 @@  discard block
 block discarded – undo
2389 2389
 	}
2390 2390
   
2391 2391
 	/**
2392
-	* Gets a list of all aircraft manufacturers
2393
-	*
2394
-	* @return Array list of aircraft types
2395
-	*
2396
-	*/
2392
+	 * Gets a list of all aircraft manufacturers
2393
+	 *
2394
+	 * @return Array list of aircraft types
2395
+	 *
2396
+	 */
2397 2397
 	public function getAllManufacturers()
2398 2398
 	{
2399 2399
 		/*
@@ -2422,11 +2422,11 @@  discard block
 block discarded – undo
2422 2422
   
2423 2423
   
2424 2424
   /**
2425
-	* Gets a list of all aircraft types
2426
-	*
2427
-	* @return Array list of aircraft types
2428
-	*
2429
-	*/
2425
+   * Gets a list of all aircraft types
2426
+   *
2427
+   * @return Array list of aircraft types
2428
+   *
2429
+   */
2430 2430
 	public function getAllAircraftTypes($filters = array())
2431 2431
 	{
2432 2432
 		/*
@@ -2461,11 +2461,11 @@  discard block
 block discarded – undo
2461 2461
 	
2462 2462
 	
2463 2463
 	/**
2464
-	* Gets a list of all aircraft registrations
2465
-	*
2466
-	* @return Array list of aircraft registrations
2467
-	*
2468
-	*/
2464
+	 * Gets a list of all aircraft registrations
2465
+	 *
2466
+	 * @return Array list of aircraft registrations
2467
+	 *
2468
+	 */
2469 2469
 	public function getAllAircraftRegistrations($filters = array())
2470 2470
 	{
2471 2471
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2490,12 +2490,12 @@  discard block
 block discarded – undo
2490 2490
 	}
2491 2491
 
2492 2492
 	/**
2493
-	* Gets all source name
2494
-	*
2495
-	* @param String type format of source
2496
-	* @return Array list of source name
2497
-	*
2498
-	*/
2493
+	 * Gets all source name
2494
+	 *
2495
+	 * @param String type format of source
2496
+	 * @return Array list of source name
2497
+	 *
2498
+	 */
2499 2499
 	public function getAllSourceName($type = '',$filters = array())
2500 2500
 	{
2501 2501
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2526,11 +2526,11 @@  discard block
 block discarded – undo
2526 2526
 
2527 2527
 
2528 2528
 	/**
2529
-	* Gets a list of all airline names
2530
-	*
2531
-	* @return Array list of airline names
2532
-	*
2533
-	*/
2529
+	 * Gets a list of all airline names
2530
+	 *
2531
+	 * @return Array list of airline names
2532
+	 *
2533
+	 */
2534 2534
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2535 2535
 	{
2536 2536
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2579,11 +2579,11 @@  discard block
 block discarded – undo
2579 2579
 	}
2580 2580
 	
2581 2581
 	/**
2582
-	* Gets a list of all alliance names
2583
-	*
2584
-	* @return Array list of alliance names
2585
-	*
2586
-	*/
2582
+	 * Gets a list of all alliance names
2583
+	 *
2584
+	 * @return Array list of alliance names
2585
+	 *
2586
+	 */
2587 2587
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2588 2588
 	{
2589 2589
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2608,11 +2608,11 @@  discard block
 block discarded – undo
2608 2608
 	}
2609 2609
 	
2610 2610
 	/**
2611
-	* Gets a list of all airline countries
2612
-	*
2613
-	* @return Array list of airline countries
2614
-	*
2615
-	*/
2611
+	 * Gets a list of all airline countries
2612
+	 *
2613
+	 * @return Array list of airline countries
2614
+	 *
2615
+	 */
2616 2616
 	public function getAllAirlineCountries($filters = array())
2617 2617
 	{
2618 2618
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2640,11 +2640,11 @@  discard block
 block discarded – undo
2640 2640
 	
2641 2641
 	
2642 2642
 	/**
2643
-	* Gets a list of all departure & arrival names
2644
-	*
2645
-	* @return Array list of airport names
2646
-	*
2647
-	*/
2643
+	 * Gets a list of all departure & arrival names
2644
+	 *
2645
+	 * @return Array list of airport names
2646
+	 *
2647
+	 */
2648 2648
 	public function getAllAirportNames($filters = array())
2649 2649
 	{
2650 2650
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2693,11 +2693,11 @@  discard block
 block discarded – undo
2693 2693
 	
2694 2694
 	
2695 2695
 	/**
2696
-	* Gets a list of all departure & arrival airport countries
2697
-	*
2698
-	* @return Array list of airport countries
2699
-	*
2700
-	*/
2696
+	 * Gets a list of all departure & arrival airport countries
2697
+	 *
2698
+	 * @return Array list of airport countries
2699
+	 *
2700
+	 */
2701 2701
 	public function getAllAirportCountries($filters = array())
2702 2702
 	{
2703 2703
 		$airport_array = array();
@@ -2745,11 +2745,11 @@  discard block
 block discarded – undo
2745 2745
 	
2746 2746
 	
2747 2747
 	/**
2748
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2749
-	*
2750
-	* @return Array list of countries
2751
-	*
2752
-	*/
2748
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2749
+	 *
2750
+	 * @return Array list of countries
2751
+	 *
2752
+	 */
2753 2753
 	public function getAllCountries($filters = array())
2754 2754
 	{
2755 2755
 		$Connection= new Connection($this->db);
@@ -2826,11 +2826,11 @@  discard block
 block discarded – undo
2826 2826
 	
2827 2827
 	
2828 2828
 	/**
2829
-	* Gets a list of all idents/callsigns
2830
-	*
2831
-	* @return Array list of ident/callsign names
2832
-	*
2833
-	*/
2829
+	 * Gets a list of all idents/callsigns
2830
+	 *
2831
+	 * @return Array list of ident/callsign names
2832
+	 *
2833
+	 */
2834 2834
 	public function getAllIdents($filters = array())
2835 2835
 	{
2836 2836
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2854,9 +2854,9 @@  discard block
 block discarded – undo
2854 2854
 	}
2855 2855
 
2856 2856
 	/**
2857
-	* Get a list of flights from airport since 7 days
2858
-	* @return Array number, icao, name and city of airports
2859
-	*/
2857
+	 * Get a list of flights from airport since 7 days
2858
+	 * @return Array number, icao, name and city of airports
2859
+	 */
2860 2860
 
2861 2861
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2862 2862
 		global $globalTimezone, $globalDBdriver;
@@ -2887,9 +2887,9 @@  discard block
 block discarded – undo
2887 2887
 	}
2888 2888
 
2889 2889
 	/**
2890
-	* Get a list of flights from airport since 7 days
2891
-	* @return Array number, icao, name and city of airports
2892
-	*/
2890
+	 * Get a list of flights from airport since 7 days
2891
+	 * @return Array number, icao, name and city of airports
2892
+	 */
2893 2893
 
2894 2894
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2895 2895
 		global $globalTimezone, $globalDBdriver;
@@ -2919,9 +2919,9 @@  discard block
 block discarded – undo
2919 2919
 	}
2920 2920
 
2921 2921
 	/**
2922
-	* Get a list of flights from detected airport since 7 days
2923
-	* @return Array number, icao, name and city of airports
2924
-	*/
2922
+	 * Get a list of flights from detected airport since 7 days
2923
+	 * @return Array number, icao, name and city of airports
2924
+	 */
2925 2925
 
2926 2926
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2927 2927
 		global $globalTimezone, $globalDBdriver;
@@ -2959,9 +2959,9 @@  discard block
 block discarded – undo
2959 2959
 	}
2960 2960
 
2961 2961
 	/**
2962
-	* Get a list of flights from detected airport since 7 days
2963
-	* @return Array number, icao, name and city of airports
2964
-	*/
2962
+	 * Get a list of flights from detected airport since 7 days
2963
+	 * @return Array number, icao, name and city of airports
2964
+	 */
2965 2965
 
2966 2966
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2967 2967
 		global $globalTimezone, $globalDBdriver;
@@ -3003,9 +3003,9 @@  discard block
 block discarded – undo
3003 3003
 
3004 3004
 
3005 3005
 	/**
3006
-	* Get a list of flights to airport since 7 days
3007
-	* @return Array number, icao, name and city of airports
3008
-	*/
3006
+	 * Get a list of flights to airport since 7 days
3007
+	 * @return Array number, icao, name and city of airports
3008
+	 */
3009 3009
 
3010 3010
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3011 3011
 		global $globalTimezone, $globalDBdriver;
@@ -3038,9 +3038,9 @@  discard block
 block discarded – undo
3038 3038
 
3039 3039
 
3040 3040
 	/**
3041
-	* Get a list of flights detected to airport since 7 days
3042
-	* @return Array number, icao, name and city of airports
3043
-	*/
3041
+	 * Get a list of flights detected to airport since 7 days
3042
+	 * @return Array number, icao, name and city of airports
3043
+	 */
3044 3044
 
3045 3045
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3046 3046
 		global $globalTimezone, $globalDBdriver;
@@ -3081,9 +3081,9 @@  discard block
 block discarded – undo
3081 3081
 
3082 3082
 
3083 3083
 	/**
3084
-	* Get a list of flights to airport since 7 days
3085
-	* @return Array number, icao, name and city of airports
3086
-	*/
3084
+	 * Get a list of flights to airport since 7 days
3085
+	 * @return Array number, icao, name and city of airports
3086
+	 */
3087 3087
 
3088 3088
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3089 3089
 		global $globalTimezone, $globalDBdriver;
@@ -3115,9 +3115,9 @@  discard block
 block discarded – undo
3115 3115
 
3116 3116
 
3117 3117
 	/**
3118
-	* Get a list of flights detected to airport since 7 days
3119
-	* @return Array number, icao, name and city of airports
3120
-	*/
3118
+	 * Get a list of flights detected to airport since 7 days
3119
+	 * @return Array number, icao, name and city of airports
3120
+	 */
3121 3121
 
3122 3122
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3123 3123
 		global $globalTimezone, $globalDBdriver;
@@ -3161,11 +3161,11 @@  discard block
 block discarded – undo
3161 3161
 
3162 3162
 
3163 3163
 	/**
3164
-	* Gets a list of all dates
3165
-	*
3166
-	* @return Array list of date names
3167
-	*
3168
-	*/
3164
+	 * Gets a list of all dates
3165
+	 *
3166
+	 * @return Array list of date names
3167
+	 *
3168
+	 */
3169 3169
 	public function getAllDates()
3170 3170
 	{
3171 3171
 		global $globalTimezone, $globalDBdriver;
@@ -3206,11 +3206,11 @@  discard block
 block discarded – undo
3206 3206
 	
3207 3207
 	
3208 3208
 	/**
3209
-	* Gets all route combinations
3210
-	*
3211
-	* @return Array the route list
3212
-	*
3213
-	*/
3209
+	 * Gets all route combinations
3210
+	 *
3211
+	 * @return Array the route list
3212
+	 *
3213
+	 */
3214 3214
 	public function getAllRoutes()
3215 3215
 	{
3216 3216
 		$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 
@@ -3236,13 +3236,13 @@  discard block
 block discarded – undo
3236 3236
 	}
3237 3237
 
3238 3238
 	/**
3239
-	* Update ident spotter data
3240
-	*
3241
-	* @param String $flightaware_id the ID from flightaware
3242
-	* @param String $ident the flight ident
3243
-	* @return String success or false
3244
-	*
3245
-	*/	
3239
+	 * Update ident spotter data
3240
+	 *
3241
+	 * @param String $flightaware_id the ID from flightaware
3242
+	 * @param String $ident the flight ident
3243
+	 * @return String success or false
3244
+	 *
3245
+	 */	
3246 3246
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3247 3247
 	{
3248 3248
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3263,14 +3263,14 @@  discard block
 block discarded – undo
3263 3263
 		} else {
3264 3264
 			$airline_array = $this->getAllAirlineInfo("NA");
3265 3265
 		}
3266
-                $airline_name = $airline_array[0]['name'];
3267
-                $airline_icao = $airline_array[0]['icao'];
3268
-                $airline_country = $airline_array[0]['country'];
3269
-                $airline_type = $airline_array[0]['type'];
3266
+				$airline_name = $airline_array[0]['name'];
3267
+				$airline_icao = $airline_array[0]['icao'];
3268
+				$airline_country = $airline_array[0]['country'];
3269
+				$airline_type = $airline_array[0]['type'];
3270 3270
 
3271 3271
 
3272 3272
 		$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';
3273
-                $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);
3273
+				$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);
3274 3274
 
3275 3275
 		try {
3276 3276
 			$sth = $this->db->prepare($query);
@@ -3283,19 +3283,19 @@  discard block
 block discarded – undo
3283 3283
 
3284 3284
 	}
3285 3285
 	/**
3286
-	* Update latest spotter data
3287
-	*
3288
-	* @param String $flightaware_id the ID from flightaware
3289
-	* @param String $ident the flight ident
3290
-	* @param String $arrival_airport_icao the arrival airport
3291
-	* @return String success or false
3292
-	*
3293
-	*/	
3286
+	 * Update latest spotter data
3287
+	 *
3288
+	 * @param String $flightaware_id the ID from flightaware
3289
+	 * @param String $ident the flight ident
3290
+	 * @param String $arrival_airport_icao the arrival airport
3291
+	 * @return String success or false
3292
+	 *
3293
+	 */	
3294 3294
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3295 3295
 	{
3296 3296
 		if ($groundspeed == '') $groundspeed = NULL;
3297 3297
 		$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';
3298
-                $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);
3298
+				$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);
3299 3299
 
3300 3300
 		try {
3301 3301
 			$sth = $this->db->prepare($query);
@@ -3309,32 +3309,32 @@  discard block
 block discarded – undo
3309 3309
 	}
3310 3310
 
3311 3311
 	/**
3312
-	* Adds a new spotter data
3313
-	*
3314
-	* @param String $flightaware_id the ID from flightaware
3315
-	* @param String $ident the flight ident
3316
-	* @param String $aircraft_icao the aircraft type
3317
-	* @param String $departure_airport_icao the departure airport
3318
-	* @param String $arrival_airport_icao the arrival airport
3319
-	* @param String $latitude latitude of flight
3320
-	* @param String $longitude latitude of flight
3321
-	* @param String $waypoints waypoints of flight
3322
-	* @param String $altitude altitude of flight
3323
-	* @param String $heading heading of flight
3324
-	* @param String $groundspeed speed of flight
3325
-	* @param String $date date of flight
3326
-	* @param String $departure_airport_time departure time of flight
3327
-	* @param String $arrival_airport_time arrival time of flight
3328
-	* @param String $squawk squawk code of flight
3329
-	* @param String $route_stop route stop of flight
3330
-	* @param String $highlight highlight or not
3331
-	* @param String $ModeS ModesS code of flight
3332
-	* @param String $registration registration code of flight
3333
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3334
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3335
-	* @param String $verticalrate vertival rate of flight
3336
-	* @return String success or false
3337
-	*/
3312
+	 * Adds a new spotter data
3313
+	 *
3314
+	 * @param String $flightaware_id the ID from flightaware
3315
+	 * @param String $ident the flight ident
3316
+	 * @param String $aircraft_icao the aircraft type
3317
+	 * @param String $departure_airport_icao the departure airport
3318
+	 * @param String $arrival_airport_icao the arrival airport
3319
+	 * @param String $latitude latitude of flight
3320
+	 * @param String $longitude latitude of flight
3321
+	 * @param String $waypoints waypoints of flight
3322
+	 * @param String $altitude altitude of flight
3323
+	 * @param String $heading heading of flight
3324
+	 * @param String $groundspeed speed of flight
3325
+	 * @param String $date date of flight
3326
+	 * @param String $departure_airport_time departure time of flight
3327
+	 * @param String $arrival_airport_time arrival time of flight
3328
+	 * @param String $squawk squawk code of flight
3329
+	 * @param String $route_stop route stop of flight
3330
+	 * @param String $highlight highlight or not
3331
+	 * @param String $ModeS ModesS code of flight
3332
+	 * @param String $registration registration code of flight
3333
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3334
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3335
+	 * @param String $verticalrate vertival rate of flight
3336
+	 * @return String success or false
3337
+	 */
3338 3338
 	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 = '')
3339 3339
 	{
3340 3340
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3549,8 +3549,8 @@  discard block
 block discarded – undo
3549 3549
     
3550 3550
 		if ($globalIVAO && $aircraft_icao != '')
3551 3551
 		{
3552
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3553
-            		else $airline_icao = '';
3552
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3553
+					else $airline_icao = '';
3554 3554
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3555 3555
 			if (!isset($image_array[0]['registration']))
3556 3556
 			{
@@ -3581,53 +3581,53 @@  discard block
 block discarded – undo
3581 3581
 	
3582 3582
 		if (count($airline_array) == 0) 
3583 3583
 		{
3584
-                        $airline_array = $this->getAllAirlineInfo('NA');
3585
-                }
3586
-                if (count($aircraft_array) == 0) 
3587
-                {
3588
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3589
-                }
3590
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3591
-                {
3592
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3593
-                }
3594
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3595
-                {
3596
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3597
-                }
3598
-                if ($registration == '') $registration = 'NA';
3599
-                if ($latitude == '' && $longitude == '') {
3600
-            		$latitude = 0;
3601
-            		$longitude = 0;
3602
-            	}
3603
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3604
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3605
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3606
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3607
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3608
-                $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) 
3584
+						$airline_array = $this->getAllAirlineInfo('NA');
3585
+				}
3586
+				if (count($aircraft_array) == 0) 
3587
+				{
3588
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3589
+				}
3590
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3591
+				{
3592
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3593
+				}
3594
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3595
+				{
3596
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3597
+				}
3598
+				if ($registration == '') $registration = 'NA';
3599
+				if ($latitude == '' && $longitude == '') {
3600
+					$latitude = 0;
3601
+					$longitude = 0;
3602
+				}
3603
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3604
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3605
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3606
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3607
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3608
+				$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) 
3609 3609
                 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)";
3610 3610
 
3611
-                $airline_name = $airline_array[0]['name'];
3612
-                $airline_icao = $airline_array[0]['icao'];
3613
-                $airline_country = $airline_array[0]['country'];
3614
-                $airline_type = $airline_array[0]['type'];
3611
+				$airline_name = $airline_array[0]['name'];
3612
+				$airline_icao = $airline_array[0]['icao'];
3613
+				$airline_country = $airline_array[0]['country'];
3614
+				$airline_type = $airline_array[0]['type'];
3615 3615
 		if ($airline_type == '') {
3616 3616
 			$timeelapsed = microtime(true);
3617 3617
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3618 3618
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3619 3619
 		}
3620 3620
 		if ($airline_type == null) $airline_type = '';
3621
-                $aircraft_type = $aircraft_array[0]['type'];
3622
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3623
-                $departure_airport_name = $departure_airport_array[0]['name'];
3624
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3625
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3621
+				$aircraft_type = $aircraft_array[0]['type'];
3622
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3623
+				$departure_airport_name = $departure_airport_array[0]['name'];
3624
+			$departure_airport_city = $departure_airport_array[0]['city'];
3625
+				$departure_airport_country = $departure_airport_array[0]['country'];
3626 3626
                 
3627
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3628
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3629
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3630
-                $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);
3627
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3628
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3629
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3630
+				$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);
3631 3631
 
3632 3632
 		try {
3633 3633
 		        
@@ -3635,7 +3635,7 @@  discard block
 block discarded – undo
3635 3635
 			$sth->execute($query_values);
3636 3636
 			$this->db = null;
3637 3637
 		} catch (PDOException $e) {
3638
-		    return "error : ".$e->getMessage();
3638
+			return "error : ".$e->getMessage();
3639 3639
 		}
3640 3640
 		
3641 3641
 		return "success";
@@ -3644,11 +3644,11 @@  discard block
 block discarded – undo
3644 3644
 	
3645 3645
   
3646 3646
 	/**
3647
-	* Gets the aircraft ident within the last hour
3648
-	*
3649
-	* @return String the ident
3650
-	*
3651
-	*/
3647
+	 * Gets the aircraft ident within the last hour
3648
+	 *
3649
+	 * @return String the ident
3650
+	 *
3651
+	 */
3652 3652
 	public function getIdentFromLastHour($ident)
3653 3653
 	{
3654 3654
 		global $globalDBdriver, $globalTimezone;
@@ -3664,11 +3664,11 @@  discard block
 block discarded – undo
3664 3664
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3665 3665
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3666 3666
 			$query_data = array(':ident' => $ident);
3667
-    		}
3667
+			}
3668 3668
 		
3669 3669
 		$sth = $this->db->prepare($query);
3670 3670
 		$sth->execute($query_data);
3671
-    		$ident_result='';
3671
+			$ident_result='';
3672 3672
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3673 3673
 		{
3674 3674
 			$ident_result = $row['ident'];
@@ -3679,11 +3679,11 @@  discard block
 block discarded – undo
3679 3679
 	
3680 3680
 	
3681 3681
 	/**
3682
-	* Gets the aircraft data from the last 20 seconds
3683
-	*
3684
-	* @return Array the spotter data
3685
-	*
3686
-	*/
3682
+	 * Gets the aircraft data from the last 20 seconds
3683
+	 *
3684
+	 * @return Array the spotter data
3685
+	 *
3686
+	 */
3687 3687
 	public function getRealTimeData($q = '')
3688 3688
 	{
3689 3689
 		global $globalDBdriver;
@@ -3727,11 +3727,11 @@  discard block
 block discarded – undo
3727 3727
 	
3728 3728
 	
3729 3729
 	 /**
3730
-	* Gets all airlines that have flown over
3731
-	*
3732
-	* @return Array the airline list
3733
-	*
3734
-	*/
3730
+	  * Gets all airlines that have flown over
3731
+	  *
3732
+	  * @return Array the airline list
3733
+	  *
3734
+	  */
3735 3735
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3736 3736
 	{
3737 3737
 		global $globalDBdriver;
@@ -3745,7 +3745,7 @@  discard block
 block discarded – undo
3745 3745
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3746 3746
 			}
3747 3747
 		}
3748
-                if ($sincedate != '') {
3748
+				if ($sincedate != '') {
3749 3749
 			if ($globalDBdriver == 'mysql') {
3750 3750
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3751 3751
 			} else {
@@ -3772,26 +3772,26 @@  discard block
 block discarded – undo
3772 3772
 	}
3773 3773
 
3774 3774
 	 /**
3775
-	* Gets all pilots that have flown over
3776
-	*
3777
-	* @return Array the pilots list
3778
-	*
3779
-	*/
3775
+	  * Gets all pilots that have flown over
3776
+	  *
3777
+	  * @return Array the pilots list
3778
+	  *
3779
+	  */
3780 3780
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3781 3781
 	{
3782 3782
 		global $globalDBdriver;
3783 3783
 		$filter_query = $this->getFilter($filters,true,true);
3784 3784
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3785 3785
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3786
-                if ($olderthanmonths > 0) {
3787
-            		if ($globalDBdriver == 'mysql') {
3786
+				if ($olderthanmonths > 0) {
3787
+					if ($globalDBdriver == 'mysql') {
3788 3788
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3789 3789
 			} else {
3790 3790
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3791 3791
 			}
3792 3792
 		}
3793
-                if ($sincedate != '') {
3794
-            		if ($globalDBdriver == 'mysql') {
3793
+				if ($sincedate != '') {
3794
+					if ($globalDBdriver == 'mysql') {
3795 3795
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3796 3796
 			} else {
3797 3797
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3819,25 +3819,25 @@  discard block
 block discarded – undo
3819 3819
 	}
3820 3820
 	
3821 3821
 		 /**
3822
-	* Gets all pilots that have flown over
3823
-	*
3824
-	* @return Array the pilots list
3825
-	*
3826
-	*/
3822
+		  * Gets all pilots that have flown over
3823
+		  *
3824
+		  * @return Array the pilots list
3825
+		  *
3826
+		  */
3827 3827
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3828 3828
 	{
3829 3829
 		global $globalDBdriver;
3830 3830
 		$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
3831 3831
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3832
-                if ($olderthanmonths > 0) {
3833
-            		if ($globalDBdriver == 'mysql') {
3832
+				if ($olderthanmonths > 0) {
3833
+					if ($globalDBdriver == 'mysql') {
3834 3834
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3835 3835
 			} else {
3836 3836
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3837 3837
 			}
3838 3838
 		}
3839
-                if ($sincedate != '') {
3840
-            		if ($globalDBdriver == 'mysql') {
3839
+				if ($sincedate != '') {
3840
+					if ($globalDBdriver == 'mysql') {
3841 3841
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3842 3842
 			} else {
3843 3843
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3866,26 +3866,26 @@  discard block
 block discarded – undo
3866 3866
 	}
3867 3867
 	
3868 3868
 	 /**
3869
-	* Gets all owner that have flown over
3870
-	*
3871
-	* @return Array the pilots list
3872
-	*
3873
-	*/
3869
+	  * Gets all owner that have flown over
3870
+	  *
3871
+	  * @return Array the pilots list
3872
+	  *
3873
+	  */
3874 3874
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3875 3875
 	{
3876 3876
 		global $globalDBdriver;
3877 3877
 		$filter_query = $this->getFilter($filters,true,true);
3878 3878
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3879 3879
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3880
-                if ($olderthanmonths > 0) {
3881
-            		if ($globalDBdriver == 'mysql') {
3880
+				if ($olderthanmonths > 0) {
3881
+					if ($globalDBdriver == 'mysql') {
3882 3882
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3883 3883
 			} else {
3884 3884
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3885 3885
 			}
3886 3886
 		}
3887
-                if ($sincedate != '') {
3888
-            		if ($globalDBdriver == 'mysql') {
3887
+				if ($sincedate != '') {
3888
+					if ($globalDBdriver == 'mysql') {
3889 3889
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3890 3890
 			} else {
3891 3891
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3911,26 +3911,26 @@  discard block
 block discarded – undo
3911 3911
 	}
3912 3912
 	
3913 3913
 	 /**
3914
-	* Gets all owner that have flown over
3915
-	*
3916
-	* @return Array the pilots list
3917
-	*
3918
-	*/
3914
+	  * Gets all owner that have flown over
3915
+	  *
3916
+	  * @return Array the pilots list
3917
+	  *
3918
+	  */
3919 3919
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3920 3920
 	{
3921 3921
 		global $globalDBdriver;
3922 3922
 		$filter_query = $this->getFilter($filters,true,true);
3923 3923
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3924 3924
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3925
-                if ($olderthanmonths > 0) {
3926
-            		if ($globalDBdriver == 'mysql') {
3925
+				if ($olderthanmonths > 0) {
3926
+					if ($globalDBdriver == 'mysql') {
3927 3927
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3928 3928
 			} else {
3929 3929
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3930 3930
 			}
3931 3931
 		}
3932
-                if ($sincedate != '') {
3933
-            		if ($globalDBdriver == 'mysql') {
3932
+				if ($sincedate != '') {
3933
+					if ($globalDBdriver == 'mysql') {
3934 3934
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3935 3935
 			} else {
3936 3936
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3957,11 +3957,11 @@  discard block
 block discarded – undo
3957 3957
 	}
3958 3958
 
3959 3959
 	/**
3960
-	* Gets all airlines that have flown over by aircraft
3961
-	*
3962
-	* @return Array the airline list
3963
-	*
3964
-	*/
3960
+	 * Gets all airlines that have flown over by aircraft
3961
+	 *
3962
+	 * @return Array the airline list
3963
+	 *
3964
+	 */
3965 3965
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3966 3966
 	{
3967 3967
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3993,11 +3993,11 @@  discard block
 block discarded – undo
3993 3993
 
3994 3994
 
3995 3995
 	/**
3996
-	* Gets all airline countries that have flown over by aircraft
3997
-	*
3998
-	* @return Array the airline country list
3999
-	*
4000
-	*/
3996
+	 * Gets all airline countries that have flown over by aircraft
3997
+	 *
3998
+	 * @return Array the airline country list
3999
+	 *
4000
+	 */
4001 4001
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4002 4002
 	{
4003 4003
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4029,11 +4029,11 @@  discard block
 block discarded – undo
4029 4029
 	
4030 4030
 	
4031 4031
 	/**
4032
-	* Gets all airlines that have flown over by airport
4033
-	*
4034
-	* @return Array the airline list
4035
-	*
4036
-	*/
4032
+	 * Gets all airlines that have flown over by airport
4033
+	 *
4034
+	 * @return Array the airline list
4035
+	 *
4036
+	 */
4037 4037
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4038 4038
 	{
4039 4039
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4064,11 +4064,11 @@  discard block
 block discarded – undo
4064 4064
 
4065 4065
 
4066 4066
 	/**
4067
-	* Gets all airline countries that have flown over by airport icao
4068
-	*
4069
-	* @return Array the airline country list
4070
-	*
4071
-	*/
4067
+	 * Gets all airline countries that have flown over by airport icao
4068
+	 *
4069
+	 * @return Array the airline country list
4070
+	 *
4071
+	 */
4072 4072
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4073 4073
 	{
4074 4074
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4098,11 +4098,11 @@  discard block
 block discarded – undo
4098 4098
 
4099 4099
 
4100 4100
 	/**
4101
-	* Gets all airlines that have flown over by aircraft manufacturer
4102
-	*
4103
-	* @return Array the airline list
4104
-	*
4105
-	*/
4101
+	 * Gets all airlines that have flown over by aircraft manufacturer
4102
+	 *
4103
+	 * @return Array the airline list
4104
+	 *
4105
+	 */
4106 4106
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4107 4107
 	{
4108 4108
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4133,11 +4133,11 @@  discard block
 block discarded – undo
4133 4133
 
4134 4134
 
4135 4135
 	/**
4136
-	* Gets all airline countries that have flown over by aircraft manufacturer
4137
-	*
4138
-	* @return Array the airline country list
4139
-	*
4140
-	*/
4136
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4137
+	 *
4138
+	 * @return Array the airline country list
4139
+	 *
4140
+	 */
4141 4141
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4142 4142
 	{
4143 4143
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4166,11 +4166,11 @@  discard block
 block discarded – undo
4166 4166
 
4167 4167
 
4168 4168
 	/**
4169
-	* Gets all airlines that have flown over by date
4170
-	*
4171
-	* @return Array the airline list
4172
-	*
4173
-	*/
4169
+	 * Gets all airlines that have flown over by date
4170
+	 *
4171
+	 * @return Array the airline list
4172
+	 *
4173
+	 */
4174 4174
 	public function countAllAirlinesByDate($date,$filters = array())
4175 4175
 	{
4176 4176
 		global $globalTimezone, $globalDBdriver;
@@ -4214,11 +4214,11 @@  discard block
 block discarded – undo
4214 4214
 	
4215 4215
 	
4216 4216
 	/**
4217
-	* Gets all airline countries that have flown over by date
4218
-	*
4219
-	* @return Array the airline country list
4220
-	*
4221
-	*/
4217
+	 * Gets all airline countries that have flown over by date
4218
+	 *
4219
+	 * @return Array the airline country list
4220
+	 *
4221
+	 */
4222 4222
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4223 4223
 	{
4224 4224
 		global $globalTimezone, $globalDBdriver;
@@ -4261,11 +4261,11 @@  discard block
 block discarded – undo
4261 4261
 
4262 4262
 
4263 4263
 	/**
4264
-	* Gets all airlines that have flown over by ident/callsign
4265
-	*
4266
-	* @return Array the airline list
4267
-	*
4268
-	*/
4264
+	 * Gets all airlines that have flown over by ident/callsign
4265
+	 *
4266
+	 * @return Array the airline list
4267
+	 *
4268
+	 */
4269 4269
 	public function countAllAirlinesByIdent($ident,$filters = array())
4270 4270
 	{
4271 4271
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4295,11 +4295,11 @@  discard block
 block discarded – undo
4295 4295
 	}
4296 4296
 
4297 4297
 	/**
4298
-	* Gets all airlines that have flown over by route
4299
-	*
4300
-	* @return Array the airline list
4301
-	*
4302
-	*/
4298
+	 * Gets all airlines that have flown over by route
4299
+	 *
4300
+	 * @return Array the airline list
4301
+	 *
4302
+	 */
4303 4303
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4304 4304
 	{
4305 4305
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4331,11 +4331,11 @@  discard block
 block discarded – undo
4331 4331
 	}
4332 4332
 
4333 4333
 	/**
4334
-	* Gets all airline countries that have flown over by route
4335
-	*
4336
-	* @return Array the airline country list
4337
-	*
4338
-	*/
4334
+	 * Gets all airline countries that have flown over by route
4335
+	 *
4336
+	 * @return Array the airline country list
4337
+	 *
4338
+	 */
4339 4339
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4340 4340
 	{
4341 4341
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4367,11 +4367,11 @@  discard block
 block discarded – undo
4367 4367
 
4368 4368
 
4369 4369
 	/**
4370
-	* Gets all airlines that have flown over by country
4371
-	*
4372
-	* @return Array the airline list
4373
-	*
4374
-	*/
4370
+	 * Gets all airlines that have flown over by country
4371
+	 *
4372
+	 * @return Array the airline list
4373
+	 *
4374
+	 */
4375 4375
 	public function countAllAirlinesByCountry($country,$filters = array())
4376 4376
 	{
4377 4377
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4401,11 +4401,11 @@  discard block
 block discarded – undo
4401 4401
 
4402 4402
 
4403 4403
 	/**
4404
-	* Gets all airline countries that have flown over by country
4405
-	*
4406
-	* @return Array the airline country list
4407
-	*
4408
-	*/
4404
+	 * Gets all airline countries that have flown over by country
4405
+	 *
4406
+	 * @return Array the airline country list
4407
+	 *
4408
+	 */
4409 4409
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4410 4410
 	{
4411 4411
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4434,11 +4434,11 @@  discard block
 block discarded – undo
4434 4434
 
4435 4435
 
4436 4436
 	/**
4437
-	* Gets all airlines countries
4438
-	*
4439
-	* @return Array the airline country list
4440
-	*
4441
-	*/
4437
+	 * Gets all airlines countries
4438
+	 *
4439
+	 * @return Array the airline country list
4440
+	 *
4441
+	 */
4442 4442
 	public function countAllAirlineCountries($limit = true, $filters = array())
4443 4443
 	{
4444 4444
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4464,11 +4464,11 @@  discard block
 block discarded – undo
4464 4464
 	}
4465 4465
 
4466 4466
 	/**
4467
-	* Gets all number of flight over countries
4468
-	*
4469
-	* @return Array the airline country list
4470
-	*
4471
-	*/
4467
+	 * Gets all number of flight over countries
4468
+	 *
4469
+	 * @return Array the airline country list
4470
+	 *
4471
+	 */
4472 4472
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4473 4473
 	{
4474 4474
 		global $globalDBdriver;
@@ -4490,15 +4490,15 @@  discard block
 block discarded – undo
4490 4490
 		$SpotterLive = new SpotterLive();
4491 4491
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4492 4492
 		$filter_query .= ' over_country IS NOT NULL';
4493
-                if ($olderthanmonths > 0) {
4493
+				if ($olderthanmonths > 0) {
4494 4494
 			if ($globalDBdriver == 'mysql') {
4495 4495
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4496 4496
 			} else {
4497 4497
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4498 4498
 			}
4499 4499
 		}
4500
-                if ($sincedate != '') {
4501
-            		if ($globalDBdriver == 'mysql') {
4500
+				if ($sincedate != '') {
4501
+					if ($globalDBdriver == 'mysql') {
4502 4502
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4503 4503
 			} else {
4504 4504
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4528,11 +4528,11 @@  discard block
 block discarded – undo
4528 4528
 	
4529 4529
 	
4530 4530
 	/**
4531
-	* Gets all aircraft types that have flown over
4532
-	*
4533
-	* @return Array the aircraft list
4534
-	*
4535
-	*/
4531
+	 * Gets all aircraft types that have flown over
4532
+	 *
4533
+	 * @return Array the aircraft list
4534
+	 *
4535
+	 */
4536 4536
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4537 4537
 	{
4538 4538
 		global $globalDBdriver;
@@ -4575,11 +4575,11 @@  discard block
 block discarded – undo
4575 4575
 	}
4576 4576
 
4577 4577
 	/**
4578
-	* Gets all aircraft types that have flown over by airline
4579
-	*
4580
-	* @return Array the aircraft list
4581
-	*
4582
-	*/
4578
+	 * Gets all aircraft types that have flown over by airline
4579
+	 *
4580
+	 * @return Array the aircraft list
4581
+	 *
4582
+	 */
4583 4583
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4584 4584
 	{
4585 4585
 		global $globalDBdriver;
@@ -4622,11 +4622,11 @@  discard block
 block discarded – undo
4622 4622
 	}
4623 4623
 
4624 4624
 	/**
4625
-	* Gets all aircraft types that have flown over by months
4626
-	*
4627
-	* @return Array the aircraft list
4628
-	*
4629
-	*/
4625
+	 * Gets all aircraft types that have flown over by months
4626
+	 *
4627
+	 * @return Array the aircraft list
4628
+	 *
4629
+	 */
4630 4630
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4631 4631
 	{
4632 4632
 		global $globalDBdriver;
@@ -4670,11 +4670,11 @@  discard block
 block discarded – undo
4670 4670
 
4671 4671
 
4672 4672
 	/**
4673
-	* Gets all aircraft registration that have flown over by aircaft icao
4674
-	*
4675
-	* @return Array the aircraft list
4676
-	*
4677
-	*/
4673
+	 * Gets all aircraft registration that have flown over by aircaft icao
4674
+	 *
4675
+	 * @return Array the aircraft list
4676
+	 *
4677
+	 */
4678 4678
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4679 4679
 	{
4680 4680
 		$Image = new Image($this->db);
@@ -4713,11 +4713,11 @@  discard block
 block discarded – undo
4713 4713
 
4714 4714
 
4715 4715
 	/**
4716
-	* Gets all aircraft types that have flown over by airline icao
4717
-	*
4718
-	* @return Array the aircraft list
4719
-	*
4720
-	*/
4716
+	 * Gets all aircraft types that have flown over by airline icao
4717
+	 *
4718
+	 * @return Array the aircraft list
4719
+	 *
4720
+	 */
4721 4721
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4722 4722
 	{
4723 4723
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4746,11 +4746,11 @@  discard block
 block discarded – undo
4746 4746
 
4747 4747
 
4748 4748
 	/**
4749
-	* Gets all aircraft registration that have flown over by airline icao
4750
-	*
4751
-	* @return Array the aircraft list
4752
-	*
4753
-	*/
4749
+	 * Gets all aircraft registration that have flown over by airline icao
4750
+	 *
4751
+	 * @return Array the aircraft list
4752
+	 *
4753
+	 */
4754 4754
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4755 4755
 	{
4756 4756
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4788,11 +4788,11 @@  discard block
 block discarded – undo
4788 4788
 
4789 4789
 
4790 4790
 	/**
4791
-	* Gets all aircraft manufacturer that have flown over by airline icao
4792
-	*
4793
-	* @return Array the aircraft list
4794
-	*
4795
-	*/
4791
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4792
+	 *
4793
+	 * @return Array the aircraft list
4794
+	 *
4795
+	 */
4796 4796
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4797 4797
 	{
4798 4798
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4820,11 +4820,11 @@  discard block
 block discarded – undo
4820 4820
 
4821 4821
 
4822 4822
 	/**
4823
-	* Gets all aircraft types that have flown over by airline icao
4824
-	*
4825
-	* @return Array the aircraft list
4826
-	*
4827
-	*/
4823
+	 * Gets all aircraft types that have flown over by airline icao
4824
+	 *
4825
+	 * @return Array the aircraft list
4826
+	 *
4827
+	 */
4828 4828
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4829 4829
 	{
4830 4830
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4853,11 +4853,11 @@  discard block
 block discarded – undo
4853 4853
 
4854 4854
 
4855 4855
 	/**
4856
-	* Gets all aircraft registration that have flown over by airport icao
4857
-	*
4858
-	* @return Array the aircraft list
4859
-	*
4860
-	*/
4856
+	 * Gets all aircraft registration that have flown over by airport icao
4857
+	 *
4858
+	 * @return Array the aircraft list
4859
+	 *
4860
+	 */
4861 4861
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4862 4862
 	{
4863 4863
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4894,11 +4894,11 @@  discard block
 block discarded – undo
4894 4894
 	
4895 4895
 	
4896 4896
 	/**
4897
-	* Gets all aircraft manufacturer that have flown over by airport icao
4898
-	*
4899
-	* @return Array the aircraft list
4900
-	*
4901
-	*/
4897
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4898
+	 *
4899
+	 * @return Array the aircraft list
4900
+	 *
4901
+	 */
4902 4902
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4903 4903
 	{
4904 4904
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4924,11 +4924,11 @@  discard block
 block discarded – undo
4924 4924
 	}
4925 4925
 
4926 4926
 	/**
4927
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4928
-	*
4929
-	* @return Array the aircraft list
4930
-	*
4931
-	*/
4927
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4928
+	 *
4929
+	 * @return Array the aircraft list
4930
+	 *
4931
+	 */
4932 4932
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4933 4933
 	{
4934 4934
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4955,11 +4955,11 @@  discard block
 block discarded – undo
4955 4955
 
4956 4956
 
4957 4957
 	/**
4958
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4959
-	*
4960
-	* @return Array the aircraft list
4961
-	*
4962
-	*/
4958
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4959
+	 *
4960
+	 * @return Array the aircraft list
4961
+	 *
4962
+	 */
4963 4963
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4964 4964
 	{
4965 4965
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4995,11 +4995,11 @@  discard block
 block discarded – undo
4995 4995
 	}
4996 4996
 
4997 4997
 	/**
4998
-	* Gets all aircraft types that have flown over by date
4999
-	*
5000
-	* @return Array the aircraft list
5001
-	*
5002
-	*/
4998
+	 * Gets all aircraft types that have flown over by date
4999
+	 *
5000
+	 * @return Array the aircraft list
5001
+	 *
5002
+	 */
5003 5003
 	public function countAllAircraftTypesByDate($date,$filters = array())
5004 5004
 	{
5005 5005
 		global $globalTimezone, $globalDBdriver;
@@ -5041,11 +5041,11 @@  discard block
 block discarded – undo
5041 5041
 
5042 5042
 
5043 5043
 	/**
5044
-	* Gets all aircraft registration that have flown over by date
5045
-	*
5046
-	* @return Array the aircraft list
5047
-	*
5048
-	*/
5044
+	 * Gets all aircraft registration that have flown over by date
5045
+	 *
5046
+	 * @return Array the aircraft list
5047
+	 *
5048
+	 */
5049 5049
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5050 5050
 	{
5051 5051
 		global $globalTimezone, $globalDBdriver;
@@ -5096,11 +5096,11 @@  discard block
 block discarded – undo
5096 5096
 
5097 5097
 
5098 5098
 	/**
5099
-	* Gets all aircraft manufacturer that have flown over by date
5100
-	*
5101
-	* @return Array the aircraft manufacturer list
5102
-	*
5103
-	*/
5099
+	 * Gets all aircraft manufacturer that have flown over by date
5100
+	 *
5101
+	 * @return Array the aircraft manufacturer list
5102
+	 *
5103
+	 */
5104 5104
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5105 5105
 	{
5106 5106
 		global $globalTimezone, $globalDBdriver;
@@ -5142,11 +5142,11 @@  discard block
 block discarded – undo
5142 5142
 
5143 5143
 
5144 5144
 	/**
5145
-	* Gets all aircraft types that have flown over by ident/callsign
5146
-	*
5147
-	* @return Array the aircraft list
5148
-	*
5149
-	*/
5145
+	 * Gets all aircraft types that have flown over by ident/callsign
5146
+	 *
5147
+	 * @return Array the aircraft list
5148
+	 *
5149
+	 */
5150 5150
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5151 5151
 	{
5152 5152
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5175,11 +5175,11 @@  discard block
 block discarded – undo
5175 5175
 
5176 5176
 
5177 5177
 	/**
5178
-	* Gets all aircraft registration that have flown over by ident/callsign
5179
-	*
5180
-	* @return Array the aircraft list
5181
-	*
5182
-	*/
5178
+	 * Gets all aircraft registration that have flown over by ident/callsign
5179
+	 *
5180
+	 * @return Array the aircraft list
5181
+	 *
5182
+	 */
5183 5183
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5184 5184
 	{
5185 5185
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5219,11 +5219,11 @@  discard block
 block discarded – undo
5219 5219
 
5220 5220
 
5221 5221
 	/**
5222
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5223
-	*
5224
-	* @return Array the aircraft manufacturer list
5225
-	*
5226
-	*/
5222
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5223
+	 *
5224
+	 * @return Array the aircraft manufacturer list
5225
+	 *
5226
+	 */
5227 5227
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5228 5228
 	{
5229 5229
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5249,11 +5249,11 @@  discard block
 block discarded – undo
5249 5249
 
5250 5250
 
5251 5251
 	/**
5252
-	* Gets all aircraft types that have flown over by route
5253
-	*
5254
-	* @return Array the aircraft list
5255
-	*
5256
-	*/
5252
+	 * Gets all aircraft types that have flown over by route
5253
+	 *
5254
+	 * @return Array the aircraft list
5255
+	 *
5256
+	 */
5257 5257
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5258 5258
 	{
5259 5259
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5282,11 +5282,11 @@  discard block
 block discarded – undo
5282 5282
 	}
5283 5283
 
5284 5284
 	/**
5285
-	* Gets all aircraft registration that have flown over by route
5286
-	*
5287
-	* @return Array the aircraft list
5288
-	*
5289
-	*/
5285
+	 * Gets all aircraft registration that have flown over by route
5286
+	 *
5287
+	 * @return Array the aircraft list
5288
+	 *
5289
+	 */
5290 5290
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5291 5291
 	{
5292 5292
 		$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 manufacturer that have flown over by route
5332
-	*
5333
-	* @return Array the aircraft manufacturer list
5334
-	*
5335
-	*/
5331
+	 * Gets all aircraft manufacturer that have flown over by route
5332
+	 *
5333
+	 * @return Array the aircraft manufacturer list
5334
+	 *
5335
+	 */
5336 5336
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5337 5337
 	{
5338 5338
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5366,11 +5366,11 @@  discard block
 block discarded – undo
5366 5366
 	
5367 5367
 	
5368 5368
 	/**
5369
-	* Gets all aircraft types that have flown over by country
5370
-	*
5371
-	* @return Array the aircraft list
5372
-	*
5373
-	*/
5369
+	 * Gets all aircraft types that have flown over by country
5370
+	 *
5371
+	 * @return Array the aircraft list
5372
+	 *
5373
+	 */
5374 5374
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5375 5375
 	{
5376 5376
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5401,11 +5401,11 @@  discard block
 block discarded – undo
5401 5401
 
5402 5402
 
5403 5403
 	/**
5404
-	* Gets all aircraft registration that have flown over by country
5405
-	*
5406
-	* @return Array the aircraft list
5407
-	*
5408
-	*/
5404
+	 * Gets all aircraft registration that have flown over by country
5405
+	 *
5406
+	 * @return Array the aircraft list
5407
+	 *
5408
+	 */
5409 5409
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5410 5410
 	{
5411 5411
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5445,11 +5445,11 @@  discard block
 block discarded – undo
5445 5445
 	
5446 5446
 	
5447 5447
 	/**
5448
-	* Gets all aircraft manufacturer that have flown over by country
5449
-	*
5450
-	* @return Array the aircraft manufacturer list
5451
-	*
5452
-	*/
5448
+	 * Gets all aircraft manufacturer that have flown over by country
5449
+	 *
5450
+	 * @return Array the aircraft manufacturer list
5451
+	 *
5452
+	 */
5453 5453
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5454 5454
 	{
5455 5455
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5480,17 +5480,17 @@  discard block
 block discarded – undo
5480 5480
 	
5481 5481
 	
5482 5482
 	/**
5483
-	* Gets all aircraft manufacturers that have flown over
5484
-	*
5485
-	* @return Array the aircraft list
5486
-	*
5487
-	*/
5483
+	 * Gets all aircraft manufacturers that have flown over
5484
+	 *
5485
+	 * @return Array the aircraft list
5486
+	 *
5487
+	 */
5488 5488
 	public function countAllAircraftManufacturers($filters = array())
5489 5489
 	{
5490 5490
 		$filter_query = $this->getFilter($filters,true,true);
5491 5491
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5492 5492
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5493
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5493
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5494 5494
 					ORDER BY aircraft_manufacturer_count DESC
5495 5495
 					LIMIT 10";
5496 5496
       
@@ -5515,11 +5515,11 @@  discard block
 block discarded – undo
5515 5515
 	
5516 5516
 	
5517 5517
 	/**
5518
-	* Gets all aircraft registrations that have flown over
5519
-	*
5520
-	* @return Array the aircraft list
5521
-	*
5522
-	*/
5518
+	 * Gets all aircraft registrations that have flown over
5519
+	 *
5520
+	 * @return Array the aircraft list
5521
+	 *
5522
+	 */
5523 5523
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5524 5524
 	{
5525 5525
 		global $globalDBdriver;
@@ -5527,15 +5527,15 @@  discard block
 block discarded – undo
5527 5527
 		$filter_query = $this->getFilter($filters,true,true);
5528 5528
 		$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    
5529 5529
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5530
-                if ($olderthanmonths > 0) {
5531
-            		if ($globalDBdriver == 'mysql') {
5530
+				if ($olderthanmonths > 0) {
5531
+					if ($globalDBdriver == 'mysql') {
5532 5532
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5533 5533
 			} else {
5534 5534
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5535 5535
 			}
5536 5536
 		}
5537
-                if ($sincedate != '') {
5538
-            		if ($globalDBdriver == 'mysql') {
5537
+				if ($sincedate != '') {
5538
+					if ($globalDBdriver == 'mysql') {
5539 5539
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5540 5540
 			} else {
5541 5541
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5544,7 +5544,7 @@  discard block
 block discarded – undo
5544 5544
 
5545 5545
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5546 5546
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5547
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5547
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5548 5548
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5549 5549
 		
5550 5550
 		$sth = $this->db->prepare($query);
@@ -5575,11 +5575,11 @@  discard block
 block discarded – undo
5575 5575
 
5576 5576
 
5577 5577
 	/**
5578
-	* Gets all aircraft registrations that have flown over
5579
-	*
5580
-	* @return Array the aircraft list
5581
-	*
5582
-	*/
5578
+	 * Gets all aircraft registrations that have flown over
5579
+	 *
5580
+	 * @return Array the aircraft list
5581
+	 *
5582
+	 */
5583 5583
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5584 5584
 	{
5585 5585
 		global $globalDBdriver;
@@ -5587,15 +5587,15 @@  discard block
 block discarded – undo
5587 5587
 		$Image = new Image($this->db);
5588 5588
 		$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    
5589 5589
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5590
-                if ($olderthanmonths > 0) {
5591
-            		if ($globalDBdriver == 'mysql') {
5590
+				if ($olderthanmonths > 0) {
5591
+					if ($globalDBdriver == 'mysql') {
5592 5592
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5593 5593
 			} else {
5594 5594
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5595 5595
 			}
5596 5596
 		}
5597
-                if ($sincedate != '') {
5598
-            		if ($globalDBdriver == 'mysql') {
5597
+				if ($sincedate != '') {
5598
+					if ($globalDBdriver == 'mysql') {
5599 5599
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5600 5600
 			} else {
5601 5601
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5604,7 +5604,7 @@  discard block
 block discarded – undo
5604 5604
 
5605 5605
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5606 5606
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5607
-                $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";
5607
+				$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";
5608 5608
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5609 5609
 		
5610 5610
 		$sth = $this->db->prepare($query);
@@ -5636,35 +5636,35 @@  discard block
 block discarded – undo
5636 5636
 	
5637 5637
 	
5638 5638
 	/**
5639
-	* Gets all departure airports of the airplanes that have flown over
5640
-	*
5641
-	* @return Array the airport list
5642
-	*
5643
-	*/
5639
+	 * Gets all departure airports of the airplanes that have flown over
5640
+	 *
5641
+	 * @return Array the airport list
5642
+	 *
5643
+	 */
5644 5644
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5645 5645
 	{
5646 5646
 		global $globalDBdriver;
5647 5647
 		$filter_query = $this->getFilter($filters,true,true);
5648 5648
 		$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 
5649 5649
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5650
-                if ($olderthanmonths > 0) {
5651
-            		if ($globalDBdriver == 'mysql') {
5650
+				if ($olderthanmonths > 0) {
5651
+					if ($globalDBdriver == 'mysql') {
5652 5652
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5653 5653
 			} else {
5654 5654
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5655 5655
 			}
5656
-                }
5657
-                if ($sincedate != '') {
5658
-            		if ($globalDBdriver == 'mysql') {
5656
+				}
5657
+				if ($sincedate != '') {
5658
+					if ($globalDBdriver == 'mysql') {
5659 5659
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5660 5660
 			} else {
5661 5661
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5662 5662
 			}
5663 5663
 		}
5664 5664
 
5665
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5666
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5667
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5665
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5666
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5667
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5668 5668
 				ORDER BY airport_departure_icao_count DESC";
5669 5669
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5670 5670
       
@@ -5688,35 +5688,35 @@  discard block
 block discarded – undo
5688 5688
 	}
5689 5689
 
5690 5690
 	/**
5691
-	* Gets all departure airports of the airplanes that have flown over
5692
-	*
5693
-	* @return Array the airport list
5694
-	*
5695
-	*/
5691
+	 * Gets all departure airports of the airplanes that have flown over
5692
+	 *
5693
+	 * @return Array the airport list
5694
+	 *
5695
+	 */
5696 5696
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5697 5697
 	{
5698 5698
 		global $globalDBdriver;
5699 5699
 		$filter_query = $this->getFilter($filters,true,true);
5700 5700
 		$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 
5701 5701
 			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 <> '' ";
5702
-                if ($olderthanmonths > 0) {
5703
-            		if ($globalDBdriver == 'mysql') {
5702
+				if ($olderthanmonths > 0) {
5703
+					if ($globalDBdriver == 'mysql') {
5704 5704
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5705 5705
 			} else {
5706 5706
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5707 5707
 			}
5708
-                }
5709
-                if ($sincedate != '') {
5710
-            		if ($globalDBdriver == 'mysql') {
5708
+				}
5709
+				if ($sincedate != '') {
5710
+					if ($globalDBdriver == 'mysql') {
5711 5711
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5712 5712
 			} else {
5713 5713
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5714 5714
 			}
5715 5715
 		}
5716 5716
 
5717
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5718
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5719
-                $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
5717
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5718
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5719
+				$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
5720 5720
 				ORDER BY airport_departure_icao_count DESC";
5721 5721
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5722 5722
       
@@ -5741,37 +5741,37 @@  discard block
 block discarded – undo
5741 5741
 	}
5742 5742
 
5743 5743
 	/**
5744
-	* Gets all detected departure airports of the airplanes that have flown over
5745
-	*
5746
-	* @return Array the airport list
5747
-	*
5748
-	*/
5744
+	 * Gets all detected departure airports of the airplanes that have flown over
5745
+	 *
5746
+	 * @return Array the airport list
5747
+	 *
5748
+	 */
5749 5749
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5750 5750
 	{
5751 5751
 		global $globalDBdriver;
5752 5752
 		$filter_query = $this->getFilter($filters,true,true);
5753 5753
 		$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
5754 5754
 				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";
5755
-                if ($olderthanmonths > 0) {
5756
-            		if ($globalDBdriver == 'mysql') {
5755
+				if ($olderthanmonths > 0) {
5756
+					if ($globalDBdriver == 'mysql') {
5757 5757
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5758 5758
 			} else {
5759 5759
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5760 5760
 			}
5761
-                }
5762
-                if ($sincedate != '') {
5763
-            		if ($globalDBdriver == 'mysql') {
5761
+				}
5762
+				if ($sincedate != '') {
5763
+					if ($globalDBdriver == 'mysql') {
5764 5764
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5765 5765
 			} else {
5766 5766
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5767 5767
 			}
5768 5768
 		}
5769
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5770
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5771
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5769
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5770
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5771
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5772 5772
 				ORDER BY airport_departure_icao_count DESC";
5773 5773
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5774
-    		//echo $query;
5774
+			//echo $query;
5775 5775
 		$sth = $this->db->prepare($query);
5776 5776
 		$sth->execute();
5777 5777
       
@@ -5792,35 +5792,35 @@  discard block
 block discarded – undo
5792 5792
 	}
5793 5793
 	
5794 5794
 	/**
5795
-	* Gets all detected departure airports of the airplanes that have flown over
5796
-	*
5797
-	* @return Array the airport list
5798
-	*
5799
-	*/
5795
+	 * Gets all detected departure airports of the airplanes that have flown over
5796
+	 *
5797
+	 * @return Array the airport list
5798
+	 *
5799
+	 */
5800 5800
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5801 5801
 	{
5802 5802
 		global $globalDBdriver;
5803 5803
 		$filter_query = $this->getFilter($filters,true,true);
5804 5804
 		$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
5805 5805
 				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 ";
5806
-                if ($olderthanmonths > 0) {
5807
-            		if ($globalDBdriver == 'mysql') {
5806
+				if ($olderthanmonths > 0) {
5807
+					if ($globalDBdriver == 'mysql') {
5808 5808
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5809 5809
 			} else {
5810 5810
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5811 5811
 			}
5812
-                }
5813
-                if ($sincedate != '') {
5814
-            		if ($globalDBdriver == 'mysql') {
5812
+				}
5813
+				if ($sincedate != '') {
5814
+					if ($globalDBdriver == 'mysql') {
5815 5815
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5816 5816
 			} else {
5817 5817
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5818 5818
 			}
5819 5819
 		}
5820 5820
 
5821
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5822
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5823
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5821
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5822
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5823
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5824 5824
 				ORDER BY airport_departure_icao_count DESC";
5825 5825
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5826 5826
       
@@ -5845,11 +5845,11 @@  discard block
 block discarded – undo
5845 5845
 	}	
5846 5846
 	
5847 5847
 	/**
5848
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5849
-	*
5850
-	* @return Array the airport list
5851
-	*
5852
-	*/
5848
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5849
+	 *
5850
+	 * @return Array the airport list
5851
+	 *
5852
+	 */
5853 5853
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5854 5854
 	{
5855 5855
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5883,11 +5883,11 @@  discard block
 block discarded – undo
5883 5883
 	
5884 5884
 	
5885 5885
 	/**
5886
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5887
-	*
5888
-	* @return Array the airport list
5889
-	*
5890
-	*/
5886
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5887
+	 *
5888
+	 * @return Array the airport list
5889
+	 *
5890
+	 */
5891 5891
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5892 5892
 	{
5893 5893
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5918,11 +5918,11 @@  discard block
 block discarded – undo
5918 5918
 	
5919 5919
 	
5920 5920
 	/**
5921
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5922
-	*
5923
-	* @return Array the airport list
5924
-	*
5925
-	*/
5921
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5922
+	 *
5923
+	 * @return Array the airport list
5924
+	 *
5925
+	 */
5926 5926
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5927 5927
 	{
5928 5928
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5955,11 +5955,11 @@  discard block
 block discarded – undo
5955 5955
 	
5956 5956
 	
5957 5957
 	/**
5958
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5959
-	*
5960
-	* @return Array the airport list
5961
-	*
5962
-	*/
5958
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5959
+	 *
5960
+	 * @return Array the airport list
5961
+	 *
5962
+	 */
5963 5963
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5964 5964
 	{
5965 5965
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5989,11 +5989,11 @@  discard block
 block discarded – undo
5989 5989
 	
5990 5990
 	
5991 5991
 	/**
5992
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5993
-	*
5994
-	* @return Array the airport list
5995
-	*
5996
-	*/
5992
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5993
+	 *
5994
+	 * @return Array the airport list
5995
+	 *
5996
+	 */
5997 5997
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5998 5998
 	{
5999 5999
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6026,11 +6026,11 @@  discard block
 block discarded – undo
6026 6026
 	
6027 6027
 	
6028 6028
 	/**
6029
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6030
-	*
6031
-	* @return Array the airport list
6032
-	*
6033
-	*/
6029
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6030
+	 *
6031
+	 * @return Array the airport list
6032
+	 *
6033
+	 */
6034 6034
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6035 6035
 	{
6036 6036
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6060,11 +6060,11 @@  discard block
 block discarded – undo
6060 6060
 	
6061 6061
 	
6062 6062
 	/**
6063
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6064
-	*
6065
-	* @return Array the airport list
6066
-	*
6067
-	*/
6063
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6064
+	 *
6065
+	 * @return Array the airport list
6066
+	 *
6067
+	 */
6068 6068
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6069 6069
 	{
6070 6070
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6097,11 +6097,11 @@  discard block
 block discarded – undo
6097 6097
 	
6098 6098
 	
6099 6099
 	/**
6100
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6101
-	*
6102
-	* @return Array the airport list
6103
-	*
6104
-	*/
6100
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6101
+	 *
6102
+	 * @return Array the airport list
6103
+	 *
6104
+	 */
6105 6105
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6106 6106
 	{
6107 6107
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6132,11 +6132,11 @@  discard block
 block discarded – undo
6132 6132
 	
6133 6133
 	
6134 6134
 	/**
6135
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6136
-	*
6137
-	* @return Array the airport list
6138
-	*
6139
-	*/
6135
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6136
+	 *
6137
+	 * @return Array the airport list
6138
+	 *
6139
+	 */
6140 6140
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6141 6141
 	{
6142 6142
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6169,11 +6169,11 @@  discard block
 block discarded – undo
6169 6169
 	
6170 6170
 	
6171 6171
 	/**
6172
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6173
-	*
6174
-	* @return Array the airport list
6175
-	*
6176
-	*/
6172
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6173
+	 *
6174
+	 * @return Array the airport list
6175
+	 *
6176
+	 */
6177 6177
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6178 6178
 	{
6179 6179
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6203,11 +6203,11 @@  discard block
 block discarded – undo
6203 6203
 	
6204 6204
 	
6205 6205
 	/**
6206
-	* Gets all departure airports of the airplanes that have flown over based on a date
6207
-	*
6208
-	* @return Array the airport list
6209
-	*
6210
-	*/
6206
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6207
+	 *
6208
+	 * @return Array the airport list
6209
+	 *
6210
+	 */
6211 6211
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6212 6212
 	{
6213 6213
 		global $globalTimezone, $globalDBdriver;
@@ -6253,11 +6253,11 @@  discard block
 block discarded – undo
6253 6253
 	
6254 6254
 	
6255 6255
 	/**
6256
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6257
-	*
6258
-	* @return Array the airport list
6259
-	*
6260
-	*/
6256
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6257
+	 *
6258
+	 * @return Array the airport list
6259
+	 *
6260
+	 */
6261 6261
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6262 6262
 	{
6263 6263
 		global $globalTimezone, $globalDBdriver;
@@ -6300,11 +6300,11 @@  discard block
 block discarded – undo
6300 6300
 	
6301 6301
 	
6302 6302
 	/**
6303
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6304
-	*
6305
-	* @return Array the airport list
6306
-	*
6307
-	*/
6303
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6304
+	 *
6305
+	 * @return Array the airport list
6306
+	 *
6307
+	 */
6308 6308
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6309 6309
 	{
6310 6310
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6338,11 +6338,11 @@  discard block
 block discarded – undo
6338 6338
 	
6339 6339
 	
6340 6340
 	/**
6341
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6342
-	*
6343
-	* @return Array the airport list
6344
-	*
6345
-	*/
6341
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6342
+	 *
6343
+	 * @return Array the airport list
6344
+	 *
6345
+	 */
6346 6346
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6347 6347
 	{
6348 6348
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6373,11 +6373,11 @@  discard block
 block discarded – undo
6373 6373
 	
6374 6374
 	
6375 6375
 	/**
6376
-	* Gets all departure airports of the airplanes that have flown over based on a country
6377
-	*
6378
-	* @return Array the airport list
6379
-	*
6380
-	*/
6376
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6377
+	 *
6378
+	 * @return Array the airport list
6379
+	 *
6380
+	 */
6381 6381
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6382 6382
 	{
6383 6383
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6411,11 +6411,11 @@  discard block
 block discarded – undo
6411 6411
 
6412 6412
 
6413 6413
 	/**
6414
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6415
-	*
6416
-	* @return Array the airport list
6417
-	*
6418
-	*/
6414
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6415
+	 *
6416
+	 * @return Array the airport list
6417
+	 *
6418
+	 */
6419 6419
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6420 6420
 	{
6421 6421
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6445,40 +6445,40 @@  discard block
 block discarded – undo
6445 6445
 	
6446 6446
 
6447 6447
 	/**
6448
-	* Gets all arrival airports of the airplanes that have flown over
6449
-	*
6450
-	* @param Boolean $limit Limit result to 10 or not
6451
-	* @param Integer $olderthanmonths Only show result older than x months
6452
-	* @param String $sincedate Only show result since x date
6453
-	* @param Boolean $icaoaskey Show result by ICAO
6454
-	* @param Array $filters Filter used here
6455
-	* @return Array the airport list
6456
-	*
6457
-	*/
6448
+	 * Gets all arrival airports of the airplanes that have flown over
6449
+	 *
6450
+	 * @param Boolean $limit Limit result to 10 or not
6451
+	 * @param Integer $olderthanmonths Only show result older than x months
6452
+	 * @param String $sincedate Only show result since x date
6453
+	 * @param Boolean $icaoaskey Show result by ICAO
6454
+	 * @param Array $filters Filter used here
6455
+	 * @return Array the airport list
6456
+	 *
6457
+	 */
6458 6458
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6459 6459
 	{
6460 6460
 		global $globalDBdriver;
6461 6461
 		$filter_query = $this->getFilter($filters,true,true);
6462 6462
 		$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 
6463 6463
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6464
-                if ($olderthanmonths > 0) {
6465
-            		if ($globalDBdriver == 'mysql') {
6464
+				if ($olderthanmonths > 0) {
6465
+					if ($globalDBdriver == 'mysql') {
6466 6466
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6467 6467
 			} else {
6468 6468
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6469 6469
 			}
6470 6470
 		}
6471
-                if ($sincedate != '') {
6472
-            		if ($globalDBdriver == 'mysql') {
6471
+				if ($sincedate != '') {
6472
+					if ($globalDBdriver == 'mysql') {
6473 6473
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6474 6474
 			} else {
6475 6475
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6476 6476
 			}
6477 6477
 		}
6478 6478
 
6479
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6480
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6481
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6479
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6480
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6481
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6482 6482
 					ORDER BY airport_arrival_icao_count DESC";
6483 6483
 		if ($limit) $query .= " LIMIT 10";
6484 6484
       
@@ -6507,35 +6507,35 @@  discard block
 block discarded – undo
6507 6507
 	}
6508 6508
 
6509 6509
 	/**
6510
-	* Gets all arrival airports of the airplanes that have flown over
6511
-	*
6512
-	* @return Array the airport list
6513
-	*
6514
-	*/
6510
+	 * Gets all arrival airports of the airplanes that have flown over
6511
+	 *
6512
+	 * @return Array the airport list
6513
+	 *
6514
+	 */
6515 6515
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6516 6516
 	{
6517 6517
 		global $globalDBdriver;
6518 6518
 		$filter_query = $this->getFilter($filters,true,true);
6519 6519
 		$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 
6520 6520
 			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 <> '' ";
6521
-                if ($olderthanmonths > 0) {
6522
-            		if ($globalDBdriver == 'mysql') {
6521
+				if ($olderthanmonths > 0) {
6522
+					if ($globalDBdriver == 'mysql') {
6523 6523
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6524 6524
 			} else {
6525 6525
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6526 6526
 			}
6527 6527
 		}
6528
-                if ($sincedate != '') {
6529
-            		if ($globalDBdriver == 'mysql') {
6528
+				if ($sincedate != '') {
6529
+					if ($globalDBdriver == 'mysql') {
6530 6530
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6531 6531
 			} else {
6532 6532
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6533 6533
 			}
6534 6534
 		}
6535 6535
 
6536
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6537
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6538
-                $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
6536
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6537
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6538
+				$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
6539 6539
 					ORDER BY airport_arrival_icao_count DESC";
6540 6540
 		if ($limit) $query .= " LIMIT 10";
6541 6541
       
@@ -6566,34 +6566,34 @@  discard block
 block discarded – undo
6566 6566
 
6567 6567
 
6568 6568
 	/**
6569
-	* Gets all detected arrival airports of the airplanes that have flown over
6570
-	*
6571
-	* @return Array the airport list
6572
-	*
6573
-	*/
6569
+	 * Gets all detected arrival airports of the airplanes that have flown over
6570
+	 *
6571
+	 * @return Array the airport list
6572
+	 *
6573
+	 */
6574 6574
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6575 6575
 	{
6576 6576
 		global $globalDBdriver;
6577 6577
 		$filter_query = $this->getFilter($filters,true,true);
6578 6578
 		$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 
6579 6579
 			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";
6580
-                if ($olderthanmonths > 0) {
6581
-            		if ($globalDBdriver == 'mysql') {
6580
+				if ($olderthanmonths > 0) {
6581
+					if ($globalDBdriver == 'mysql') {
6582 6582
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6583 6583
 			} else {
6584 6584
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6585 6585
 			}
6586 6586
 		}
6587
-                if ($sincedate != '') {
6588
-            		if ($globalDBdriver == 'mysql') {
6587
+				if ($sincedate != '') {
6588
+					if ($globalDBdriver == 'mysql') {
6589 6589
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6590 6590
 			} else {
6591 6591
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6592 6592
 			}
6593 6593
 		}
6594
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6595
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6596
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6594
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6595
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6596
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6597 6597
 					ORDER BY airport_arrival_icao_count DESC";
6598 6598
 		if ($limit) $query .= " LIMIT 10";
6599 6599
       
@@ -6622,35 +6622,35 @@  discard block
 block discarded – undo
6622 6622
 	}
6623 6623
 	
6624 6624
 	/**
6625
-	* Gets all detected arrival airports of the airplanes that have flown over
6626
-	*
6627
-	* @return Array the airport list
6628
-	*
6629
-	*/
6625
+	 * Gets all detected arrival airports of the airplanes that have flown over
6626
+	 *
6627
+	 * @return Array the airport list
6628
+	 *
6629
+	 */
6630 6630
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6631 6631
 	{
6632 6632
 		global $globalDBdriver;
6633 6633
 		$filter_query = $this->getFilter($filters,true,true);
6634 6634
 		$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 
6635 6635
 			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 ";
6636
-                if ($olderthanmonths > 0) {
6637
-            		if ($globalDBdriver == 'mysql') {
6636
+				if ($olderthanmonths > 0) {
6637
+					if ($globalDBdriver == 'mysql') {
6638 6638
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6639 6639
 			} else {
6640 6640
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6641 6641
 			}
6642 6642
 		}
6643
-                if ($sincedate != '') {
6644
-            		if ($globalDBdriver == 'mysql') {
6643
+				if ($sincedate != '') {
6644
+					if ($globalDBdriver == 'mysql') {
6645 6645
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6646 6646
 			} else {
6647 6647
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6648 6648
 			}
6649 6649
 		}
6650 6650
 
6651
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6652
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6653
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6651
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6652
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6653
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6654 6654
 					ORDER BY airport_arrival_icao_count DESC";
6655 6655
 		if ($limit) $query .= " LIMIT 10";
6656 6656
       
@@ -6680,11 +6680,11 @@  discard block
 block discarded – undo
6680 6680
 	}	
6681 6681
 	
6682 6682
 	/**
6683
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6684
-	*
6685
-	* @return Array the airport list
6686
-	*
6687
-	*/
6683
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6684
+	 *
6685
+	 * @return Array the airport list
6686
+	 *
6687
+	 */
6688 6688
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6689 6689
 	{
6690 6690
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6716,11 +6716,11 @@  discard block
 block discarded – undo
6716 6716
 	
6717 6717
 	
6718 6718
 	/**
6719
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6720
-	*
6721
-	* @return Array the airport list
6722
-	*
6723
-	*/
6719
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6720
+	 *
6721
+	 * @return Array the airport list
6722
+	 *
6723
+	 */
6724 6724
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6725 6725
 	{
6726 6726
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6751,11 +6751,11 @@  discard block
 block discarded – undo
6751 6751
 	
6752 6752
 	
6753 6753
 	/**
6754
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6755
-	*
6756
-	* @return Array the airport list
6757
-	*
6758
-	*/
6754
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6755
+	 *
6756
+	 * @return Array the airport list
6757
+	 *
6758
+	 */
6759 6759
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6760 6760
 	{
6761 6761
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6789,11 +6789,11 @@  discard block
 block discarded – undo
6789 6789
 	
6790 6790
 	
6791 6791
 	/**
6792
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6793
-	*
6794
-	* @return Array the airport list
6795
-	*
6796
-	*/
6792
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6793
+	 *
6794
+	 * @return Array the airport list
6795
+	 *
6796
+	 */
6797 6797
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6798 6798
 	{
6799 6799
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6823,11 +6823,11 @@  discard block
 block discarded – undo
6823 6823
 	
6824 6824
 	
6825 6825
 	/**
6826
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6827
-	*
6828
-	* @return Array the airport list
6829
-	*
6830
-	*/
6826
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6827
+	 *
6828
+	 * @return Array the airport list
6829
+	 *
6830
+	 */
6831 6831
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6832 6832
 	{
6833 6833
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6861,11 +6861,11 @@  discard block
 block discarded – undo
6861 6861
 	
6862 6862
 	
6863 6863
 	/**
6864
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6865
-	*
6866
-	* @return Array the airport list
6867
-	*
6868
-	*/
6864
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6865
+	 *
6866
+	 * @return Array the airport list
6867
+	 *
6868
+	 */
6869 6869
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6870 6870
 	{
6871 6871
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6896,11 +6896,11 @@  discard block
 block discarded – undo
6896 6896
 	
6897 6897
 	
6898 6898
 	/**
6899
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6900
-	*
6901
-	* @return Array the airport list
6902
-	*
6903
-	*/
6899
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6900
+	 *
6901
+	 * @return Array the airport list
6902
+	 *
6903
+	 */
6904 6904
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6905 6905
 	{
6906 6906
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6933,11 +6933,11 @@  discard block
 block discarded – undo
6933 6933
 	
6934 6934
 	
6935 6935
 	/**
6936
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6937
-	*
6938
-	* @return Array the airport list
6939
-	*
6940
-	*/
6936
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6937
+	 *
6938
+	 * @return Array the airport list
6939
+	 *
6940
+	 */
6941 6941
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6942 6942
 	{
6943 6943
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6967,11 +6967,11 @@  discard block
 block discarded – undo
6967 6967
 	
6968 6968
 	
6969 6969
 	/**
6970
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6971
-	*
6972
-	* @return Array the airport list
6973
-	*
6974
-	*/
6970
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6971
+	 *
6972
+	 * @return Array the airport list
6973
+	 *
6974
+	 */
6975 6975
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6976 6976
 	{
6977 6977
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7005,11 +7005,11 @@  discard block
 block discarded – undo
7005 7005
 	
7006 7006
 	
7007 7007
 	/**
7008
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7009
-	*
7010
-	* @return Array the airport list
7011
-	*
7012
-	*/
7008
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7009
+	 *
7010
+	 * @return Array the airport list
7011
+	 *
7012
+	 */
7013 7013
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7014 7014
 	{
7015 7015
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7040,11 +7040,11 @@  discard block
 block discarded – undo
7040 7040
 	
7041 7041
 	
7042 7042
 	/**
7043
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7044
-	*
7045
-	* @return Array the airport list
7046
-	*
7047
-	*/
7043
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7044
+	 *
7045
+	 * @return Array the airport list
7046
+	 *
7047
+	 */
7048 7048
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7049 7049
 	{
7050 7050
 		global $globalTimezone, $globalDBdriver;
@@ -7090,11 +7090,11 @@  discard block
 block discarded – undo
7090 7090
 	
7091 7091
 	
7092 7092
 	/**
7093
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7094
-	*
7095
-	* @return Array the airport list
7096
-	*
7097
-	*/
7093
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7094
+	 *
7095
+	 * @return Array the airport list
7096
+	 *
7097
+	 */
7098 7098
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7099 7099
 	{
7100 7100
 		global $globalTimezone, $globalDBdriver;
@@ -7137,11 +7137,11 @@  discard block
 block discarded – undo
7137 7137
 	
7138 7138
 	
7139 7139
 	/**
7140
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7141
-	*
7142
-	* @return Array the airport list
7143
-	*
7144
-	*/
7140
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7141
+	 *
7142
+	 * @return Array the airport list
7143
+	 *
7144
+	 */
7145 7145
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7146 7146
 	{
7147 7147
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7174,11 +7174,11 @@  discard block
 block discarded – undo
7174 7174
 	
7175 7175
 	
7176 7176
 	/**
7177
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7178
-	*
7179
-	* @return Array the airport list
7180
-	*
7181
-	*/
7177
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7178
+	 *
7179
+	 * @return Array the airport list
7180
+	 *
7181
+	 */
7182 7182
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7183 7183
 	{
7184 7184
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7209,11 +7209,11 @@  discard block
 block discarded – undo
7209 7209
 	
7210 7210
 	
7211 7211
 	/**
7212
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7213
-	*
7214
-	* @return Array the airport list
7215
-	*
7216
-	*/
7212
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7213
+	 *
7214
+	 * @return Array the airport list
7215
+	 *
7216
+	 */
7217 7217
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7218 7218
 	{
7219 7219
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7246,11 +7246,11 @@  discard block
 block discarded – undo
7246 7246
 	
7247 7247
 	
7248 7248
 	/**
7249
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7250
-	*
7251
-	* @return Array the airport list
7252
-	*
7253
-	*/
7249
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7250
+	 *
7251
+	 * @return Array the airport list
7252
+	 *
7253
+	 */
7254 7254
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7255 7255
 	{
7256 7256
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7281,11 +7281,11 @@  discard block
 block discarded – undo
7281 7281
 
7282 7282
 
7283 7283
 	/**
7284
-	* Counts all airport departure countries
7285
-	*
7286
-	* @return Array the airport departure list
7287
-	*
7288
-	*/
7284
+	 * Counts all airport departure countries
7285
+	 *
7286
+	 * @return Array the airport departure list
7287
+	 *
7288
+	 */
7289 7289
 	public function countAllDepartureCountries($filters = array())
7290 7290
 	{
7291 7291
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7315,11 +7315,11 @@  discard block
 block discarded – undo
7315 7315
 	
7316 7316
 	
7317 7317
 	/**
7318
-	* Counts all airport arrival countries
7319
-	*
7320
-	* @return Array the airport arrival list
7321
-	*
7322
-	*/
7318
+	 * Counts all airport arrival countries
7319
+	 *
7320
+	 * @return Array the airport arrival list
7321
+	 *
7322
+	 */
7323 7323
 	public function countAllArrivalCountries($limit = true,$filters = array())
7324 7324
 	{
7325 7325
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7352,11 +7352,11 @@  discard block
 block discarded – undo
7352 7352
 
7353 7353
 
7354 7354
 	/**
7355
-	* Gets all route combinations
7356
-	*
7357
-	* @return Array the route list
7358
-	*
7359
-	*/
7355
+	 * Gets all route combinations
7356
+	 *
7357
+	 * @return Array the route list
7358
+	 *
7359
+	 */
7360 7360
 	public function countAllRoutes($filters = array())
7361 7361
 	{
7362 7362
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7395,11 +7395,11 @@  discard block
 block discarded – undo
7395 7395
 	
7396 7396
 	
7397 7397
 	/**
7398
-	* Gets all route combinations based on an aircraft
7399
-	*
7400
-	* @return Array the route list
7401
-	*
7402
-	*/
7398
+	 * Gets all route combinations based on an aircraft
7399
+	 *
7400
+	 * @return Array the route list
7401
+	 *
7402
+	 */
7403 7403
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7404 7404
 	{
7405 7405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7435,11 +7435,11 @@  discard block
 block discarded – undo
7435 7435
 	
7436 7436
 	
7437 7437
 	/**
7438
-	* Gets all route combinations based on an aircraft registration
7439
-	*
7440
-	* @return Array the route list
7441
-	*
7442
-	*/
7438
+	 * Gets all route combinations based on an aircraft registration
7439
+	 *
7440
+	 * @return Array the route list
7441
+	 *
7442
+	 */
7443 7443
 	public function countAllRoutesByRegistration($registration, $filters = array())
7444 7444
 	{
7445 7445
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7477,11 +7477,11 @@  discard block
 block discarded – undo
7477 7477
 	
7478 7478
 	
7479 7479
 	/**
7480
-	* Gets all route combinations based on an airline
7481
-	*
7482
-	* @return Array the route list
7483
-	*
7484
-	*/
7480
+	 * Gets all route combinations based on an airline
7481
+	 *
7482
+	 * @return Array the route list
7483
+	 *
7484
+	 */
7485 7485
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7486 7486
 	{
7487 7487
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7519,11 +7519,11 @@  discard block
 block discarded – undo
7519 7519
 	
7520 7520
 	
7521 7521
 	/**
7522
-	* Gets all route combinations based on an airport
7523
-	*
7524
-	* @return Array the route list
7525
-	*
7526
-	*/
7522
+	 * Gets all route combinations based on an airport
7523
+	 *
7524
+	 * @return Array the route list
7525
+	 *
7526
+	 */
7527 7527
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7528 7528
 	{
7529 7529
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7560,11 +7560,11 @@  discard block
 block discarded – undo
7560 7560
 	
7561 7561
 	
7562 7562
 	/**
7563
-	* Gets all route combinations based on an country
7564
-	*
7565
-	* @return Array the route list
7566
-	*
7567
-	*/
7563
+	 * Gets all route combinations based on an country
7564
+	 *
7565
+	 * @return Array the route list
7566
+	 *
7567
+	 */
7568 7568
 	public function countAllRoutesByCountry($country, $filters = array())
7569 7569
 	{
7570 7570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7600,11 +7600,11 @@  discard block
 block discarded – undo
7600 7600
 
7601 7601
 
7602 7602
 	/**
7603
-	* Gets all route combinations based on an date
7604
-	*
7605
-	* @return Array the route list
7606
-	*
7607
-	*/
7603
+	 * Gets all route combinations based on an date
7604
+	 *
7605
+	 * @return Array the route list
7606
+	 *
7607
+	 */
7608 7608
 	public function countAllRoutesByDate($date, $filters = array())
7609 7609
 	{
7610 7610
 		global $globalTimezone, $globalDBdriver;
@@ -7654,11 +7654,11 @@  discard block
 block discarded – undo
7654 7654
 	
7655 7655
 	
7656 7656
 	/**
7657
-	* Gets all route combinations based on an ident/callsign
7658
-	*
7659
-	* @return Array the route list
7660
-	*
7661
-	*/
7657
+	 * Gets all route combinations based on an ident/callsign
7658
+	 *
7659
+	 * @return Array the route list
7660
+	 *
7661
+	 */
7662 7662
 	public function countAllRoutesByIdent($ident, $filters = array())
7663 7663
 	{
7664 7664
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7695,11 +7695,11 @@  discard block
 block discarded – undo
7695 7695
 	
7696 7696
 	
7697 7697
 	/**
7698
-	* Gets all route combinations based on an manufacturer
7699
-	*
7700
-	* @return Array the route list
7701
-	*
7702
-	*/
7698
+	 * Gets all route combinations based on an manufacturer
7699
+	 *
7700
+	 * @return Array the route list
7701
+	 *
7702
+	 */
7703 7703
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7704 7704
 	{
7705 7705
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7737,11 +7737,11 @@  discard block
 block discarded – undo
7737 7737
 	
7738 7738
 	
7739 7739
 	/**
7740
-	* Gets all route combinations with waypoints
7741
-	*
7742
-	* @return Array the route list
7743
-	*
7744
-	*/
7740
+	 * Gets all route combinations with waypoints
7741
+	 *
7742
+	 * @return Array the route list
7743
+	 *
7744
+	 */
7745 7745
 	public function countAllRoutesWithWaypoints($filters = array())
7746 7746
 	{
7747 7747
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7778,11 +7778,11 @@  discard block
 block discarded – undo
7778 7778
 	}
7779 7779
 	
7780 7780
 	/**
7781
-	* Gets all callsigns that have flown over
7782
-	*
7783
-	* @return Array the callsign list
7784
-	*
7785
-	*/
7781
+	 * Gets all callsigns that have flown over
7782
+	 *
7783
+	 * @return Array the callsign list
7784
+	 *
7785
+	 */
7786 7786
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7787 7787
 	{
7788 7788
 		global $globalDBdriver;
@@ -7820,11 +7820,11 @@  discard block
 block discarded – undo
7820 7820
 	}
7821 7821
 
7822 7822
 	/**
7823
-	* Gets all callsigns that have flown over
7824
-	*
7825
-	* @return Array the callsign list
7826
-	*
7827
-	*/
7823
+	 * Gets all callsigns that have flown over
7824
+	 *
7825
+	 * @return Array the callsign list
7826
+	 *
7827
+	 */
7828 7828
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7829 7829
 	{
7830 7830
 		global $globalDBdriver;
@@ -7865,11 +7865,11 @@  discard block
 block discarded – undo
7865 7865
 
7866 7866
 
7867 7867
 	/**
7868
-	* Counts all dates
7869
-	*
7870
-	* @return Array the date list
7871
-	*
7872
-	*/
7868
+	 * Counts all dates
7869
+	 *
7870
+	 * @return Array the date list
7871
+	 *
7872
+	 */
7873 7873
 	public function countAllDates($filters = array())
7874 7874
 	{
7875 7875
 		global $globalTimezone, $globalDBdriver;
@@ -7914,11 +7914,11 @@  discard block
 block discarded – undo
7914 7914
 	}
7915 7915
 	
7916 7916
 	/**
7917
-	* Counts all dates
7918
-	*
7919
-	* @return Array the date list
7920
-	*
7921
-	*/
7917
+	 * Counts all dates
7918
+	 *
7919
+	 * @return Array the date list
7920
+	 *
7921
+	 */
7922 7922
 	public function countAllDatesByAirlines($filters = array())
7923 7923
 	{
7924 7924
 		global $globalTimezone, $globalDBdriver;
@@ -7963,11 +7963,11 @@  discard block
 block discarded – undo
7963 7963
 	}	
7964 7964
 	
7965 7965
 	/**
7966
-	* Counts all dates during the last 7 days
7967
-	*
7968
-	* @return Array the date list
7969
-	*
7970
-	*/
7966
+	 * Counts all dates during the last 7 days
7967
+	 *
7968
+	 * @return Array the date list
7969
+	 *
7970
+	 */
7971 7971
 	public function countAllDatesLast7Days($filters = array())
7972 7972
 	{
7973 7973
 		global $globalTimezone, $globalDBdriver;
@@ -7989,7 +7989,7 @@  discard block
 block discarded – undo
7989 7989
 			$query .= " GROUP BY date_name 
7990 7990
 								ORDER BY date_name ASC";
7991 7991
 			$query_data = array(':offset' => $offset);
7992
-    		}
7992
+			}
7993 7993
 		
7994 7994
 		$sth = $this->db->prepare($query);
7995 7995
 		$sth->execute($query_data);
@@ -8009,11 +8009,11 @@  discard block
 block discarded – undo
8009 8009
 	}
8010 8010
 
8011 8011
 	/**
8012
-	* Counts all dates during the last month
8013
-	*
8014
-	* @return Array the date list
8015
-	*
8016
-	*/
8012
+	 * Counts all dates during the last month
8013
+	 *
8014
+	 * @return Array the date list
8015
+	 *
8016
+	 */
8017 8017
 	public function countAllDatesLastMonth($filters = array())
8018 8018
 	{
8019 8019
 		global $globalTimezone, $globalDBdriver;
@@ -8035,7 +8035,7 @@  discard block
 block discarded – undo
8035 8035
 			$query .= " GROUP BY date_name 
8036 8036
 								ORDER BY date_name ASC";
8037 8037
 			$query_data = array(':offset' => $offset);
8038
-    		}
8038
+			}
8039 8039
 		
8040 8040
 		$sth = $this->db->prepare($query);
8041 8041
 		$sth->execute($query_data);
@@ -8056,11 +8056,11 @@  discard block
 block discarded – undo
8056 8056
 
8057 8057
 
8058 8058
 	/**
8059
-	* Counts all dates during the last month
8060
-	*
8061
-	* @return Array the date list
8062
-	*
8063
-	*/
8059
+	 * Counts all dates during the last month
8060
+	 *
8061
+	 * @return Array the date list
8062
+	 *
8063
+	 */
8064 8064
 	public function countAllDatesLastMonthByAirlines($filters = array())
8065 8065
 	{
8066 8066
 		global $globalTimezone, $globalDBdriver;
@@ -8083,7 +8083,7 @@  discard block
 block discarded – undo
8083 8083
 								GROUP BY spotter_output.airline_icao, date_name 
8084 8084
 								ORDER BY date_name ASC";
8085 8085
 			$query_data = array(':offset' => $offset);
8086
-    		}
8086
+			}
8087 8087
 		
8088 8088
 		$sth = $this->db->prepare($query);
8089 8089
 		$sth->execute($query_data);
@@ -8105,11 +8105,11 @@  discard block
 block discarded – undo
8105 8105
 	
8106 8106
 
8107 8107
 	/**
8108
-	* Counts all month
8109
-	*
8110
-	* @return Array the month list
8111
-	*
8112
-	*/
8108
+	 * Counts all month
8109
+	 *
8110
+	 * @return Array the month list
8111
+	 *
8112
+	 */
8113 8113
 	public function countAllMonths($filters = array())
8114 8114
 	{
8115 8115
 		global $globalTimezone, $globalDBdriver;
@@ -8151,11 +8151,11 @@  discard block
 block discarded – undo
8151 8151
 	}
8152 8152
 
8153 8153
 	/**
8154
-	* Counts all month
8155
-	*
8156
-	* @return Array the month list
8157
-	*
8158
-	*/
8154
+	 * Counts all month
8155
+	 *
8156
+	 * @return Array the month list
8157
+	 *
8158
+	 */
8159 8159
 	public function countAllMonthsByAirlines($filters = array())
8160 8160
 	{
8161 8161
 		global $globalTimezone, $globalDBdriver;
@@ -8200,11 +8200,11 @@  discard block
 block discarded – undo
8200 8200
 	}
8201 8201
 
8202 8202
 	/**
8203
-	* Counts all military month
8204
-	*
8205
-	* @return Array the month list
8206
-	*
8207
-	*/
8203
+	 * Counts all military month
8204
+	 *
8205
+	 * @return Array the month list
8206
+	 *
8207
+	 */
8208 8208
 	public function countAllMilitaryMonths($filters = array())
8209 8209
 	{
8210 8210
 		global $globalTimezone, $globalDBdriver;
@@ -8245,11 +8245,11 @@  discard block
 block discarded – undo
8245 8245
 	}
8246 8246
 	
8247 8247
 	/**
8248
-	* Counts all month owners
8249
-	*
8250
-	* @return Array the month list
8251
-	*
8252
-	*/
8248
+	 * Counts all month owners
8249
+	 *
8250
+	 * @return Array the month list
8251
+	 *
8252
+	 */
8253 8253
 	public function countAllMonthsOwners($filters = array())
8254 8254
 	{
8255 8255
 		global $globalTimezone, $globalDBdriver;
@@ -8291,11 +8291,11 @@  discard block
 block discarded – undo
8291 8291
 	}
8292 8292
 	
8293 8293
 	/**
8294
-	* Counts all month owners
8295
-	*
8296
-	* @return Array the month list
8297
-	*
8298
-	*/
8294
+	 * Counts all month owners
8295
+	 *
8296
+	 * @return Array the month list
8297
+	 *
8298
+	 */
8299 8299
 	public function countAllMonthsOwnersByAirlines($filters = array())
8300 8300
 	{
8301 8301
 		global $globalTimezone, $globalDBdriver;
@@ -8338,11 +8338,11 @@  discard block
 block discarded – undo
8338 8338
 	}
8339 8339
 
8340 8340
 	/**
8341
-	* Counts all month pilot
8342
-	*
8343
-	* @return Array the month list
8344
-	*
8345
-	*/
8341
+	 * Counts all month pilot
8342
+	 *
8343
+	 * @return Array the month list
8344
+	 *
8345
+	 */
8346 8346
 	public function countAllMonthsPilots($filters = array())
8347 8347
 	{
8348 8348
 		global $globalTimezone, $globalDBdriver;
@@ -8384,11 +8384,11 @@  discard block
 block discarded – undo
8384 8384
 	}
8385 8385
 	
8386 8386
 	/**
8387
-	* Counts all month pilot
8388
-	*
8389
-	* @return Array the month list
8390
-	*
8391
-	*/
8387
+	 * Counts all month pilot
8388
+	 *
8389
+	 * @return Array the month list
8390
+	 *
8391
+	 */
8392 8392
 	public function countAllMonthsPilotsByAirlines($filters = array())
8393 8393
 	{
8394 8394
 		global $globalTimezone, $globalDBdriver;
@@ -8431,11 +8431,11 @@  discard block
 block discarded – undo
8431 8431
 	}
8432 8432
 
8433 8433
 	/**
8434
-	* Counts all month airline
8435
-	*
8436
-	* @return Array the month list
8437
-	*
8438
-	*/
8434
+	 * Counts all month airline
8435
+	 *
8436
+	 * @return Array the month list
8437
+	 *
8438
+	 */
8439 8439
 	public function countAllMonthsAirlines($filters = array())
8440 8440
 	{
8441 8441
 		global $globalTimezone, $globalDBdriver;
@@ -8477,11 +8477,11 @@  discard block
 block discarded – undo
8477 8477
 	}
8478 8478
 	
8479 8479
 	/**
8480
-	* Counts all month aircraft
8481
-	*
8482
-	* @return Array the month list
8483
-	*
8484
-	*/
8480
+	 * Counts all month aircraft
8481
+	 *
8482
+	 * @return Array the month list
8483
+	 *
8484
+	 */
8485 8485
 	public function countAllMonthsAircrafts($filters = array())
8486 8486
 	{
8487 8487
 		global $globalTimezone, $globalDBdriver;
@@ -8524,11 +8524,11 @@  discard block
 block discarded – undo
8524 8524
 	
8525 8525
 
8526 8526
 	/**
8527
-	* Counts all month aircraft
8528
-	*
8529
-	* @return Array the month list
8530
-	*
8531
-	*/
8527
+	 * Counts all month aircraft
8528
+	 *
8529
+	 * @return Array the month list
8530
+	 *
8531
+	 */
8532 8532
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8533 8533
 	{
8534 8534
 		global $globalTimezone, $globalDBdriver;
@@ -8571,11 +8571,11 @@  discard block
 block discarded – undo
8571 8571
 	}
8572 8572
 
8573 8573
 	/**
8574
-	* Counts all month real arrival
8575
-	*
8576
-	* @return Array the month list
8577
-	*
8578
-	*/
8574
+	 * Counts all month real arrival
8575
+	 *
8576
+	 * @return Array the month list
8577
+	 *
8578
+	 */
8579 8579
 	public function countAllMonthsRealArrivals($filters = array())
8580 8580
 	{
8581 8581
 		global $globalTimezone, $globalDBdriver;
@@ -8618,11 +8618,11 @@  discard block
 block discarded – undo
8618 8618
 	
8619 8619
 
8620 8620
 	/**
8621
-	* Counts all month real arrival
8622
-	*
8623
-	* @return Array the month list
8624
-	*
8625
-	*/
8621
+	 * Counts all month real arrival
8622
+	 *
8623
+	 * @return Array the month list
8624
+	 *
8625
+	 */
8626 8626
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8627 8627
 	{
8628 8628
 		global $globalTimezone, $globalDBdriver;
@@ -8666,11 +8666,11 @@  discard block
 block discarded – undo
8666 8666
 	
8667 8667
 
8668 8668
 	/**
8669
-	* Counts all dates during the last year
8670
-	*
8671
-	* @return Array the date list
8672
-	*
8673
-	*/
8669
+	 * Counts all dates during the last year
8670
+	 *
8671
+	 * @return Array the date list
8672
+	 *
8673
+	 */
8674 8674
 	public function countAllMonthsLastYear($filters)
8675 8675
 	{
8676 8676
 		global $globalTimezone, $globalDBdriver;
@@ -8692,7 +8692,7 @@  discard block
 block discarded – undo
8692 8692
 			$query .= " GROUP BY year_name, month_name
8693 8693
 								ORDER BY year_name, month_name ASC";
8694 8694
 			$query_data = array(':offset' => $offset);
8695
-    		}
8695
+			}
8696 8696
 		
8697 8697
 		$sth = $this->db->prepare($query);
8698 8698
 		$sth->execute($query_data);
@@ -8715,11 +8715,11 @@  discard block
 block discarded – undo
8715 8715
 	
8716 8716
 	
8717 8717
 	/**
8718
-	* Counts all hours
8719
-	*
8720
-	* @return Array the hour list
8721
-	*
8722
-	*/
8718
+	 * Counts all hours
8719
+	 *
8720
+	 * @return Array the hour list
8721
+	 *
8722
+	 */
8723 8723
 	public function countAllHours($orderby,$filters = array())
8724 8724
 	{
8725 8725
 		global $globalTimezone, $globalDBdriver;
@@ -8780,11 +8780,11 @@  discard block
 block discarded – undo
8780 8780
 	}
8781 8781
 	
8782 8782
 	/**
8783
-	* Counts all hours
8784
-	*
8785
-	* @return Array the hour list
8786
-	*
8787
-	*/
8783
+	 * Counts all hours
8784
+	 *
8785
+	 * @return Array the hour list
8786
+	 *
8787
+	 */
8788 8788
 	public function countAllHoursByAirlines($orderby, $filters = array())
8789 8789
 	{
8790 8790
 		global $globalTimezone, $globalDBdriver;
@@ -8847,11 +8847,11 @@  discard block
 block discarded – undo
8847 8847
 
8848 8848
 
8849 8849
 	/**
8850
-	* Counts all hours by airline
8851
-	*
8852
-	* @return Array the hour list
8853
-	*
8854
-	*/
8850
+	 * Counts all hours by airline
8851
+	 *
8852
+	 * @return Array the hour list
8853
+	 *
8854
+	 */
8855 8855
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8856 8856
 	{
8857 8857
 		global $globalTimezone, $globalDBdriver;
@@ -8897,11 +8897,11 @@  discard block
 block discarded – undo
8897 8897
 	
8898 8898
 	
8899 8899
 	/**
8900
-	* Counts all hours by aircraft
8901
-	*
8902
-	* @return Array the hour list
8903
-	*
8904
-	*/
8900
+	 * Counts all hours by aircraft
8901
+	 *
8902
+	 * @return Array the hour list
8903
+	 *
8904
+	 */
8905 8905
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8906 8906
 	{
8907 8907
 		global $globalTimezone, $globalDBdriver;
@@ -8944,11 +8944,11 @@  discard block
 block discarded – undo
8944 8944
 	
8945 8945
 	
8946 8946
 	/**
8947
-	* Counts all hours by aircraft registration
8948
-	*
8949
-	* @return Array the hour list
8950
-	*
8951
-	*/
8947
+	 * Counts all hours by aircraft registration
8948
+	 *
8949
+	 * @return Array the hour list
8950
+	 *
8951
+	 */
8952 8952
 	public function countAllHoursByRegistration($registration, $filters = array())
8953 8953
 	{
8954 8954
 		global $globalTimezone, $globalDBdriver;
@@ -8991,11 +8991,11 @@  discard block
 block discarded – undo
8991 8991
 	
8992 8992
 	
8993 8993
 	/**
8994
-	* Counts all hours by airport
8995
-	*
8996
-	* @return Array the hour list
8997
-	*
8998
-	*/
8994
+	 * Counts all hours by airport
8995
+	 *
8996
+	 * @return Array the hour list
8997
+	 *
8998
+	 */
8999 8999
 	public function countAllHoursByAirport($airport_icao, $filters = array())
9000 9000
 	{
9001 9001
 		global $globalTimezone, $globalDBdriver;
@@ -9039,11 +9039,11 @@  discard block
 block discarded – undo
9039 9039
 	
9040 9040
 	
9041 9041
 	/**
9042
-	* Counts all hours by manufacturer
9043
-	*
9044
-	* @return Array the hour list
9045
-	*
9046
-	*/
9042
+	 * Counts all hours by manufacturer
9043
+	 *
9044
+	 * @return Array the hour list
9045
+	 *
9046
+	 */
9047 9047
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9048 9048
 	{
9049 9049
 		global $globalTimezone, $globalDBdriver;
@@ -9087,11 +9087,11 @@  discard block
 block discarded – undo
9087 9087
 	
9088 9088
 	
9089 9089
 	/**
9090
-	* Counts all hours by date
9091
-	*
9092
-	* @return Array the hour list
9093
-	*
9094
-	*/
9090
+	 * Counts all hours by date
9091
+	 *
9092
+	 * @return Array the hour list
9093
+	 *
9094
+	 */
9095 9095
 	public function countAllHoursByDate($date, $filters = array())
9096 9096
 	{
9097 9097
 		global $globalTimezone, $globalDBdriver;
@@ -9135,11 +9135,11 @@  discard block
 block discarded – undo
9135 9135
 	
9136 9136
 	
9137 9137
 	/**
9138
-	* Counts all hours by a ident/callsign
9139
-	*
9140
-	* @return Array the hour list
9141
-	*
9142
-	*/
9138
+	 * Counts all hours by a ident/callsign
9139
+	 *
9140
+	 * @return Array the hour list
9141
+	 *
9142
+	 */
9143 9143
 	public function countAllHoursByIdent($ident, $filters = array())
9144 9144
 	{
9145 9145
 		global $globalTimezone, $globalDBdriver;
@@ -9184,11 +9184,11 @@  discard block
 block discarded – undo
9184 9184
 	
9185 9185
 	
9186 9186
 	/**
9187
-	* Counts all hours by route
9188
-	*
9189
-	* @return Array the hour list
9190
-	*
9191
-	*/
9187
+	 * Counts all hours by route
9188
+	 *
9189
+	 * @return Array the hour list
9190
+	 *
9191
+	 */
9192 9192
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9193 9193
 	{
9194 9194
 		global $globalTimezone, $globalDBdriver;
@@ -9232,11 +9232,11 @@  discard block
 block discarded – undo
9232 9232
 	
9233 9233
 	
9234 9234
 	/**
9235
-	* Counts all hours by country
9236
-	*
9237
-	* @return Array the hour list
9238
-	*
9239
-	*/
9235
+	 * Counts all hours by country
9236
+	 *
9237
+	 * @return Array the hour list
9238
+	 *
9239
+	 */
9240 9240
 	public function countAllHoursByCountry($country, $filters = array())
9241 9241
 	{
9242 9242
 		global $globalTimezone, $globalDBdriver;
@@ -9281,11 +9281,11 @@  discard block
 block discarded – undo
9281 9281
 
9282 9282
 
9283 9283
 	/**
9284
-	* Counts all aircraft that have flown over
9285
-	*
9286
-	* @return Integer the number of aircrafts
9287
-	*
9288
-	*/
9284
+	 * Counts all aircraft that have flown over
9285
+	 *
9286
+	 * @return Integer the number of aircrafts
9287
+	 *
9288
+	 */
9289 9289
 	public function countOverallAircrafts($filters = array())
9290 9290
 	{
9291 9291
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9297,11 +9297,11 @@  discard block
 block discarded – undo
9297 9297
 	}
9298 9298
 
9299 9299
 	/**
9300
-	* Counts all flight that really arrival
9301
-	*
9302
-	* @return Integer the number of aircrafts
9303
-	*
9304
-	*/
9300
+	 * Counts all flight that really arrival
9301
+	 *
9302
+	 * @return Integer the number of aircrafts
9303
+	 *
9304
+	 */
9305 9305
 	public function countOverallArrival($filters = array())
9306 9306
 	{
9307 9307
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9314,11 +9314,11 @@  discard block
 block discarded – undo
9314 9314
 	}
9315 9315
 
9316 9316
 	/**
9317
-	* Counts all pilots that have flown over
9318
-	*
9319
-	* @return Integer the number of pilots
9320
-	*
9321
-	*/
9317
+	 * Counts all pilots that have flown over
9318
+	 *
9319
+	 * @return Integer the number of pilots
9320
+	 *
9321
+	 */
9322 9322
 	public function countOverallPilots($filters = array())
9323 9323
 	{
9324 9324
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9330,11 +9330,11 @@  discard block
 block discarded – undo
9330 9330
 	}
9331 9331
 
9332 9332
 	/**
9333
-	* Counts all owners that have flown over
9334
-	*
9335
-	* @return Integer the number of owners
9336
-	*
9337
-	*/
9333
+	 * Counts all owners that have flown over
9334
+	 *
9335
+	 * @return Integer the number of owners
9336
+	 *
9337
+	 */
9338 9338
 	public function countOverallOwners($filters = array())
9339 9339
 	{
9340 9340
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9347,11 +9347,11 @@  discard block
 block discarded – undo
9347 9347
 	
9348 9348
 	
9349 9349
 	/**
9350
-	* Counts all flights that have flown over
9351
-	*
9352
-	* @return Integer the number of flights
9353
-	*
9354
-	*/
9350
+	 * Counts all flights that have flown over
9351
+	 *
9352
+	 * @return Integer the number of flights
9353
+	 *
9354
+	 */
9355 9355
 	public function countOverallFlights($filters = array())
9356 9356
 	{
9357 9357
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9364,11 +9364,11 @@  discard block
 block discarded – undo
9364 9364
 	}
9365 9365
 	
9366 9366
 	/**
9367
-	* Counts all military flights that have flown over
9368
-	*
9369
-	* @return Integer the number of flights
9370
-	*
9371
-	*/
9367
+	 * Counts all military flights that have flown over
9368
+	 *
9369
+	 * @return Integer the number of flights
9370
+	 *
9371
+	 */
9372 9372
 	public function countOverallMilitaryFlights($filters = array())
9373 9373
 	{
9374 9374
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9383,11 +9383,11 @@  discard block
 block discarded – undo
9383 9383
 	
9384 9384
 	
9385 9385
 	/**
9386
-	* Counts all airlines that have flown over
9387
-	*
9388
-	* @return Integer the number of airlines
9389
-	*
9390
-	*/
9386
+	 * Counts all airlines that have flown over
9387
+	 *
9388
+	 * @return Integer the number of airlines
9389
+	 *
9390
+	 */
9391 9391
 	public function countOverallAirlines($filters = array())
9392 9392
 	{
9393 9393
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9401,11 +9401,11 @@  discard block
 block discarded – undo
9401 9401
 
9402 9402
   
9403 9403
 	/**
9404
-	* Counts all hours of today
9405
-	*
9406
-	* @return Array the hour list
9407
-	*
9408
-	*/
9404
+	 * Counts all hours of today
9405
+	 *
9406
+	 * @return Array the hour list
9407
+	 *
9408
+	 */
9409 9409
 	public function countAllHoursFromToday($filters = array())
9410 9410
 	{
9411 9411
 		global $globalTimezone, $globalDBdriver;
@@ -9445,11 +9445,11 @@  discard block
 block discarded – undo
9445 9445
 	}
9446 9446
     
9447 9447
 	/**
9448
-	* Gets all the spotter information based on calculated upcoming flights
9449
-	*
9450
-	* @return Array the spotter information
9451
-	*
9452
-	*/
9448
+	 * Gets all the spotter information based on calculated upcoming flights
9449
+	 *
9450
+	 * @return Array the spotter information
9451
+	 *
9452
+	 */
9453 9453
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9454 9454
 	{
9455 9455
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9524,12 +9524,12 @@  discard block
 block discarded – undo
9524 9524
 	}
9525 9525
     
9526 9526
     
9527
-     /**
9528
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9529
-	*
9530
-	* @return Integer the Barrie Spotter ID
9527
+	 /**
9528
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9529
+	  *
9530
+	  * @return Integer the Barrie Spotter ID
9531 9531
 q	*
9532
-	*/
9532
+	  */
9533 9533
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9534 9534
 	{
9535 9535
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9550,13 +9550,13 @@  discard block
 block discarded – undo
9550 9550
   
9551 9551
  
9552 9552
 	/**
9553
-	* Parses a date string
9554
-	*
9555
-	* @param String $dateString the date string
9556
-	* @param String $timezone the timezone of a user
9557
-	* @return Array the time information
9558
-	*
9559
-	*/
9553
+	 * Parses a date string
9554
+	 *
9555
+	 * @param String $dateString the date string
9556
+	 * @param String $timezone the timezone of a user
9557
+	 * @return Array the time information
9558
+	 *
9559
+	 */
9560 9560
 	public function parseDateString($dateString, $timezone = '')
9561 9561
 	{
9562 9562
 		$time_array = array();
@@ -9592,12 +9592,12 @@  discard block
 block discarded – undo
9592 9592
 	
9593 9593
 	
9594 9594
 	/**
9595
-	* Parses the direction degrees to working
9596
-	*
9597
-	* @param Float $direction the direction in degrees
9598
-	* @return Array the direction information
9599
-	*
9600
-	*/
9595
+	 * Parses the direction degrees to working
9596
+	 *
9597
+	 * @param Float $direction the direction in degrees
9598
+	 * @return Array the direction information
9599
+	 *
9600
+	 */
9601 9601
 	public function parseDirection($direction = 0)
9602 9602
 	{
9603 9603
 		if ($direction == '') $direction = 0;
@@ -9676,12 +9676,12 @@  discard block
 block discarded – undo
9676 9676
 	
9677 9677
 	
9678 9678
 	/**
9679
-	* Gets the aircraft registration
9680
-	*
9681
-	* @param String $flightaware_id the flight aware id
9682
-	* @return String the aircraft registration
9683
-	*
9684
-	*/
9679
+	 * Gets the aircraft registration
9680
+	 *
9681
+	 * @param String $flightaware_id the flight aware id
9682
+	 * @return String the aircraft registration
9683
+	 *
9684
+	 */
9685 9685
 	
9686 9686
 	public function getAircraftRegistration($flightaware_id)
9687 9687
 	{
@@ -9710,12 +9710,12 @@  discard block
 block discarded – undo
9710 9710
 
9711 9711
 
9712 9712
 	/**
9713
-	* Gets the aircraft registration from ModeS
9714
-	*
9715
-	* @param String $aircraft_modes the flight ModeS in hex
9716
-	* @return String the aircraft registration
9717
-	*
9718
-	*/
9713
+	 * Gets the aircraft registration from ModeS
9714
+	 *
9715
+	 * @param String $aircraft_modes the flight ModeS in hex
9716
+	 * @return String the aircraft registration
9717
+	 *
9718
+	 */
9719 9719
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9720 9720
 	{
9721 9721
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9728,19 +9728,19 @@  discard block
 block discarded – undo
9728 9728
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9729 9729
 		$sth->closeCursor();
9730 9730
 		if (count($row) > 0) {
9731
-		    //return $row['Registration'];
9732
-		    return $row['registration'];
9731
+			//return $row['Registration'];
9732
+			return $row['registration'];
9733 9733
 		} else return '';
9734 9734
 	
9735 9735
 	}
9736 9736
 
9737 9737
 	/**
9738
-	* Gets the aircraft type from ModeS
9739
-	*
9740
-	* @param String $aircraft_modes the flight ModeS in hex
9741
-	* @return String the aircraft type
9742
-	*
9743
-	*/
9738
+	 * Gets the aircraft type from ModeS
9739
+	 *
9740
+	 * @param String $aircraft_modes the flight ModeS in hex
9741
+	 * @return String the aircraft type
9742
+	 *
9743
+	 */
9744 9744
 	public function getAircraftTypeBymodeS($aircraft_modes)
9745 9745
 	{
9746 9746
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9753,19 +9753,19 @@  discard block
 block discarded – undo
9753 9753
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9754 9754
 		$sth->closeCursor();
9755 9755
 		if (count($row) > 0) {
9756
-		    if ($row['type_flight'] == null) return '';
9757
-		    else return $row['type_flight'];
9756
+			if ($row['type_flight'] == null) return '';
9757
+			else return $row['type_flight'];
9758 9758
 		} else return '';
9759 9759
 	
9760 9760
 	}
9761 9761
 
9762 9762
 	/**
9763
-	* Gets Country from latitude/longitude
9764
-	*
9765
-	* @param Float $latitude latitute of the flight
9766
-	* @param Float $longitude longitute of the flight
9767
-	* @return String the countrie
9768
-	*/
9763
+	 * Gets Country from latitude/longitude
9764
+	 *
9765
+	 * @param Float $latitude latitute of the flight
9766
+	 * @param Float $longitude longitute of the flight
9767
+	 * @return String the countrie
9768
+	 */
9769 9769
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9770 9770
 	{
9771 9771
 		global $globalDBdriver, $globalDebug;
@@ -9802,11 +9802,11 @@  discard block
 block discarded – undo
9802 9802
 	}
9803 9803
 
9804 9804
 	/**
9805
-	* Gets Country from iso2
9806
-	*
9807
-	* @param String $iso2 ISO2 country code
9808
-	* @return String the countrie
9809
-	*/
9805
+	 * Gets Country from iso2
9806
+	 *
9807
+	 * @param String $iso2 ISO2 country code
9808
+	 * @return String the countrie
9809
+	 */
9810 9810
 	public function getCountryFromISO2($iso2)
9811 9811
 	{
9812 9812
 		global $globalDBdriver, $globalDebug;
@@ -9834,12 +9834,12 @@  discard block
 block discarded – undo
9834 9834
 	}
9835 9835
 
9836 9836
 	/**
9837
-	* converts the registration code using the country prefix
9838
-	*
9839
-	* @param String $registration the aircraft registration
9840
-	* @return String the aircraft registration
9841
-	*
9842
-	*/
9837
+	 * converts the registration code using the country prefix
9838
+	 *
9839
+	 * @param String $registration the aircraft registration
9840
+	 * @return String the aircraft registration
9841
+	 *
9842
+	 */
9843 9843
 	public function convertAircraftRegistration($registration)
9844 9844
 	{
9845 9845
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9891,12 +9891,12 @@  discard block
 block discarded – undo
9891 9891
 	}
9892 9892
 
9893 9893
 	/**
9894
-	* Country from the registration code
9895
-	*
9896
-	* @param String $registration the aircraft registration
9897
-	* @return String the country
9898
-	*
9899
-	*/
9894
+	 * Country from the registration code
9895
+	 *
9896
+	 * @param String $registration the aircraft registration
9897
+	 * @return String the country
9898
+	 *
9899
+	 */
9900 9900
 	public function countryFromAircraftRegistration($registration)
9901 9901
 	{
9902 9902
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9915,8 +9915,8 @@  discard block
 block discarded – undo
9915 9915
 				$country = $row['country'];
9916 9916
 			}
9917 9917
 		} else {
9918
-    			$registration_1 = substr($registration, 0, 1);
9919
-		        $registration_2 = substr($registration, 0, 2);
9918
+				$registration_1 = substr($registration, 0, 1);
9919
+				$registration_2 = substr($registration, 0, 2);
9920 9920
 
9921 9921
 			$country = '';
9922 9922
 			//first get the prefix based on two characters
@@ -9952,12 +9952,12 @@  discard block
 block discarded – undo
9952 9952
 	}
9953 9953
 
9954 9954
 	/**
9955
-	* Registration prefix from the registration code
9956
-	*
9957
-	* @param String $registration the aircraft registration
9958
-	* @return String the registration prefix
9959
-	*
9960
-	*/
9955
+	 * Registration prefix from the registration code
9956
+	 *
9957
+	 * @param String $registration the aircraft registration
9958
+	 * @return String the registration prefix
9959
+	 *
9960
+	 */
9961 9961
 	public function registrationPrefixFromAircraftRegistration($registration)
9962 9962
 	{
9963 9963
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9976,8 +9976,8 @@  discard block
 block discarded – undo
9976 9976
 				//$country = $row['country'];
9977 9977
 			}
9978 9978
 		} else {
9979
-    			$registration_1 = substr($registration, 0, 1);
9980
-		        $registration_2 = substr($registration, 0, 2);
9979
+				$registration_1 = substr($registration, 0, 1);
9980
+				$registration_2 = substr($registration, 0, 2);
9981 9981
 
9982 9982
 			//first get the prefix based on two characters
9983 9983
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -10013,12 +10013,12 @@  discard block
 block discarded – undo
10013 10013
 
10014 10014
 
10015 10015
 	/**
10016
-	* Country from the registration code
10017
-	*
10018
-	* @param String $registration the aircraft registration
10019
-	* @return String the country
10020
-	*
10021
-	*/
10016
+	 * Country from the registration code
10017
+	 *
10018
+	 * @param String $registration the aircraft registration
10019
+	 * @return String the country
10020
+	 *
10021
+	 */
10022 10022
 	public function countryFromAircraftRegistrationCode($registration)
10023 10023
 	{
10024 10024
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -10035,11 +10035,11 @@  discard block
 block discarded – undo
10035 10035
 	}
10036 10036
 	
10037 10037
 	/**
10038
-	* Set a new highlight value for a flight
10039
-	*
10040
-	* @param String $flightaware_id flightaware_id from spotter_output table
10041
-	* @param String $highlight New highlight value
10042
-	*/
10038
+	 * Set a new highlight value for a flight
10039
+	 *
10040
+	 * @param String $flightaware_id flightaware_id from spotter_output table
10041
+	 * @param String $highlight New highlight value
10042
+	 */
10043 10043
 	public function setHighlightFlight($flightaware_id,$highlight) {
10044 10044
 		
10045 10045
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -10048,12 +10048,12 @@  discard block
 block discarded – undo
10048 10048
 	}
10049 10049
 
10050 10050
 	/**
10051
-	* Set a new highlight value for a flight by Registration
10052
-	*
10053
-	* @param String $registration Registration of the aircraft
10054
-	* @param String $date Date of spotted aircraft
10055
-	* @param String $highlight New highlight value
10056
-	*/
10051
+	 * Set a new highlight value for a flight by Registration
10052
+	 *
10053
+	 * @param String $registration Registration of the aircraft
10054
+	 * @param String $date Date of spotted aircraft
10055
+	 * @param String $highlight New highlight value
10056
+	 */
10057 10057
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
10058 10058
 		if ($date == '') {
10059 10059
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -10067,12 +10067,12 @@  discard block
 block discarded – undo
10067 10067
 	}
10068 10068
 	
10069 10069
 	/**
10070
-	* Gets the short url from bit.ly
10071
-	*
10072
-	* @param String $url the full url
10073
-	* @return String the bit.ly url
10074
-	*
10075
-	*/
10070
+	 * Gets the short url from bit.ly
10071
+	 *
10072
+	 * @param String $url the full url
10073
+	 * @return String the bit.ly url
10074
+	 *
10075
+	 */
10076 10076
 	public function getBitlyURL($url)
10077 10077
 	{
10078 10078
 		global $globalBitlyAccessToken;
@@ -10361,11 +10361,11 @@  discard block
 block discarded – undo
10361 10361
 			$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 
10362 10362
 	                      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)) 
10363 10363
 	                      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;";
10364
-                } else {
10364
+				} else {
10365 10365
 			$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 
10366 10366
 	                      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)) 
10367 10367
 	                      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;";
10368
-    		}
10368
+			}
10369 10369
 		$sth = $this->db->prepare($query);
10370 10370
 		$sth->execute();
10371 10371
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1026 added lines, -1026 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
 			{
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 		$query_values = array();
1288 1288
 		$limit_query = '';
1289 1289
 		$additional_query = '';
1290
-		$filter_query = $this->getFilter($filter,true,true);
1290
+		$filter_query = $this->getFilter($filter, true, true);
1291 1291
 		
1292 1292
 		if ($aircraft_type != "")
1293 1293
 		{
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
 		{
1305 1305
 			$limit_array = explode(",", $limit);
1306 1306
 			
1307
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1308
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1307
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1308
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1309 1309
 			
1310 1310
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1311 1311
 			{
@@ -1361,8 +1361,8 @@  discard block
 block discarded – undo
1361 1361
 		{
1362 1362
 			$limit_array = explode(",", $limit);
1363 1363
 			
1364
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1365
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1364
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1365
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1366 1366
 			
1367 1367
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1368 1368
 			{
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
 		} else {
1379 1379
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1380 1380
 		}
1381
-		$filter_query = $this->getFilter($filter,true,true);
1381
+		$filter_query = $this->getFilter($filter, true, true);
1382 1382
 
1383 1383
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1384 1384
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
 	* @return Array the spotter information
1398 1398
 	*
1399 1399
 	*/
1400
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1400
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1401 1401
 	{
1402 1402
 		global $global_query;
1403 1403
 		
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 		$query_values = array();
1407 1407
 		$limit_query = '';
1408 1408
 		$additional_query = '';
1409
-		$filter_query = $this->getFilter($filters,true,true);
1409
+		$filter_query = $this->getFilter($filters, true, true);
1410 1410
 		
1411 1411
 		if ($airline != "")
1412 1412
 		{
@@ -1423,8 +1423,8 @@  discard block
 block discarded – undo
1423 1423
 		{
1424 1424
 			$limit_array = explode(",", $limit);
1425 1425
 			
1426
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1427
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1426
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1427
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1428 1428
 			
1429 1429
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1430 1430
 			{
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 	* @return Array the spotter information
1455 1455
 	*
1456 1456
 	*/
1457
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1457
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1458 1458
 	{
1459 1459
 		global $global_query;
1460 1460
 		
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
 		$query_values = array();
1463 1463
 		$limit_query = '';
1464 1464
 		$additional_query = '';
1465
-		$filter_query = $this->getFilter($filters,true,true);
1465
+		$filter_query = $this->getFilter($filters, true, true);
1466 1466
 		
1467 1467
 		if ($airport != "")
1468 1468
 		{
@@ -1479,8 +1479,8 @@  discard block
 block discarded – undo
1479 1479
 		{
1480 1480
 			$limit_array = explode(",", $limit);
1481 1481
 			
1482
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1483
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1482
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1483
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1484 1484
 			
1485 1485
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1486 1486
 			{
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 	* @return Array the spotter information
1513 1513
 	*
1514 1514
 	*/
1515
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1515
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1516 1516
 	{
1517 1517
 		global $global_query, $globalTimezone, $globalDBdriver;
1518 1518
 		
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 		$limit_query = '';
1521 1521
 		$additional_query = '';
1522 1522
 
1523
-		$filter_query = $this->getFilter($filter,true,true);
1523
+		$filter_query = $this->getFilter($filter, true, true);
1524 1524
 		
1525 1525
 		if ($date != "")
1526 1526
 		{
@@ -1549,8 +1549,8 @@  discard block
 block discarded – undo
1549 1549
 		{
1550 1550
 			$limit_array = explode(",", $limit);
1551 1551
 			
1552
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1553
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1552
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1553
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1554 1554
 			
1555 1555
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1556 1556
 			{
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
 	* @return Array the spotter information
1581 1581
 	*
1582 1582
 	*/
1583
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1583
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1584 1584
 	{
1585 1585
 		global $global_query;
1586 1586
 		
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
 		$query_values = array();
1590 1590
 		$limit_query = '';
1591 1591
 		$additional_query = '';
1592
-		$filter_query = $this->getFilter($filters,true,true);
1592
+		$filter_query = $this->getFilter($filters, true, true);
1593 1593
 		if ($country != "")
1594 1594
 		{
1595 1595
 			if (!is_string($country))
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
 		{
1607 1607
 			$limit_array = explode(",", $limit);
1608 1608
 			
1609
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1610
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1609
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1610
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1611 1611
 			
1612 1612
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1613 1613
 			{
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
 		$query_values = array();
1648 1648
 		$additional_query = '';
1649 1649
 		$limit_query = '';
1650
-		$filter_query = $this->getFilter($filters,true,true);
1650
+		$filter_query = $this->getFilter($filters, true, true);
1651 1651
 		
1652 1652
 		if ($aircraft_manufacturer != "")
1653 1653
 		{
@@ -1664,8 +1664,8 @@  discard block
 block discarded – undo
1664 1664
 		{
1665 1665
 			$limit_array = explode(",", $limit);
1666 1666
 			
1667
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1668
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1667
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1668
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1669 1669
 			
1670 1670
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1671 1671
 			{
@@ -1707,14 +1707,14 @@  discard block
 block discarded – undo
1707 1707
 		$query_values = array();
1708 1708
 		$additional_query = '';
1709 1709
 		$limit_query = '';
1710
-		$filter_query = $this->getFilter($filters,true,true);
1710
+		$filter_query = $this->getFilter($filters, true, true);
1711 1711
 		if ($departure_airport_icao != "")
1712 1712
 		{
1713 1713
 			if (!is_string($departure_airport_icao))
1714 1714
 			{
1715 1715
 				return false;
1716 1716
 			} else {
1717
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1717
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1718 1718
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1719 1719
 				//$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";
1720 1720
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1727,10 +1727,10 @@  discard block
 block discarded – undo
1727 1727
 			{
1728 1728
 				return false;
1729 1729
 			} else {
1730
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1730
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1731 1731
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1732 1732
 				//$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)";
1733
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1733
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1734 1734
 			}
1735 1735
 		}
1736 1736
 		
@@ -1738,8 +1738,8 @@  discard block
 block discarded – undo
1738 1738
 		{
1739 1739
 			$limit_array = explode(",", $limit);
1740 1740
 			
1741
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1742
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1741
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1742
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1743 1743
 			
1744 1744
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1745 1745
 			{
@@ -1778,15 +1778,15 @@  discard block
 block discarded – undo
1778 1778
 		global $global_query;
1779 1779
 		
1780 1780
 		date_default_timezone_set('UTC');
1781
-		$filter_query = $this->getFilter($filter,true,true);
1781
+		$filter_query = $this->getFilter($filter, true, true);
1782 1782
 		$limit_query = '';
1783 1783
 		
1784 1784
 		if ($limit != "")
1785 1785
 		{
1786 1786
 			$limit_array = explode(",", $limit);
1787 1787
 			
1788
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1789
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1788
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1789
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1790 1790
 			
1791 1791
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1792 1792
 			{
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1804 1804
 		}
1805 1805
 
1806
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1806
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1807 1807
 
1808 1808
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1809 1809
 
@@ -1816,19 +1816,19 @@  discard block
 block discarded – undo
1816 1816
 	* @return String the highlight text
1817 1817
 	*
1818 1818
 	*/
1819
-	public function getHighlightByRegistration($registration,$filter = array())
1819
+	public function getHighlightByRegistration($registration, $filter = array())
1820 1820
 	{
1821 1821
 		global $global_query;
1822 1822
 		
1823 1823
 		date_default_timezone_set('UTC');
1824
-		$filter_query = $this->getFilter($filter,true,true);
1825
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1824
+		$filter_query = $this->getFilter($filter, true, true);
1825
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1826 1826
 		
1827
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1827
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1828 1828
 		$sth = $this->db->prepare($query);
1829 1829
 		$sth->execute(array(':registration' => $registration));
1830 1830
 
1831
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1831
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1832 1832
 		{
1833 1833
 			$highlight = $row['highlight'];
1834 1834
 		}
@@ -1844,14 +1844,14 @@  discard block
 block discarded – undo
1844 1844
 	* @return String usage
1845 1845
 	*
1846 1846
 	*/
1847
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1847
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1848 1848
 	{
1849 1849
 		
1850
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1851
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1850
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1851
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1852 1852
 
1853 1853
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1854
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1854
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1855 1855
 		
1856 1856
 		$sth = $this->db->prepare($query);
1857 1857
 		$sth->execute($query_values);
@@ -1873,9 +1873,9 @@  discard block
 block discarded – undo
1873 1873
 	public function getAirportIcao($airport_iata = '')
1874 1874
 	{
1875 1875
 		
1876
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1876
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1877 1877
 
1878
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1878
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1879 1879
 		$query_values = array(':airport' => $airport_iata);
1880 1880
 		
1881 1881
 		$sth = $this->db->prepare($query);
@@ -1897,12 +1897,12 @@  discard block
 block discarded – undo
1897 1897
 	* @return Float distance to the airport
1898 1898
 	*
1899 1899
 	*/
1900
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1900
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1901 1901
 	{
1902 1902
 		
1903
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1903
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1904 1904
 
1905
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1905
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1906 1906
 		$query_values = array(':airport' => $airport_icao);
1907 1907
 		$sth = $this->db->prepare($query);
1908 1908
 		$sth->execute($query_values);
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
 			$airport_latitude = $row['latitude'];
1913 1913
 			$airport_longitude = $row['longitude'];
1914 1914
 			$Common = new Common();
1915
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1915
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1916 1916
 		} else return '';
1917 1917
 	}
1918 1918
 	
@@ -1926,11 +1926,11 @@  discard block
 block discarded – undo
1926 1926
 	public function getAllAirportInfo($airport = '')
1927 1927
 	{
1928 1928
 		
1929
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1929
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1930 1930
 
1931 1931
 		$query_values = array();
1932 1932
 		if ($airport == 'NA') {
1933
-			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' => ''));
1933
+			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' => ''));
1934 1934
 		} elseif ($airport == '') {
1935 1935
 			$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";
1936 1936
 		} else {
@@ -1978,14 +1978,14 @@  discard block
 block discarded – undo
1978 1978
 	{
1979 1979
 		$lst_countries = '';
1980 1980
 		foreach ($countries as $country) {
1981
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1981
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1982 1982
 			if ($lst_countries == '') {
1983 1983
 				$lst_countries = "'".$country."'";
1984 1984
 			} else {
1985 1985
 				$lst_countries .= ",'".$country."'";
1986 1986
 			}
1987 1987
 		}
1988
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1988
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1989 1989
 		
1990 1990
 		$sth = $this->db->prepare($query);
1991 1991
 		$sth->execute();
@@ -1993,7 +1993,7 @@  discard block
 block discarded – undo
1993 1993
 		$airport_array = array();
1994 1994
 		$temp_array = array();
1995 1995
 		
1996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1997 1997
 		{
1998 1998
 			$temp_array['name'] = $row['name'];
1999 1999
 			$temp_array['city'] = $row['city'];
@@ -2021,10 +2021,10 @@  discard block
 block discarded – undo
2021 2021
 	{
2022 2022
 		global $globalDBdriver;
2023 2023
 		if (is_array($coord)) {
2024
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2025
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2026
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2027
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2024
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2025
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2026
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2027
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2028 2028
 		} else return array();
2029 2029
 		if ($globalDBdriver == 'mysql') {
2030 2030
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
     
2037 2037
 		$airport_array = array();
2038 2038
 		
2039
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2039
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2040 2040
 		{
2041 2041
 			$temp_array = $row;
2042 2042
 
@@ -2056,13 +2056,13 @@  discard block
 block discarded – undo
2056 2056
 	public function getAllWaypointsInfobyCoord($coord)
2057 2057
 	{
2058 2058
 		if (is_array($coord)) {
2059
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2060
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2061
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2062
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2059
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2060
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2061
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2062
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2063 2063
 		} else return array();
2064 2064
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2065
-		$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.")";
2065
+		$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.")";
2066 2066
 		//$query  = "SELECT waypoints.* FROM waypoints";
2067 2067
 		//$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";
2068 2068
 		//$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;
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
     
2075 2075
 		$waypoints_array = array();
2076 2076
 		
2077
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2077
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2078 2078
 		{
2079 2079
 			$temp_array = $row;
2080 2080
 
@@ -2096,10 +2096,10 @@  discard block
 block discarded – undo
2096 2096
 	{
2097 2097
 		global $globalUseRealAirlines;
2098 2098
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2099
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2099
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2100 2100
 		if ($airline_icao == 'NA') {
2101 2101
 			$airline_array = array();
2102
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2102
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2103 2103
 			return $airline_array;
2104 2104
 		} else {
2105 2105
 			if (strlen($airline_icao) == 2) {
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
 			if ($fromsource === NULL) {
2121 2121
 				$sth->execute(array(':airline_icao' => $airline_icao));
2122 2122
 			} else {
2123
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2123
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2124 2124
 			}
2125 2125
                         /*
2126 2126
 			$airline_array = array();
@@ -2162,13 +2162,13 @@  discard block
 block discarded – undo
2162 2162
 	{
2163 2163
 		global $globalUseRealAirlines;
2164 2164
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2165
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2166
-		$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";
2165
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2166
+		$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";
2167 2167
 		$sth = $this->db->prepare($query);
2168 2168
 		if ($fromsource === NULL) {
2169 2169
 			$sth->execute(array(':airline_name' => $airline_name));
2170 2170
 		} else {
2171
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2171
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2172 2172
 		}
2173 2173
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2174 2174
 		if (empty($result) && $fromsource !== NULL) {
@@ -2193,12 +2193,12 @@  discard block
 block discarded – undo
2193 2193
 	*/
2194 2194
 	public function getAllAircraftInfo($aircraft_type)
2195 2195
 	{
2196
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2196
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2197 2197
 
2198 2198
 		if ($aircraft_type == 'NA') {
2199
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2199
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2200 2200
 		}
2201
-		$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";
2201
+		$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";
2202 2202
 		
2203 2203
 		$sth = $this->db->prepare($query);
2204 2204
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2230,7 +2230,7 @@  discard block
 block discarded – undo
2230 2230
 	*/
2231 2231
 	public function getAircraftIcao($aircraft_type)
2232 2232
 	{
2233
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2233
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2234 2234
 		$all_aircraft = array('737-300' => 'B733',
2235 2235
 				'777-200' => 'B772',
2236 2236
 				'777-200ER' => 'B772',
@@ -2242,10 +2242,10 @@  discard block
 block discarded – undo
2242 2242
 				'A380' => 'A388');
2243 2243
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2244 2244
 
2245
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2245
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2246 2246
 		$aircraft_type = strtoupper($aircraft_type);
2247 2247
 		$sth = $this->db->prepare($query);
2248
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2248
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2249 2249
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2250 2250
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2251 2251
 		else return '';
@@ -2260,9 +2260,9 @@  discard block
 block discarded – undo
2260 2260
 	*/
2261 2261
 	public function getAllAircraftType($aircraft_modes)
2262 2262
 	{
2263
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2263
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2264 2264
 
2265
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2265
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2266 2266
 		
2267 2267
 		$sth = $this->db->prepare($query);
2268 2268
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2285,9 +2285,9 @@  discard block
 block discarded – undo
2285 2285
 	*/
2286 2286
 	public function getAllAircraftTypeByRegistration($registration)
2287 2287
 	{
2288
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2288
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2289 2289
 
2290
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2290
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2291 2291
 		
2292 2292
 		$sth = $this->db->prepare($query);
2293 2293
 		$sth->execute(array(':registration' => $registration));
@@ -2308,8 +2308,8 @@  discard block
 block discarded – undo
2308 2308
 	*/
2309 2309
 	public function getOperator($operator)
2310 2310
 	{
2311
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2312
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2311
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2312
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2313 2313
 		
2314 2314
 		$sth = $this->db->prepare($query);
2315 2315
 		$sth->execute(array(':operator' => $operator));
@@ -2330,9 +2330,9 @@  discard block
 block discarded – undo
2330 2330
 	*/
2331 2331
 	public function getRouteInfo($callsign)
2332 2332
 	{
2333
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2333
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2334 2334
                 if ($callsign == '') return array();
2335
-		$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";
2335
+		$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";
2336 2336
 		
2337 2337
 		$sth = $this->db->prepare($query);
2338 2338
 		$sth->execute(array(':callsign' => $callsign));
@@ -2353,9 +2353,9 @@  discard block
 block discarded – undo
2353 2353
 	*/
2354 2354
 	public function getAircraftInfoByRegistration($registration)
2355 2355
 	{
2356
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2356
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2357 2357
 
2358
-		$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";
2358
+		$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";
2359 2359
 		
2360 2360
 		$sth = $this->db->prepare($query);
2361 2361
 		$sth->execute(array(':registration' => $registration));
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 		$aircraft_array = array();
2364 2364
 		$temp_array = array();
2365 2365
 		
2366
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2366
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2367 2367
 		{
2368 2368
 			$temp_array['airline_icao'] = $row['airline_icao'];
2369 2369
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2385,7 +2385,7 @@  discard block
 block discarded – undo
2385 2385
 	*/
2386 2386
 	public function getAircraftOwnerByRegistration($registration)
2387 2387
 	{
2388
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2388
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2389 2389
 		$Connection = new Connection($this->db);
2390 2390
 		if ($Connection->tableExists('aircraft_owner')) {
2391 2391
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2407,7 +2407,7 @@  discard block
 block discarded – undo
2407 2407
 	public function getAllFlightsforSitemap()
2408 2408
 	{
2409 2409
 		//$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 ";
2410
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2410
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2411 2411
 		
2412 2412
 		$sth = $this->db->prepare($query);
2413 2413
 		$sth->execute();
@@ -2454,7 +2454,7 @@  discard block
 block discarded – undo
2454 2454
 		$manufacturer_array = array();
2455 2455
 		$temp_array = array();
2456 2456
 		
2457
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2457
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2458 2458
 		{
2459 2459
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2460 2460
 
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
 		$aircraft_array = array();
2492 2492
 		$temp_array = array();
2493 2493
 		
2494
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2494
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2495 2495
 		{
2496 2496
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2497 2497
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2512,8 +2512,8 @@  discard block
 block discarded – undo
2512 2512
 	*/
2513 2513
 	public function getAllAircraftRegistrations($filters = array())
2514 2514
 	{
2515
-		$filter_query = $this->getFilter($filters,true,true);
2516
-		$query  = "SELECT DISTINCT spotter_output.registration 
2515
+		$filter_query = $this->getFilter($filters, true, true);
2516
+		$query = "SELECT DISTINCT spotter_output.registration 
2517 2517
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2518 2518
 				ORDER BY spotter_output.registration ASC";
2519 2519
 
@@ -2523,7 +2523,7 @@  discard block
 block discarded – undo
2523 2523
 		$aircraft_array = array();
2524 2524
 		$temp_array = array();
2525 2525
 		
2526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2527 2527
 		{
2528 2528
 			$temp_array['registration'] = $row['registration'];
2529 2529
 
@@ -2540,11 +2540,11 @@  discard block
 block discarded – undo
2540 2540
 	* @return Array list of source name
2541 2541
 	*
2542 2542
 	*/
2543
-	public function getAllSourceName($type = '',$filters = array())
2543
+	public function getAllSourceName($type = '', $filters = array())
2544 2544
 	{
2545
-		$filter_query = $this->getFilter($filters,true,true);
2545
+		$filter_query = $this->getFilter($filters, true, true);
2546 2546
 		$query_values = array();
2547
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2547
+		$query = "SELECT DISTINCT spotter_output.source_name 
2548 2548
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2549 2549
 		if ($type != '') {
2550 2550
 			$query_values = array(':type' => $type);
@@ -2559,7 +2559,7 @@  discard block
 block discarded – undo
2559 2559
 		$source_array = array();
2560 2560
 		$temp_array = array();
2561 2561
 		
2562
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2562
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2563 2563
 		{
2564 2564
 			$temp_array['source_name'] = $row['source_name'];
2565 2565
 			$source_array[] = $temp_array;
@@ -2575,11 +2575,11 @@  discard block
 block discarded – undo
2575 2575
 	* @return Array list of airline names
2576 2576
 	*
2577 2577
 	*/
2578
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2578
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2579 2579
 	{
2580
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2581
-		$filter_query = $this->getFilter($filters,true,true);
2582
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2580
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2581
+		$filter_query = $this->getFilter($filters, true, true);
2582
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2583 2583
 		if ($airline_type == '' || $airline_type == 'all') {
2584 2584
 			/*
2585 2585
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2598,7 +2598,7 @@  discard block
 block discarded – undo
2598 2598
 				$query_data = array(':forsource' => $forsource);
2599 2599
 			}
2600 2600
 		} else {
2601
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2601
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2602 2602
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2603 2603
 					AND spotter_output.airline_type = :airline_type 
2604 2604
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
 		$airline_array = array();
2612 2612
 		$temp_array = array();
2613 2613
 		
2614
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2614
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2615 2615
 		{
2616 2616
 			$temp_array['airline_icao'] = $row['airline_icao'];
2617 2617
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2628,10 +2628,10 @@  discard block
 block discarded – undo
2628 2628
 	* @return Array list of alliance names
2629 2629
 	*
2630 2630
 	*/
2631
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2631
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2632 2632
 	{
2633
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2634
-		$filter_query = $this->getFilter($filters,true,true);
2633
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2634
+		$filter_query = $this->getFilter($filters, true, true);
2635 2635
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2636 2636
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2637 2637
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2659,8 +2659,8 @@  discard block
 block discarded – undo
2659 2659
 	*/
2660 2660
 	public function getAllAirlineCountries($filters = array())
2661 2661
 	{
2662
-		$filter_query = $this->getFilter($filters,true,true);
2663
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2662
+		$filter_query = $this->getFilter($filters, true, true);
2663
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2664 2664
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2665 2665
 				ORDER BY spotter_output.airline_country ASC";
2666 2666
 		
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 		$airline_array = array();
2672 2672
 		$temp_array = array();
2673 2673
 		
2674
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2674
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2675 2675
 		{
2676 2676
 			$temp_array['airline_country'] = $row['airline_country'];
2677 2677
 
@@ -2691,9 +2691,9 @@  discard block
 block discarded – undo
2691 2691
 	*/
2692 2692
 	public function getAllAirportNames($filters = array())
2693 2693
 	{
2694
-		$filter_query = $this->getFilter($filters,true,true);
2694
+		$filter_query = $this->getFilter($filters, true, true);
2695 2695
 		$airport_array = array();
2696
-		$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
2696
+		$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
2697 2697
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2698 2698
 				ORDER BY spotter_output.departure_airport_city ASC";
2699 2699
 		
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
 		$sth->execute();
2703 2703
 
2704 2704
 		$temp_array = array();
2705
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2705
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2706 2706
 		{
2707 2707
 			$temp_array['airport_icao'] = $row['airport_icao'];
2708 2708
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2712,14 +2712,14 @@  discard block
 block discarded – undo
2712 2712
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2713 2713
 		}
2714 2714
 
2715
-		$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
2715
+		$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
2716 2716
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2717 2717
 								ORDER BY spotter_output.arrival_airport_city ASC";
2718 2718
 					
2719 2719
 		$sth = $this->db->prepare($query);
2720 2720
 		$sth->execute();
2721 2721
 
2722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2723 2723
 			{
2724 2724
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2725 2725
 		//	{
@@ -2759,21 +2759,21 @@  discard block
 block discarded – undo
2759 2759
    
2760 2760
 		$temp_array = array();
2761 2761
 		
2762
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2762
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2763 2763
 		{
2764 2764
 			$temp_array['airport_country'] = $row['airport_country'];
2765 2765
 
2766 2766
 			$airport_array[$row['airport_country']] = $temp_array;
2767 2767
 		}
2768
-		$filter_query = $this->getFilter($filters,true,true);
2769
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2768
+		$filter_query = $this->getFilter($filters, true, true);
2769
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2770 2770
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2771 2771
 								ORDER BY spotter_output.arrival_airport_country ASC";
2772 2772
 					
2773 2773
 		$sth = $this->db->prepare($query);
2774 2774
 		$sth->execute();
2775 2775
 		
2776
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2776
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2777 2777
 		{
2778 2778
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2779 2779
 			{
@@ -2796,9 +2796,9 @@  discard block
 block discarded – undo
2796 2796
 	*/
2797 2797
 	public function getAllCountries($filters = array())
2798 2798
 	{
2799
-		$Connection= new Connection($this->db);
2799
+		$Connection = new Connection($this->db);
2800 2800
 		if ($Connection->tableExists('countries')) {
2801
-			$query  = "SELECT countries.name AS airport_country
2801
+			$query = "SELECT countries.name AS airport_country
2802 2802
 				FROM countries
2803 2803
 				ORDER BY countries.name ASC";
2804 2804
 			$sth = $this->db->prepare($query);
@@ -2807,14 +2807,14 @@  discard block
 block discarded – undo
2807 2807
 			$temp_array = array();
2808 2808
 			$country_array = array();
2809 2809
 		
2810
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2810
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2811 2811
 			{
2812 2812
 				$temp_array['country'] = $row['airport_country'];
2813 2813
 				$country_array[$row['airport_country']] = $temp_array;
2814 2814
 			}
2815 2815
 		} else {
2816
-			$filter_query = $this->getFilter($filters,true,true);
2817
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2816
+			$filter_query = $this->getFilter($filters, true, true);
2817
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2818 2818
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2819 2819
 								ORDER BY spotter_output.departure_airport_country ASC";
2820 2820
 
@@ -2823,20 +2823,20 @@  discard block
 block discarded – undo
2823 2823
    
2824 2824
 			$temp_array = array();
2825 2825
 			$country_array = array();
2826
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2826
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2827 2827
 			{
2828 2828
 				$temp_array['country'] = $row['airport_country'];
2829 2829
 				$country_array[$row['airport_country']] = $temp_array;
2830 2830
 			}
2831 2831
 
2832
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2832
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2833 2833
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2834 2834
 								ORDER BY spotter_output.arrival_airport_country ASC";
2835 2835
 					
2836 2836
 		$sth = $this->db->prepare($query);
2837 2837
 		$sth->execute();
2838 2838
 		
2839
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2839
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2840 2840
 		{
2841 2841
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2842 2842
 			{
@@ -2846,14 +2846,14 @@  discard block
 block discarded – undo
2846 2846
 			}
2847 2847
 		}
2848 2848
 		
2849
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2849
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2850 2850
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2851 2851
 								ORDER BY spotter_output.airline_country ASC";
2852 2852
 					
2853 2853
 		$sth = $this->db->prepare($query);
2854 2854
 		$sth->execute();
2855 2855
 		
2856
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2856
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2857 2857
 		{
2858 2858
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2859 2859
 			{
@@ -2877,8 +2877,8 @@  discard block
 block discarded – undo
2877 2877
 	*/
2878 2878
 	public function getAllIdents($filters = array())
2879 2879
 	{
2880
-		$filter_query = $this->getFilter($filters,true,true);
2881
-		$query  = "SELECT DISTINCT spotter_output.ident
2880
+		$filter_query = $this->getFilter($filters, true, true);
2881
+		$query = "SELECT DISTINCT spotter_output.ident
2882 2882
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2883 2883
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2884 2884
 
@@ -2888,7 +2888,7 @@  discard block
 block discarded – undo
2888 2888
 		$ident_array = array();
2889 2889
 		$temp_array = array();
2890 2890
 		
2891
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2891
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2892 2892
 		{
2893 2893
 			$temp_array['ident'] = $row['ident'];
2894 2894
 			$ident_array[] = $temp_array;
@@ -2902,9 +2902,9 @@  discard block
 block discarded – undo
2902 2902
 	* @return Array number, icao, name and city of airports
2903 2903
 	*/
2904 2904
 
2905
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2905
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2906 2906
 		global $globalTimezone, $globalDBdriver;
2907
-		$filter_query = $this->getFilter($filters,true,true);
2907
+		$filter_query = $this->getFilter($filters, true, true);
2908 2908
 		if ($globalTimezone != '') {
2909 2909
 			date_default_timezone_set($globalTimezone);
2910 2910
 			$datetime = new DateTime();
@@ -2969,7 +2969,7 @@  discard block
 block discarded – undo
2969 2969
 
2970 2970
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2971 2971
 		global $globalTimezone, $globalDBdriver;
2972
-		$filter_query = $this->getFilter($filters,true,true);
2972
+		$filter_query = $this->getFilter($filters, true, true);
2973 2973
 		if ($globalTimezone != '') {
2974 2974
 			date_default_timezone_set($globalTimezone);
2975 2975
 			$datetime = new DateTime();
@@ -3053,7 +3053,7 @@  discard block
 block discarded – undo
3053 3053
 
3054 3054
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3055 3055
 		global $globalTimezone, $globalDBdriver;
3056
-		$filter_query = $this->getFilter($filters,true,true);
3056
+		$filter_query = $this->getFilter($filters, true, true);
3057 3057
 		if ($globalTimezone != '') {
3058 3058
 			date_default_timezone_set($globalTimezone);
3059 3059
 			$datetime = new DateTime();
@@ -3086,9 +3086,9 @@  discard block
 block discarded – undo
3086 3086
 	* @return Array number, icao, name and city of airports
3087 3087
 	*/
3088 3088
 
3089
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3089
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3090 3090
 		global $globalTimezone, $globalDBdriver;
3091
-		$filter_query = $this->getFilter($filters,true,true);
3091
+		$filter_query = $this->getFilter($filters, true, true);
3092 3092
 		if ($globalTimezone != '') {
3093 3093
 			date_default_timezone_set($globalTimezone);
3094 3094
 			$datetime = new DateTime();
@@ -3220,12 +3220,12 @@  discard block
 block discarded – undo
3220 3220
 		} else $offset = '+00:00';
3221 3221
 
3222 3222
 		if ($globalDBdriver == 'mysql') {
3223
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3223
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3224 3224
 								FROM spotter_output
3225 3225
 								WHERE spotter_output.date <> '' 
3226 3226
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3227 3227
 		} else {
3228
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3228
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3229 3229
 								FROM spotter_output
3230 3230
 								WHERE spotter_output.date <> '' 
3231 3231
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3237,7 +3237,7 @@  discard block
 block discarded – undo
3237 3237
 		$date_array = array();
3238 3238
 		$temp_array = array();
3239 3239
 		
3240
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3240
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3241 3241
 		{
3242 3242
 			$temp_array['date'] = $row['date'];
3243 3243
 
@@ -3257,7 +3257,7 @@  discard block
 block discarded – undo
3257 3257
 	*/
3258 3258
 	public function getAllRoutes()
3259 3259
 	{
3260
-		$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 
3260
+		$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 
3261 3261
 				FROM spotter_output
3262 3262
 				WHERE spotter_output.ident <> '' 
3263 3263
 				GROUP BY route
@@ -3268,7 +3268,7 @@  discard block
 block discarded – undo
3268 3268
 
3269 3269
 		$routes_array = array();
3270 3270
 		$temp_array = array();
3271
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3271
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3272 3272
 		{
3273 3273
 			$temp_array['route'] = $row['route'];
3274 3274
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3287,21 +3287,21 @@  discard block
 block discarded – undo
3287 3287
 	* @return String success or false
3288 3288
 	*
3289 3289
 	*/	
3290
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3290
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3291 3291
 	{
3292 3292
 		if (!is_numeric(substr($ident, 0, 3)))
3293 3293
 		{
3294 3294
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3295
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3295
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3296 3296
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3297
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3297
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3298 3298
 			} else {
3299 3299
 				$airline_array = $this->getAllAirlineInfo("NA");
3300 3300
 			}
3301 3301
 			if (count($airline_array) == 0) {
3302 3302
 				$airline_array = $this->getAllAirlineInfo("NA");
3303 3303
 			}
3304
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3304
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3305 3305
 				$airline_array = $this->getAllAirlineInfo("NA");
3306 3306
 			}
3307 3307
 		} else {
@@ -3314,7 +3314,7 @@  discard block
 block discarded – undo
3314 3314
 
3315 3315
 
3316 3316
 		$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';
3317
-                $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);
3317
+                $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);
3318 3318
 
3319 3319
 		try {
3320 3320
 			$sth = $this->db->prepare($query);
@@ -3335,11 +3335,11 @@  discard block
 block discarded – undo
3335 3335
 	* @return String success or false
3336 3336
 	*
3337 3337
 	*/	
3338
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3338
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3339 3339
 	{
3340 3340
 		if ($groundspeed == '') $groundspeed = NULL;
3341 3341
 		$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';
3342
-                $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);
3342
+                $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);
3343 3343
 
3344 3344
 		try {
3345 3345
 			$sth = $this->db->prepare($query);
@@ -3379,7 +3379,7 @@  discard block
 block discarded – undo
3379 3379
 	* @param String $verticalrate vertival rate of flight
3380 3380
 	* @return String success or false
3381 3381
 	*/
3382
-	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 = '')
3382
+	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 = '')
3383 3383
 	{
3384 3384
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3385 3385
 		
@@ -3403,13 +3403,13 @@  discard block
 block discarded – undo
3403 3403
 				if ($ModeS != '') {
3404 3404
 					$timeelapsed = microtime(true);
3405 3405
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3406
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3406
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3407 3407
 				} else {
3408
-					$myhex = explode('-',$flightaware_id);
3408
+					$myhex = explode('-', $flightaware_id);
3409 3409
 					if (count($myhex) > 0) {
3410 3410
 						$timeelapsed = microtime(true);
3411 3411
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3412
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3412
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3413 3413
 					}
3414 3414
 				}
3415 3415
 			}
@@ -3431,24 +3431,24 @@  discard block
 block discarded – undo
3431 3431
 				{
3432 3432
 					$timeelapsed = microtime(true);
3433 3433
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3434
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3434
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3435 3435
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3436
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3436
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3437 3437
 					} else {
3438 3438
 						$airline_array = $this->getAllAirlineInfo("NA");
3439 3439
 					}
3440 3440
 					if (count($airline_array) == 0) {
3441 3441
 						$airline_array = $this->getAllAirlineInfo("NA");
3442 3442
 					}
3443
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3443
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3444 3444
 						$airline_array = $this->getAllAirlineInfo("NA");
3445 3445
 					}
3446
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3446
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3447 3447
 
3448 3448
 				} else {
3449 3449
 					$timeelapsed = microtime(true);
3450 3450
 					$airline_array = $this->getAllAirlineInfo("NA");
3451
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3451
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3452 3452
 				}
3453 3453
 			}
3454 3454
 		} else $airline_array = array();
@@ -3465,27 +3465,27 @@  discard block
 block discarded – undo
3465 3465
 				{
3466 3466
 					$timeelapsed = microtime(true);
3467 3467
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3468
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3468
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3469 3469
 				} else {
3470 3470
 					$timeelapsed = microtime(true);
3471 3471
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3472
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3472
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3473 3473
 				}
3474 3474
 			}
3475 3475
 		} else {
3476 3476
 			if ($ModeS != '') {
3477 3477
 				$timeelapsed = microtime(true);
3478 3478
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3479
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3479
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3480 3480
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3481 3481
 				{
3482 3482
 					$timeelapsed = microtime(true);
3483 3483
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3484
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3484
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3485 3485
 				} else {
3486 3486
 					$timeelapsed = microtime(true);
3487 3487
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3488
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3488
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3489 3489
 				}
3490 3490
 			}
3491 3491
 		}
@@ -3501,7 +3501,7 @@  discard block
 block discarded – undo
3501 3501
 			} else {
3502 3502
 				$timeelapsed = microtime(true);
3503 3503
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3504
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3504
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3505 3505
 			}
3506 3506
 		}
3507 3507
 		
@@ -3516,7 +3516,7 @@  discard block
 block discarded – undo
3516 3516
 			} else {
3517 3517
 				$timeelapsed = microtime(true);
3518 3518
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3519
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3519
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3520 3520
 			}
3521 3521
 		}
3522 3522
 
@@ -3579,7 +3579,7 @@  discard block
 block discarded – undo
3579 3579
 		{
3580 3580
 			$timeelapsed = microtime(true);
3581 3581
 			$image_array = $Image->getSpotterImage($registration);
3582
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3582
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3583 3583
 			if (!isset($image_array[0]['registration']))
3584 3584
 			{
3585 3585
 				//echo "Add image !!!! \n";
@@ -3587,7 +3587,7 @@  discard block
 block discarded – undo
3587 3587
 			}
3588 3588
 			$timeelapsed = microtime(true);
3589 3589
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3590
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3590
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3591 3591
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3592 3592
 		}
3593 3593
     
@@ -3595,33 +3595,33 @@  discard block
 block discarded – undo
3595 3595
 		{
3596 3596
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3597 3597
             		else $airline_icao = '';
3598
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3598
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3599 3599
 			if (!isset($image_array[0]['registration']))
3600 3600
 			{
3601 3601
 				//echo "Add image !!!! \n";
3602
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3602
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3603 3603
 			}
3604 3604
 		}
3605 3605
     
3606
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3607
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3608
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3609
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3610
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3611
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3612
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3613
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3614
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3615
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3616
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3617
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3618
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3619
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3620
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3621
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3622
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3623
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3624
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3606
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3607
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3608
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3609
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3610
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3611
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3612
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3613
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3614
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3615
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3616
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3617
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3618
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3619
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3620
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3621
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3622
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3623
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3624
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3625 3625
 	
3626 3626
 		if (count($airline_array) == 0) 
3627 3627
 		{
@@ -3649,7 +3649,7 @@  discard block
 block discarded – undo
3649 3649
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3650 3650
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3651 3651
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3652
-                $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) 
3652
+                $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) 
3653 3653
                 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)";
3654 3654
 
3655 3655
                 $airline_name = $airline_array[0]['name'];
@@ -3659,7 +3659,7 @@  discard block
 block discarded – undo
3659 3659
 		if ($airline_type == '') {
3660 3660
 			$timeelapsed = microtime(true);
3661 3661
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3662
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3662
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3663 3663
 		}
3664 3664
 		if ($airline_type == null) $airline_type = '';
3665 3665
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3671,7 +3671,7 @@  discard block
 block discarded – undo
3671 3671
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3672 3672
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3673 3673
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3674
-                $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);
3674
+                $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);
3675 3675
 
3676 3676
 		try {
3677 3677
 		        
@@ -3697,13 +3697,13 @@  discard block
 block discarded – undo
3697 3697
 	{
3698 3698
 		global $globalDBdriver, $globalTimezone;
3699 3699
 		if ($globalDBdriver == 'mysql') {
3700
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3700
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3701 3701
 								WHERE spotter_output.ident = :ident 
3702 3702
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3703 3703
 								AND spotter_output.date < UTC_TIMESTAMP()";
3704 3704
 			$query_data = array(':ident' => $ident);
3705 3705
 		} else {
3706
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3706
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3707 3707
 								WHERE spotter_output.ident = :ident 
3708 3708
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3709 3709
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3712,8 +3712,8 @@  discard block
 block discarded – undo
3712 3712
 		
3713 3713
 		$sth = $this->db->prepare($query);
3714 3714
 		$sth->execute($query_data);
3715
-    		$ident_result='';
3716
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3715
+    		$ident_result = '';
3716
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3717 3717
 		{
3718 3718
 			$ident_result = $row['ident'];
3719 3719
 		}
@@ -3739,8 +3739,8 @@  discard block
 block discarded – undo
3739 3739
 				return false;
3740 3740
 			} else {
3741 3741
 				$q_array = explode(" ", $q);
3742
-				foreach ($q_array as $q_item){
3743
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3742
+				foreach ($q_array as $q_item) {
3743
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3744 3744
 					$additional_query .= " AND (";
3745 3745
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3746 3746
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3755,11 +3755,11 @@  discard block
 block discarded – undo
3755 3755
 			}
3756 3756
 		}
3757 3757
 		if ($globalDBdriver == 'mysql') {
3758
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3758
+			$query = "SELECT spotter_output.* FROM spotter_output 
3759 3759
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3760 3760
 				AND spotter_output.date < UTC_TIMESTAMP()";
3761 3761
 		} else {
3762
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3762
+			$query = "SELECT spotter_output.* FROM spotter_output 
3763 3763
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3764 3764
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3765 3765
 		}
@@ -3776,11 +3776,11 @@  discard block
 block discarded – undo
3776 3776
 	* @return Array the airline list
3777 3777
 	*
3778 3778
 	*/
3779
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3779
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3780 3780
 	{
3781 3781
 		global $globalDBdriver;
3782
-		$filter_query = $this->getFilter($filters,true,true);
3783
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3782
+		$filter_query = $this->getFilter($filters, true, true);
3783
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3784 3784
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3785 3785
 		if ($olderthanmonths > 0) {
3786 3786
 			if ($globalDBdriver == 'mysql') {
@@ -3804,7 +3804,7 @@  discard block
 block discarded – undo
3804 3804
  
3805 3805
 		$airline_array = array();
3806 3806
 		$temp_array = array();
3807
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3807
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3808 3808
 		{
3809 3809
 			$temp_array['airline_name'] = $row['airline_name'];
3810 3810
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3821,11 +3821,11 @@  discard block
 block discarded – undo
3821 3821
 	* @return Array the pilots list
3822 3822
 	*
3823 3823
 	*/
3824
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3824
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3825 3825
 	{
3826 3826
 		global $globalDBdriver;
3827
-		$filter_query = $this->getFilter($filters,true,true);
3828
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3827
+		$filter_query = $this->getFilter($filters, true, true);
3828
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3829 3829
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3830 3830
                 if ($olderthanmonths > 0) {
3831 3831
             		if ($globalDBdriver == 'mysql') {
@@ -3851,7 +3851,7 @@  discard block
 block discarded – undo
3851 3851
 		$airline_array = array();
3852 3852
 		$temp_array = array();
3853 3853
         
3854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3855 3855
 		{
3856 3856
 			$temp_array['pilot_name'] = $row['pilot_name'];
3857 3857
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3871,7 +3871,7 @@  discard block
 block discarded – undo
3871 3871
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3872 3872
 	{
3873 3873
 		global $globalDBdriver;
3874
-		$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
3874
+		$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
3875 3875
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3876 3876
                 if ($olderthanmonths > 0) {
3877 3877
             		if ($globalDBdriver == 'mysql') {
@@ -3897,7 +3897,7 @@  discard block
 block discarded – undo
3897 3897
 		$airline_array = array();
3898 3898
 		$temp_array = array();
3899 3899
         
3900
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3900
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3901 3901
 		{
3902 3902
 			$temp_array['pilot_name'] = $row['pilot_name'];
3903 3903
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3915,11 +3915,11 @@  discard block
 block discarded – undo
3915 3915
 	* @return Array the pilots list
3916 3916
 	*
3917 3917
 	*/
3918
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3918
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3919 3919
 	{
3920 3920
 		global $globalDBdriver;
3921
-		$filter_query = $this->getFilter($filters,true,true);
3922
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3921
+		$filter_query = $this->getFilter($filters, true, true);
3922
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3923 3923
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3924 3924
                 if ($olderthanmonths > 0) {
3925 3925
             		if ($globalDBdriver == 'mysql') {
@@ -3945,7 +3945,7 @@  discard block
 block discarded – undo
3945 3945
 		$airline_array = array();
3946 3946
 		$temp_array = array();
3947 3947
         
3948
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3948
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3949 3949
 		{
3950 3950
 			$temp_array['owner_name'] = $row['owner_name'];
3951 3951
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3960,11 +3960,11 @@  discard block
 block discarded – undo
3960 3960
 	* @return Array the pilots list
3961 3961
 	*
3962 3962
 	*/
3963
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3963
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3964 3964
 	{
3965 3965
 		global $globalDBdriver;
3966
-		$filter_query = $this->getFilter($filters,true,true);
3967
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3966
+		$filter_query = $this->getFilter($filters, true, true);
3967
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3968 3968
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3969 3969
                 if ($olderthanmonths > 0) {
3970 3970
             		if ($globalDBdriver == 'mysql') {
@@ -3990,7 +3990,7 @@  discard block
 block discarded – undo
3990 3990
 		$airline_array = array();
3991 3991
 		$temp_array = array();
3992 3992
         
3993
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3993
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3994 3994
 		{
3995 3995
 			$temp_array['owner_name'] = $row['owner_name'];
3996 3996
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4006,11 +4006,11 @@  discard block
 block discarded – undo
4006 4006
 	* @return Array the airline list
4007 4007
 	*
4008 4008
 	*/
4009
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4009
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4010 4010
 	{
4011
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4012
-		$filter_query = $this->getFilter($filters,true,true);
4013
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4011
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4012
+		$filter_query = $this->getFilter($filters, true, true);
4013
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4014 4014
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4015 4015
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4016 4016
 			    ORDER BY airline_count DESC";
@@ -4022,7 +4022,7 @@  discard block
 block discarded – undo
4022 4022
 		$airline_array = array();
4023 4023
 		$temp_array = array();
4024 4024
         
4025
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4025
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4026 4026
 		{
4027 4027
 			$temp_array['airline_name'] = $row['airline_name'];
4028 4028
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4042,11 +4042,11 @@  discard block
 block discarded – undo
4042 4042
 	* @return Array the airline country list
4043 4043
 	*
4044 4044
 	*/
4045
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4045
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4046 4046
 	{
4047
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4048
-		$filter_query = $this->getFilter($filters,true,true);
4049
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4047
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4048
+		$filter_query = $this->getFilter($filters, true, true);
4049
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4050 4050
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4051 4051
                     GROUP BY spotter_output.airline_country
4052 4052
 					ORDER BY airline_country_count DESC
@@ -4059,7 +4059,7 @@  discard block
 block discarded – undo
4059 4059
 		$airline_country_array = array();
4060 4060
 		$temp_array = array();
4061 4061
         
4062
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4062
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4063 4063
 		{
4064 4064
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4065 4065
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4078,11 +4078,11 @@  discard block
 block discarded – undo
4078 4078
 	* @return Array the airline list
4079 4079
 	*
4080 4080
 	*/
4081
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4081
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4082 4082
 	{
4083
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4084
-		$filter_query = $this->getFilter($filters,true,true);
4085
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4083
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4084
+		$filter_query = $this->getFilter($filters, true, true);
4085
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4086 4086
 		    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 ) 
4087 4087
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4088 4088
 		    ORDER BY airline_count DESC";
@@ -4094,7 +4094,7 @@  discard block
 block discarded – undo
4094 4094
 		$airline_array = array();
4095 4095
 		$temp_array = array();
4096 4096
         
4097
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4097
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4098 4098
 		{
4099 4099
 			$temp_array['airline_name'] = $row['airline_name'];
4100 4100
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4113,11 +4113,11 @@  discard block
 block discarded – undo
4113 4113
 	* @return Array the airline country list
4114 4114
 	*
4115 4115
 	*/
4116
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4116
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4117 4117
 	{
4118
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4119
-		$filter_query = $this->getFilter($filters,true,true);
4120
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4118
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4119
+		$filter_query = $this->getFilter($filters, true, true);
4120
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4121 4121
 		 			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 )
4122 4122
 					GROUP BY spotter_output.airline_country
4123 4123
 					ORDER BY airline_country_count DESC
@@ -4130,7 +4130,7 @@  discard block
 block discarded – undo
4130 4130
 		$airline_country_array = array();
4131 4131
 		$temp_array = array();
4132 4132
         
4133
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4133
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4134 4134
 		{
4135 4135
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4136 4136
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4147,11 +4147,11 @@  discard block
 block discarded – undo
4147 4147
 	* @return Array the airline list
4148 4148
 	*
4149 4149
 	*/
4150
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4150
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4151 4151
 	{
4152
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4153
-		$filter_query = $this->getFilter($filters,true,true);
4154
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4152
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4153
+		$filter_query = $this->getFilter($filters, true, true);
4154
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4155 4155
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4156 4156
 					GROUP BY spotter_output.airline_name
4157 4157
 					ORDER BY airline_count DESC";
@@ -4162,7 +4162,7 @@  discard block
 block discarded – undo
4162 4162
 		$airline_array = array();
4163 4163
 		$temp_array = array();
4164 4164
         
4165
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4165
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4166 4166
 		{
4167 4167
 			$temp_array['airline_name'] = $row['airline_name'];
4168 4168
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4182,11 +4182,11 @@  discard block
 block discarded – undo
4182 4182
 	* @return Array the airline country list
4183 4183
 	*
4184 4184
 	*/
4185
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4185
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4186 4186
 	{
4187
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4188
-		$filter_query = $this->getFilter($filters,true,true);
4189
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4187
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4188
+		$filter_query = $this->getFilter($filters, true, true);
4189
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4190 4190
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4191 4191
 					GROUP BY spotter_output.airline_country
4192 4192
 					ORDER BY airline_country_count DESC
@@ -4199,7 +4199,7 @@  discard block
 block discarded – undo
4199 4199
 		$airline_country_array = array();
4200 4200
 		$temp_array = array();
4201 4201
         
4202
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4202
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4203 4203
 		{
4204 4204
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4205 4205
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4215,11 +4215,11 @@  discard block
 block discarded – undo
4215 4215
 	* @return Array the airline list
4216 4216
 	*
4217 4217
 	*/
4218
-	public function countAllAirlinesByDate($date,$filters = array())
4218
+	public function countAllAirlinesByDate($date, $filters = array())
4219 4219
 	{
4220 4220
 		global $globalTimezone, $globalDBdriver;
4221
-		$filter_query = $this->getFilter($filters,true,true);
4222
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4221
+		$filter_query = $this->getFilter($filters, true, true);
4222
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4223 4223
 		if ($globalTimezone != '') {
4224 4224
 			date_default_timezone_set($globalTimezone);
4225 4225
 			$datetime = new DateTime($date);
@@ -4227,12 +4227,12 @@  discard block
 block discarded – undo
4227 4227
 		} else $offset = '+00:00';
4228 4228
 
4229 4229
 		if ($globalDBdriver == 'mysql') {
4230
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4230
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4231 4231
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4232 4232
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4233 4233
 					ORDER BY airline_count DESC";
4234 4234
 		} else {
4235
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4235
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4236 4236
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4237 4237
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4238 4238
 					ORDER BY airline_count DESC";
@@ -4243,7 +4243,7 @@  discard block
 block discarded – undo
4243 4243
 
4244 4244
 		$airline_array = array();
4245 4245
 		$temp_array = array();
4246
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4246
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4247 4247
 		{
4248 4248
 			$temp_array['airline_name'] = $row['airline_name'];
4249 4249
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4263,11 +4263,11 @@  discard block
 block discarded – undo
4263 4263
 	* @return Array the airline country list
4264 4264
 	*
4265 4265
 	*/
4266
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4266
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4267 4267
 	{
4268 4268
 		global $globalTimezone, $globalDBdriver;
4269
-		$filter_query = $this->getFilter($filters,true,true);
4270
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4269
+		$filter_query = $this->getFilter($filters, true, true);
4270
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4271 4271
 		if ($globalTimezone != '') {
4272 4272
 			date_default_timezone_set($globalTimezone);
4273 4273
 			$datetime = new DateTime($date);
@@ -4275,13 +4275,13 @@  discard block
 block discarded – undo
4275 4275
 		} else $offset = '+00:00';
4276 4276
 		
4277 4277
 		if ($globalDBdriver == 'mysql') {
4278
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4278
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4279 4279
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4280 4280
 					GROUP BY spotter_output.airline_country
4281 4281
 					ORDER BY airline_country_count DESC
4282 4282
 					LIMIT 10 OFFSET 0";
4283 4283
 		} else {
4284
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4284
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4285 4285
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4286 4286
 					GROUP BY spotter_output.airline_country
4287 4287
 					ORDER BY airline_country_count DESC
@@ -4293,7 +4293,7 @@  discard block
 block discarded – undo
4293 4293
  
4294 4294
 		$airline_country_array = array();
4295 4295
 		$temp_array = array();
4296
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4296
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4297 4297
 		{
4298 4298
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4299 4299
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4310,11 +4310,11 @@  discard block
 block discarded – undo
4310 4310
 	* @return Array the airline list
4311 4311
 	*
4312 4312
 	*/
4313
-	public function countAllAirlinesByIdent($ident,$filters = array())
4313
+	public function countAllAirlinesByIdent($ident, $filters = array())
4314 4314
 	{
4315
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4316
-		$filter_query = $this->getFilter($filters,true,true);
4317
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4315
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4316
+		$filter_query = $this->getFilter($filters, true, true);
4317
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4318 4318
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4319 4319
 				GROUP BY spotter_output.airline_name
4320 4320
 				ORDER BY airline_count DESC";
@@ -4326,7 +4326,7 @@  discard block
 block discarded – undo
4326 4326
 		$airline_array = array();
4327 4327
 		$temp_array = array();
4328 4328
         
4329
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4329
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4330 4330
 		{
4331 4331
 			$temp_array['airline_name'] = $row['airline_name'];
4332 4332
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4344,25 +4344,25 @@  discard block
 block discarded – undo
4344 4344
 	* @return Array the airline list
4345 4345
 	*
4346 4346
 	*/
4347
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4347
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4348 4348
 	{
4349
-		$filter_query = $this->getFilter($filters,true,true);
4350
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4351
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4349
+		$filter_query = $this->getFilter($filters, true, true);
4350
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4351
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4352 4352
 
4353
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4353
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4354 4354
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4355 4355
 					GROUP BY spotter_output.airline_name
4356 4356
 					ORDER BY airline_count DESC";
4357 4357
       
4358 4358
 		
4359 4359
 		$sth = $this->db->prepare($query);
4360
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4360
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4361 4361
       
4362 4362
 		$airline_array = array();
4363 4363
 		$temp_array = array();
4364 4364
         
4365
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4365
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4366 4366
 		{
4367 4367
 			$temp_array['airline_name'] = $row['airline_name'];
4368 4368
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4380,13 +4380,13 @@  discard block
 block discarded – undo
4380 4380
 	* @return Array the airline country list
4381 4381
 	*
4382 4382
 	*/
4383
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4383
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4384 4384
 	{
4385
-		$filter_query = $this->getFilter($filters,true,true);
4386
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4387
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4385
+		$filter_query = $this->getFilter($filters, true, true);
4386
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4387
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4388 4388
       
4389
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4389
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4390 4390
 		 		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) 
4391 4391
 				GROUP BY spotter_output.airline_country
4392 4392
 				ORDER BY airline_country_count DESC
@@ -4394,11 +4394,11 @@  discard block
 block discarded – undo
4394 4394
       
4395 4395
 		
4396 4396
 		$sth = $this->db->prepare($query);
4397
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4397
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4398 4398
       
4399 4399
 		$airline_country_array = array();
4400 4400
 		$temp_array = array();
4401
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4401
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4402 4402
 		{
4403 4403
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4404 4404
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4416,11 +4416,11 @@  discard block
 block discarded – undo
4416 4416
 	* @return Array the airline list
4417 4417
 	*
4418 4418
 	*/
4419
-	public function countAllAirlinesByCountry($country,$filters = array())
4419
+	public function countAllAirlinesByCountry($country, $filters = array())
4420 4420
 	{
4421
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4422
-		$filter_query = $this->getFilter($filters,true,true);
4423
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4421
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4422
+		$filter_query = $this->getFilter($filters, true, true);
4423
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4424 4424
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4425 4425
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4426 4426
 			    ORDER BY airline_count DESC";
@@ -4431,7 +4431,7 @@  discard block
 block discarded – undo
4431 4431
 
4432 4432
 		$airline_array = array();
4433 4433
 		$temp_array = array();
4434
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4434
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4435 4435
 		{
4436 4436
 			$temp_array['airline_name'] = $row['airline_name'];
4437 4437
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4450,11 +4450,11 @@  discard block
 block discarded – undo
4450 4450
 	* @return Array the airline country list
4451 4451
 	*
4452 4452
 	*/
4453
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4453
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4454 4454
 	{
4455
-		$filter_query = $this->getFilter($filters,true,true);
4456
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4457
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4455
+		$filter_query = $this->getFilter($filters, true, true);
4456
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4457
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4458 4458
 		 		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 
4459 4459
 				GROUP BY spotter_output.airline_country
4460 4460
 				ORDER BY airline_country_count DESC
@@ -4466,7 +4466,7 @@  discard block
 block discarded – undo
4466 4466
 
4467 4467
 		$airline_country_array = array();
4468 4468
 		$temp_array = array();
4469
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4469
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4470 4470
 		{
4471 4471
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4472 4472
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4485,8 +4485,8 @@  discard block
 block discarded – undo
4485 4485
 	*/
4486 4486
 	public function countAllAirlineCountries($limit = true, $filters = array())
4487 4487
 	{
4488
-		$filter_query = $this->getFilter($filters,true,true);
4489
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4488
+		$filter_query = $this->getFilter($filters, true, true);
4489
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4490 4490
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4491 4491
 					GROUP BY spotter_output.airline_country
4492 4492
 					ORDER BY airline_country_count DESC";
@@ -4497,7 +4497,7 @@  discard block
 block discarded – undo
4497 4497
 
4498 4498
 		$airline_array = array();
4499 4499
 		$temp_array = array();
4500
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4500
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4501 4501
 		{
4502 4502
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4503 4503
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4513,11 +4513,11 @@  discard block
 block discarded – undo
4513 4513
 	* @return Array the airline country list
4514 4514
 	*
4515 4515
 	*/
4516
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4516
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4517 4517
 	{
4518 4518
 		global $globalDBdriver;
4519 4519
 		//$filter_query = $this->getFilter($filters,true,true);
4520
-		$Connection= new Connection($this->db);
4520
+		$Connection = new Connection($this->db);
4521 4521
 		if (!$Connection->tableExists('countries')) return array();
4522 4522
 		/*
4523 4523
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4532,7 +4532,7 @@  discard block
 block discarded – undo
4532 4532
 */
4533 4533
 		require_once('class.SpotterLive.php');
4534 4534
 		$SpotterLive = new SpotterLive();
4535
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4535
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4536 4536
 		$filter_query .= ' over_country IS NOT NULL';
4537 4537
                 if ($olderthanmonths > 0) {
4538 4538
 			if ($globalDBdriver == 'mysql') {
@@ -4559,7 +4559,7 @@  discard block
 block discarded – undo
4559 4559
 		$flight_array = array();
4560 4560
 		$temp_array = array();
4561 4561
         
4562
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4562
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4563 4563
 		{
4564 4564
 			$temp_array['flight_count'] = $row['nb'];
4565 4565
 			$temp_array['flight_country'] = $row['name'];
@@ -4577,12 +4577,12 @@  discard block
 block discarded – undo
4577 4577
 	* @return Array the aircraft list
4578 4578
 	*
4579 4579
 	*/
4580
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4580
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4581 4581
 	{
4582 4582
 		global $globalDBdriver;
4583
-		$filter_query = $this->getFilter($filters,true,true);
4583
+		$filter_query = $this->getFilter($filters, true, true);
4584 4584
 
4585
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4585
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4586 4586
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4587 4587
 		if ($olderthanmonths > 0) {
4588 4588
 			if ($globalDBdriver == 'mysql') {
@@ -4607,7 +4607,7 @@  discard block
 block discarded – undo
4607 4607
 
4608 4608
 		$aircraft_array = array();
4609 4609
 		$temp_array = array();
4610
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4610
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4611 4611
 		{
4612 4612
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4613 4613
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4624,11 +4624,11 @@  discard block
 block discarded – undo
4624 4624
 	* @return Array the aircraft list
4625 4625
 	*
4626 4626
 	*/
4627
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4627
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4628 4628
 	{
4629 4629
 		global $globalDBdriver;
4630
-		$filter_query = $this->getFilter($filters,true,true);
4631
-		$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 
4630
+		$filter_query = $this->getFilter($filters, true, true);
4631
+		$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 
4632 4632
 		    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' ";
4633 4633
 		if ($olderthanmonths > 0) {
4634 4634
 			if ($globalDBdriver == 'mysql') {
@@ -4653,7 +4653,7 @@  discard block
 block discarded – undo
4653 4653
 
4654 4654
 		$aircraft_array = array();
4655 4655
 		$temp_array = array();
4656
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4656
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4657 4657
 		{
4658 4658
 			$temp_array['airline_icao'] = $row['airline_icao'];
4659 4659
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4671,11 +4671,11 @@  discard block
 block discarded – undo
4671 4671
 	* @return Array the aircraft list
4672 4672
 	*
4673 4673
 	*/
4674
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4674
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4675 4675
 	{
4676 4676
 		global $globalDBdriver;
4677
-		$filter_query = $this->getFilter($filters,true,true);
4678
-		$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 
4677
+		$filter_query = $this->getFilter($filters, true, true);
4678
+		$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 
4679 4679
 		    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' ";
4680 4680
 		if ($olderthanmonths > 0) {
4681 4681
 			if ($globalDBdriver == 'mysql') {
@@ -4700,7 +4700,7 @@  discard block
 block discarded – undo
4700 4700
 
4701 4701
 		$aircraft_array = array();
4702 4702
 		$temp_array = array();
4703
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4703
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4704 4704
 		{
4705 4705
 			//$temp_array['airline_icao'] = $row['airline_icao'];
4706 4706
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4719,13 +4719,13 @@  discard block
 block discarded – undo
4719 4719
 	* @return Array the aircraft list
4720 4720
 	*
4721 4721
 	*/
4722
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4722
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4723 4723
 	{
4724 4724
 		$Image = new Image($this->db);
4725
-		$filter_query = $this->getFilter($filters,true,true);
4726
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4725
+		$filter_query = $this->getFilter($filters, true, true);
4726
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4727 4727
 
4728
-		$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  
4728
+		$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  
4729 4729
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4730 4730
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4731 4731
 				ORDER BY registration_count DESC";
@@ -4736,14 +4736,14 @@  discard block
 block discarded – undo
4736 4736
 		$aircraft_array = array();
4737 4737
 		$temp_array = array();
4738 4738
         
4739
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4739
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4740 4740
 		{
4741 4741
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4742 4742
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4743 4743
 			$temp_array['registration'] = $row['registration'];
4744 4744
 			$temp_array['airline_name'] = $row['airline_name'];
4745 4745
 			$temp_array['image_thumbnail'] = "";
4746
-			if($row['registration'] != "")
4746
+			if ($row['registration'] != "")
4747 4747
 			{
4748 4748
 				$image_array = $Image->getSpotterImage($row['registration']);
4749 4749
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4762,11 +4762,11 @@  discard block
 block discarded – undo
4762 4762
 	* @return Array the aircraft list
4763 4763
 	*
4764 4764
 	*/
4765
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4765
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4766 4766
 	{
4767
-		$filter_query = $this->getFilter($filters,true,true);
4768
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4769
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4767
+		$filter_query = $this->getFilter($filters, true, true);
4768
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4769
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4770 4770
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4771 4771
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4772 4772
 			    ORDER BY aircraft_icao_count DESC";
@@ -4777,7 +4777,7 @@  discard block
 block discarded – undo
4777 4777
 		$aircraft_array = array();
4778 4778
 		$temp_array = array();
4779 4779
 
4780
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4780
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4781 4781
 		{
4782 4782
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4783 4783
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4795,13 +4795,13 @@  discard block
 block discarded – undo
4795 4795
 	* @return Array the aircraft list
4796 4796
 	*
4797 4797
 	*/
4798
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4798
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4799 4799
 	{
4800
-		$filter_query = $this->getFilter($filters,true,true);
4800
+		$filter_query = $this->getFilter($filters, true, true);
4801 4801
 		$Image = new Image($this->db);
4802
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4802
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4803 4803
 
4804
-		$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 
4804
+		$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 
4805 4805
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4806 4806
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4807 4807
 			    ORDER BY registration_count DESC";
@@ -4811,14 +4811,14 @@  discard block
 block discarded – undo
4811 4811
 
4812 4812
 		$aircraft_array = array();
4813 4813
 		$temp_array = array();
4814
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4814
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4815 4815
 		{
4816 4816
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4817 4817
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4818 4818
 			$temp_array['registration'] = $row['registration'];
4819 4819
 			$temp_array['airline_name'] = $row['airline_name'];
4820 4820
 			$temp_array['image_thumbnail'] = "";
4821
-			if($row['registration'] != "")
4821
+			if ($row['registration'] != "")
4822 4822
 			{
4823 4823
 				$image_array = $Image->getSpotterImage($row['registration']);
4824 4824
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4837,11 +4837,11 @@  discard block
 block discarded – undo
4837 4837
 	* @return Array the aircraft list
4838 4838
 	*
4839 4839
 	*/
4840
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4840
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4841 4841
 	{
4842
-		$filter_query = $this->getFilter($filters,true,true);
4843
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4844
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4842
+		$filter_query = $this->getFilter($filters, true, true);
4843
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4844
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4845 4845
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4846 4846
 				GROUP BY spotter_output.aircraft_manufacturer 
4847 4847
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4852,7 +4852,7 @@  discard block
 block discarded – undo
4852 4852
 		$aircraft_array = array();
4853 4853
 		$temp_array = array();
4854 4854
 
4855
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4855
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4856 4856
 		{
4857 4857
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4858 4858
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4869,12 +4869,12 @@  discard block
 block discarded – undo
4869 4869
 	* @return Array the aircraft list
4870 4870
 	*
4871 4871
 	*/
4872
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4872
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4873 4873
 	{
4874
-		$filter_query = $this->getFilter($filters,true,true);
4875
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4874
+		$filter_query = $this->getFilter($filters, true, true);
4875
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4876 4876
 
4877
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4877
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4878 4878
 				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) 
4879 4879
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4880 4880
 				ORDER BY aircraft_icao_count DESC";
@@ -4884,7 +4884,7 @@  discard block
 block discarded – undo
4884 4884
 
4885 4885
 		$aircraft_array = array();
4886 4886
 		$temp_array = array();
4887
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4887
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4888 4888
 		{
4889 4889
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4890 4890
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4902,13 +4902,13 @@  discard block
 block discarded – undo
4902 4902
 	* @return Array the aircraft list
4903 4903
 	*
4904 4904
 	*/
4905
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4905
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4906 4906
 	{
4907
-		$filter_query = $this->getFilter($filters,true,true);
4907
+		$filter_query = $this->getFilter($filters, true, true);
4908 4908
 		$Image = new Image($this->db);
4909
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4909
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4910 4910
 
4911
-		$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  
4911
+		$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  
4912 4912
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4913 4913
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4914 4914
 		    ORDER BY registration_count DESC";
@@ -4918,14 +4918,14 @@  discard block
 block discarded – undo
4918 4918
 
4919 4919
 		$aircraft_array = array();
4920 4920
 		$temp_array = array();
4921
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4921
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4922 4922
 		{
4923 4923
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4924 4924
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4925 4925
 			$temp_array['registration'] = $row['registration'];
4926 4926
 			$temp_array['airline_name'] = $row['airline_name'];
4927 4927
 			$temp_array['image_thumbnail'] = "";
4928
-			if($row['registration'] != "")
4928
+			if ($row['registration'] != "")
4929 4929
 			{
4930 4930
 				$image_array = $Image->getSpotterImage($row['registration']);
4931 4931
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4943,11 +4943,11 @@  discard block
 block discarded – undo
4943 4943
 	* @return Array the aircraft list
4944 4944
 	*
4945 4945
 	*/
4946
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4946
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4947 4947
 	{
4948
-		$filter_query = $this->getFilter($filters,true,true);
4949
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4950
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4948
+		$filter_query = $this->getFilter($filters, true, true);
4949
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4950
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4951 4951
                     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)  
4952 4952
                     GROUP BY spotter_output.aircraft_manufacturer 
4953 4953
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4958,7 +4958,7 @@  discard block
 block discarded – undo
4958 4958
 
4959 4959
 		$aircraft_array = array();
4960 4960
 		$temp_array = array();
4961
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4961
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4962 4962
 		{
4963 4963
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4964 4964
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4973,12 +4973,12 @@  discard block
 block discarded – undo
4973 4973
 	* @return Array the aircraft list
4974 4974
 	*
4975 4975
 	*/
4976
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4976
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4977 4977
 	{
4978
-		$filter_query = $this->getFilter($filters,true,true);
4979
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4978
+		$filter_query = $this->getFilter($filters, true, true);
4979
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4980 4980
 
4981
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4981
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4982 4982
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4983 4983
                     GROUP BY spotter_output.aircraft_name 
4984 4984
 					ORDER BY aircraft_icao_count DESC";
@@ -4987,7 +4987,7 @@  discard block
 block discarded – undo
4987 4987
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4988 4988
 		$aircraft_array = array();
4989 4989
 		$temp_array = array();
4990
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4990
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4991 4991
 		{
4992 4992
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4993 4993
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5006,11 +5006,11 @@  discard block
 block discarded – undo
5006 5006
 	*/
5007 5007
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5008 5008
 	{
5009
-		$filter_query = $this->getFilter($filters,true,true);
5009
+		$filter_query = $this->getFilter($filters, true, true);
5010 5010
 		$Image = new Image($this->db);
5011
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5011
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5012 5012
 
5013
-		$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   
5013
+		$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   
5014 5014
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5015 5015
                     GROUP BY spotter_output.registration 
5016 5016
 					ORDER BY registration_count DESC";
@@ -5020,14 +5020,14 @@  discard block
 block discarded – undo
5020 5020
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5021 5021
 		$aircraft_array = array();
5022 5022
 		$temp_array = array();
5023
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5023
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5024 5024
 		{
5025 5025
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5026 5026
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5027 5027
 			$temp_array['registration'] = $row['registration'];
5028 5028
 			$temp_array['airline_name'] = $row['airline_name'];
5029 5029
 			$temp_array['image_thumbnail'] = "";
5030
-			if($row['registration'] != "")
5030
+			if ($row['registration'] != "")
5031 5031
 			{
5032 5032
 				$image_array = $Image->getSpotterImage($row['registration']);
5033 5033
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5044,11 +5044,11 @@  discard block
 block discarded – undo
5044 5044
 	* @return Array the aircraft list
5045 5045
 	*
5046 5046
 	*/
5047
-	public function countAllAircraftTypesByDate($date,$filters = array())
5047
+	public function countAllAircraftTypesByDate($date, $filters = array())
5048 5048
 	{
5049 5049
 		global $globalTimezone, $globalDBdriver;
5050
-		$filter_query = $this->getFilter($filters,true,true);
5051
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5050
+		$filter_query = $this->getFilter($filters, true, true);
5051
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5052 5052
 		if ($globalTimezone != '') {
5053 5053
 			date_default_timezone_set($globalTimezone);
5054 5054
 			$datetime = new DateTime($date);
@@ -5056,12 +5056,12 @@  discard block
 block discarded – undo
5056 5056
 		} else $offset = '+00:00';
5057 5057
 
5058 5058
 		if ($globalDBdriver == 'mysql') {
5059
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5059
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5060 5060
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5061 5061
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5062 5062
 					ORDER BY aircraft_icao_count DESC";
5063 5063
 		} else {
5064
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5064
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5065 5065
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5066 5066
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5067 5067
 					ORDER BY aircraft_icao_count DESC";
@@ -5072,7 +5072,7 @@  discard block
 block discarded – undo
5072 5072
 
5073 5073
 		$aircraft_array = array();
5074 5074
 		$temp_array = array();
5075
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5075
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5076 5076
 		{
5077 5077
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5078 5078
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5090,12 +5090,12 @@  discard block
 block discarded – undo
5090 5090
 	* @return Array the aircraft list
5091 5091
 	*
5092 5092
 	*/
5093
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5093
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5094 5094
 	{
5095 5095
 		global $globalTimezone, $globalDBdriver;
5096
-		$filter_query = $this->getFilter($filters,true,true);
5096
+		$filter_query = $this->getFilter($filters, true, true);
5097 5097
 		$Image = new Image($this->db);
5098
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5098
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5099 5099
 		if ($globalTimezone != '') {
5100 5100
 			date_default_timezone_set($globalTimezone);
5101 5101
 			$datetime = new DateTime($date);
@@ -5103,12 +5103,12 @@  discard block
 block discarded – undo
5103 5103
 		} else $offset = '+00:00';
5104 5104
 
5105 5105
 		if ($globalDBdriver == 'mysql') {
5106
-			$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 
5106
+			$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 
5107 5107
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5108 5108
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5109 5109
 					ORDER BY registration_count DESC";
5110 5110
 		} else {
5111
-			$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    
5111
+			$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    
5112 5112
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5113 5113
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5114 5114
 					ORDER BY registration_count DESC";
@@ -5119,14 +5119,14 @@  discard block
 block discarded – undo
5119 5119
 
5120 5120
 		$aircraft_array = array();
5121 5121
 		$temp_array = array();
5122
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5122
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5123 5123
 		{
5124 5124
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5125 5125
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5126 5126
 			$temp_array['registration'] = $row['registration'];
5127 5127
 			$temp_array['airline_name'] = $row['airline_name'];
5128 5128
 			$temp_array['image_thumbnail'] = "";
5129
-			if($row['registration'] != "")
5129
+			if ($row['registration'] != "")
5130 5130
 			{
5131 5131
 				$image_array = $Image->getSpotterImage($row['registration']);
5132 5132
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5145,11 +5145,11 @@  discard block
 block discarded – undo
5145 5145
 	* @return Array the aircraft manufacturer list
5146 5146
 	*
5147 5147
 	*/
5148
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5148
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5149 5149
 	{
5150 5150
 		global $globalTimezone, $globalDBdriver;
5151
-		$filter_query = $this->getFilter($filters,true,true);
5152
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5151
+		$filter_query = $this->getFilter($filters, true, true);
5152
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5153 5153
 		if ($globalTimezone != '') {
5154 5154
 			date_default_timezone_set($globalTimezone);
5155 5155
 			$datetime = new DateTime($date);
@@ -5157,12 +5157,12 @@  discard block
 block discarded – undo
5157 5157
 		} else $offset = '+00:00';
5158 5158
 
5159 5159
 		if ($globalDBdriver == 'mysql') {
5160
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5160
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5161 5161
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5162 5162
 				GROUP BY spotter_output.aircraft_manufacturer 
5163 5163
 				ORDER BY aircraft_manufacturer_count DESC";
5164 5164
 		} else {
5165
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5165
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5166 5166
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5167 5167
 				GROUP BY spotter_output.aircraft_manufacturer 
5168 5168
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5174,7 +5174,7 @@  discard block
 block discarded – undo
5174 5174
 		$aircraft_array = array();
5175 5175
 		$temp_array = array();
5176 5176
 
5177
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5177
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5178 5178
 		{
5179 5179
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5180 5180
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5191,11 +5191,11 @@  discard block
 block discarded – undo
5191 5191
 	* @return Array the aircraft list
5192 5192
 	*
5193 5193
 	*/
5194
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5194
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5195 5195
 	{
5196
-		$filter_query = $this->getFilter($filters,true,true);
5197
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5198
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5196
+		$filter_query = $this->getFilter($filters, true, true);
5197
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5198
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5199 5199
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5200 5200
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5201 5201
 				ORDER BY aircraft_icao_count DESC";
@@ -5206,7 +5206,7 @@  discard block
 block discarded – undo
5206 5206
 		$aircraft_array = array();
5207 5207
 		$temp_array = array();
5208 5208
 
5209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5210 5210
 		{
5211 5211
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5212 5212
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5224,13 +5224,13 @@  discard block
 block discarded – undo
5224 5224
 	* @return Array the aircraft list
5225 5225
 	*
5226 5226
 	*/
5227
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5227
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5228 5228
 	{
5229
-		$filter_query = $this->getFilter($filters,true,true);
5229
+		$filter_query = $this->getFilter($filters, true, true);
5230 5230
 		$Image = new Image($this->db);
5231
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5231
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5232 5232
 
5233
-		$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  
5233
+		$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  
5234 5234
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5235 5235
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5236 5236
 		    ORDER BY registration_count DESC";
@@ -5242,14 +5242,14 @@  discard block
 block discarded – undo
5242 5242
 		$aircraft_array = array();
5243 5243
 		$temp_array = array();
5244 5244
         
5245
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5245
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5246 5246
 		{
5247 5247
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5248 5248
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5249 5249
 			$temp_array['registration'] = $row['registration'];
5250 5250
 			$temp_array['airline_name'] = $row['airline_name'];
5251 5251
 			$temp_array['image_thumbnail'] = "";
5252
-			if($row['registration'] != "")
5252
+			if ($row['registration'] != "")
5253 5253
 			{
5254 5254
 				$image_array = $Image->getSpotterImage($row['registration']);
5255 5255
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5268,11 +5268,11 @@  discard block
 block discarded – undo
5268 5268
 	* @return Array the aircraft manufacturer list
5269 5269
 	*
5270 5270
 	*/
5271
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5271
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5272 5272
 	{
5273
-		$filter_query = $this->getFilter($filters,true,true);
5274
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5275
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5273
+		$filter_query = $this->getFilter($filters, true, true);
5274
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5275
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5276 5276
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5277 5277
                     GROUP BY spotter_output.aircraft_manufacturer 
5278 5278
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5282,7 +5282,7 @@  discard block
 block discarded – undo
5282 5282
 		$sth->execute(array(':ident' => $ident));
5283 5283
 		$aircraft_array = array();
5284 5284
 		$temp_array = array();
5285
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5285
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5286 5286
 		{
5287 5287
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5288 5288
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5298,24 +5298,24 @@  discard block
 block discarded – undo
5298 5298
 	* @return Array the aircraft list
5299 5299
 	*
5300 5300
 	*/
5301
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5301
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5302 5302
 	{
5303
-		$filter_query = $this->getFilter($filters,true,true);
5304
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5305
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5303
+		$filter_query = $this->getFilter($filters, true, true);
5304
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5305
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5306 5306
 		
5307 5307
 
5308
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5308
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5309 5309
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5310 5310
                     GROUP BY spotter_output.aircraft_name 
5311 5311
 					ORDER BY aircraft_icao_count DESC";
5312 5312
  
5313 5313
 		
5314 5314
 		$sth = $this->db->prepare($query);
5315
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5315
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5316 5316
 		$aircraft_array = array();
5317 5317
 		$temp_array = array();
5318
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5318
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5319 5319
 		{
5320 5320
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5321 5321
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5331,33 +5331,33 @@  discard block
 block discarded – undo
5331 5331
 	* @return Array the aircraft list
5332 5332
 	*
5333 5333
 	*/
5334
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5334
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5335 5335
 	{
5336
-		$filter_query = $this->getFilter($filters,true,true);
5336
+		$filter_query = $this->getFilter($filters, true, true);
5337 5337
 		$Image = new Image($this->db);
5338
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5339
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5338
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5339
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5340 5340
 
5341
-		$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   
5341
+		$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   
5342 5342
                     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)   
5343 5343
                     GROUP BY spotter_output.registration 
5344 5344
 					ORDER BY registration_count DESC";
5345 5345
 
5346 5346
 		
5347 5347
 		$sth = $this->db->prepare($query);
5348
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5348
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5349 5349
       
5350 5350
 		$aircraft_array = array();
5351 5351
 		$temp_array = array();
5352 5352
         
5353
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5353
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5354 5354
 		{
5355 5355
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5356 5356
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5357 5357
 			$temp_array['registration'] = $row['registration'];
5358 5358
 			$temp_array['airline_name'] = $row['airline_name'];
5359 5359
 			$temp_array['image_thumbnail'] = "";
5360
-			if($row['registration'] != "")
5360
+			if ($row['registration'] != "")
5361 5361
 			{
5362 5362
 				$image_array = $Image->getSpotterImage($row['registration']);
5363 5363
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5377,25 +5377,25 @@  discard block
 block discarded – undo
5377 5377
 	* @return Array the aircraft manufacturer list
5378 5378
 	*
5379 5379
 	*/
5380
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5380
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5381 5381
 	{
5382
-		$filter_query = $this->getFilter($filters,true,true);
5383
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5384
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5382
+		$filter_query = $this->getFilter($filters, true, true);
5383
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5384
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5385 5385
 
5386
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5386
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5387 5387
                     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) 
5388 5388
                     GROUP BY spotter_output.aircraft_manufacturer 
5389 5389
 					ORDER BY aircraft_manufacturer_count DESC";
5390 5390
 
5391 5391
 		
5392 5392
 		$sth = $this->db->prepare($query);
5393
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5393
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5394 5394
       
5395 5395
 		$aircraft_array = array();
5396 5396
 		$temp_array = array();
5397 5397
         
5398
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5398
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5399 5399
 		{
5400 5400
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5401 5401
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5415,11 +5415,11 @@  discard block
 block discarded – undo
5415 5415
 	* @return Array the aircraft list
5416 5416
 	*
5417 5417
 	*/
5418
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5418
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5419 5419
 	{
5420
-		$filter_query = $this->getFilter($filters,true,true);
5421
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5422
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5420
+		$filter_query = $this->getFilter($filters, true, true);
5421
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5422
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5423 5423
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5424 5424
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5425 5425
 			    ORDER BY aircraft_icao_count DESC";
@@ -5431,7 +5431,7 @@  discard block
 block discarded – undo
5431 5431
 		$aircraft_array = array();
5432 5432
 		$temp_array = array();
5433 5433
         
5434
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5434
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5435 5435
 		{
5436 5436
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5437 5437
 			$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 countAllAircraftRegistrationByCountry($country,$filters = array())
5453
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5454 5454
 	{
5455
-		$filter_query = $this->getFilter($filters,true,true);
5455
+		$filter_query = $this->getFilter($filters, true, true);
5456 5456
 		$Image = new Image($this->db);
5457
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5458
-		$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 
5457
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5458
+		$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 
5459 5459
 			    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)    
5460 5460
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5461 5461
 			    ORDER BY registration_count DESC";
@@ -5467,14 +5467,14 @@  discard block
 block discarded – undo
5467 5467
 		$aircraft_array = array();
5468 5468
 		$temp_array = array();
5469 5469
         
5470
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5470
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5471 5471
 		{
5472 5472
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5473 5473
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5474 5474
 			$temp_array['registration'] = $row['registration'];
5475 5475
 			$temp_array['airline_name'] = $row['airline_name'];
5476 5476
 			$temp_array['image_thumbnail'] = "";
5477
-			if($row['registration'] != "")
5477
+			if ($row['registration'] != "")
5478 5478
 			{
5479 5479
 				$image_array = $Image->getSpotterImage($row['registration']);
5480 5480
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5494,11 +5494,11 @@  discard block
 block discarded – undo
5494 5494
 	* @return Array the aircraft manufacturer list
5495 5495
 	*
5496 5496
 	*/
5497
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5497
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5498 5498
 	{
5499
-		$filter_query = $this->getFilter($filters,true,true);
5500
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5501
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5499
+		$filter_query = $this->getFilter($filters, true, true);
5500
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5501
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5502 5502
                     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) 
5503 5503
                     GROUP BY spotter_output.aircraft_manufacturer 
5504 5504
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5510,7 +5510,7 @@  discard block
 block discarded – undo
5510 5510
 		$aircraft_array = array();
5511 5511
 		$temp_array = array();
5512 5512
         
5513
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5513
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5514 5514
 		{
5515 5515
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5516 5516
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5531,8 +5531,8 @@  discard block
 block discarded – undo
5531 5531
 	*/
5532 5532
 	public function countAllAircraftManufacturers($filters = array())
5533 5533
 	{
5534
-		$filter_query = $this->getFilter($filters,true,true);
5535
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5534
+		$filter_query = $this->getFilter($filters, true, true);
5535
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5536 5536
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5537 5537
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5538 5538
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5545,7 +5545,7 @@  discard block
 block discarded – undo
5545 5545
 		$manufacturer_array = array();
5546 5546
 		$temp_array = array();
5547 5547
         
5548
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5548
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5549 5549
 		{
5550 5550
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5551 5551
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5564,12 +5564,12 @@  discard block
 block discarded – undo
5564 5564
 	* @return Array the aircraft list
5565 5565
 	*
5566 5566
 	*/
5567
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5567
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5568 5568
 	{
5569 5569
 		global $globalDBdriver;
5570 5570
 		$Image = new Image($this->db);
5571
-		$filter_query = $this->getFilter($filters,true,true);
5572
-		$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    
5571
+		$filter_query = $this->getFilter($filters, true, true);
5572
+		$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    
5573 5573
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5574 5574
                 if ($olderthanmonths > 0) {
5575 5575
             		if ($globalDBdriver == 'mysql') {
@@ -5597,7 +5597,7 @@  discard block
 block discarded – undo
5597 5597
 		$aircraft_array = array();
5598 5598
 		$temp_array = array();
5599 5599
         
5600
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5600
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5601 5601
 		{
5602 5602
 			$temp_array['registration'] = $row['registration'];
5603 5603
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5605,7 +5605,7 @@  discard block
 block discarded – undo
5605 5605
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5606 5606
 			$temp_array['airline_name'] = $row['airline_name'];
5607 5607
 			$temp_array['image_thumbnail'] = "";
5608
-			if($row['registration'] != "")
5608
+			if ($row['registration'] != "")
5609 5609
 			{
5610 5610
 				$image_array = $Image->getSpotterImage($row['registration']);
5611 5611
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5624,12 +5624,12 @@  discard block
 block discarded – undo
5624 5624
 	* @return Array the aircraft list
5625 5625
 	*
5626 5626
 	*/
5627
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5627
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5628 5628
 	{
5629 5629
 		global $globalDBdriver;
5630
-		$filter_query = $this->getFilter($filters,true,true);
5630
+		$filter_query = $this->getFilter($filters, true, true);
5631 5631
 		$Image = new Image($this->db);
5632
-		$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    
5632
+		$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    
5633 5633
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5634 5634
                 if ($olderthanmonths > 0) {
5635 5635
             		if ($globalDBdriver == 'mysql') {
@@ -5657,7 +5657,7 @@  discard block
 block discarded – undo
5657 5657
 		$aircraft_array = array();
5658 5658
 		$temp_array = array();
5659 5659
         
5660
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5660
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5661 5661
 		{
5662 5662
 			$temp_array['registration'] = $row['registration'];
5663 5663
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5666,7 +5666,7 @@  discard block
 block discarded – undo
5666 5666
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5667 5667
 			$temp_array['airline_name'] = $row['airline_name'];
5668 5668
 			$temp_array['image_thumbnail'] = "";
5669
-			if($row['registration'] != "")
5669
+			if ($row['registration'] != "")
5670 5670
 			{
5671 5671
 				$image_array = $Image->getSpotterImage($row['registration']);
5672 5672
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5685,11 +5685,11 @@  discard block
 block discarded – undo
5685 5685
 	* @return Array the airport list
5686 5686
 	*
5687 5687
 	*/
5688
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5688
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5689 5689
 	{
5690 5690
 		global $globalDBdriver;
5691
-		$filter_query = $this->getFilter($filters,true,true);
5692
-		$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 
5691
+		$filter_query = $this->getFilter($filters, true, true);
5692
+		$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 
5693 5693
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5694 5694
                 if ($olderthanmonths > 0) {
5695 5695
             		if ($globalDBdriver == 'mysql') {
@@ -5718,7 +5718,7 @@  discard block
 block discarded – undo
5718 5718
 		$airport_array = array();
5719 5719
 		$temp_array = array();
5720 5720
         
5721
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5721
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5722 5722
 		{
5723 5723
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5724 5724
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5737,11 +5737,11 @@  discard block
 block discarded – undo
5737 5737
 	* @return Array the airport list
5738 5738
 	*
5739 5739
 	*/
5740
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5740
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5741 5741
 	{
5742 5742
 		global $globalDBdriver;
5743
-		$filter_query = $this->getFilter($filters,true,true);
5744
-		$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 
5743
+		$filter_query = $this->getFilter($filters, true, true);
5744
+		$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 
5745 5745
 			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 <> '' ";
5746 5746
                 if ($olderthanmonths > 0) {
5747 5747
             		if ($globalDBdriver == 'mysql') {
@@ -5770,7 +5770,7 @@  discard block
 block discarded – undo
5770 5770
 		$airport_array = array();
5771 5771
 		$temp_array = array();
5772 5772
         
5773
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5773
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5774 5774
 		{
5775 5775
 			$temp_array['airline_icao'] = $row['airline_icao'];
5776 5776
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5790,11 +5790,11 @@  discard block
 block discarded – undo
5790 5790
 	* @return Array the airport list
5791 5791
 	*
5792 5792
 	*/
5793
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5793
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5794 5794
 	{
5795 5795
 		global $globalDBdriver;
5796
-		$filter_query = $this->getFilter($filters,true,true);
5797
-		$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
5796
+		$filter_query = $this->getFilter($filters, true, true);
5797
+		$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
5798 5798
 				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";
5799 5799
                 if ($olderthanmonths > 0) {
5800 5800
             		if ($globalDBdriver == 'mysql') {
@@ -5822,7 +5822,7 @@  discard block
 block discarded – undo
5822 5822
 		$airport_array = array();
5823 5823
 		$temp_array = array();
5824 5824
         
5825
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5825
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5826 5826
 		{
5827 5827
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5828 5828
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5841,11 +5841,11 @@  discard block
 block discarded – undo
5841 5841
 	* @return Array the airport list
5842 5842
 	*
5843 5843
 	*/
5844
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5844
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5845 5845
 	{
5846 5846
 		global $globalDBdriver;
5847
-		$filter_query = $this->getFilter($filters,true,true);
5848
-		$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
5847
+		$filter_query = $this->getFilter($filters, true, true);
5848
+		$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
5849 5849
 				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 ";
5850 5850
                 if ($olderthanmonths > 0) {
5851 5851
             		if ($globalDBdriver == 'mysql') {
@@ -5874,7 +5874,7 @@  discard block
 block discarded – undo
5874 5874
 		$airport_array = array();
5875 5875
 		$temp_array = array();
5876 5876
         
5877
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5877
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5878 5878
 		{
5879 5879
 			$temp_array['airline_icao'] = $row['airline_icao'];
5880 5880
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5894,11 +5894,11 @@  discard block
 block discarded – undo
5894 5894
 	* @return Array the airport list
5895 5895
 	*
5896 5896
 	*/
5897
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5897
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5898 5898
 	{
5899
-		$filter_query = $this->getFilter($filters,true,true);
5900
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5901
-		$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 
5899
+		$filter_query = $this->getFilter($filters, true, true);
5900
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5901
+		$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 
5902 5902
 			    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 <> '' 
5903 5903
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5904 5904
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5910,7 +5910,7 @@  discard block
 block discarded – undo
5910 5910
 		$airport_array = array();
5911 5911
 		$temp_array = array();
5912 5912
         
5913
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5913
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5914 5914
 		{
5915 5915
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5916 5916
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5932,11 +5932,11 @@  discard block
 block discarded – undo
5932 5932
 	* @return Array the airport list
5933 5933
 	*
5934 5934
 	*/
5935
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5935
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5936 5936
 	{
5937
-		$filter_query = $this->getFilter($filters,true,true);
5938
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5939
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5937
+		$filter_query = $this->getFilter($filters, true, true);
5938
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5939
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5940 5940
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5941 5941
                     GROUP BY spotter_output.departure_airport_country
5942 5942
 					ORDER BY airport_departure_country_count DESC";
@@ -5948,7 +5948,7 @@  discard block
 block discarded – undo
5948 5948
 		$airport_array = array();
5949 5949
 		$temp_array = array();
5950 5950
         
5951
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5951
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5952 5952
 		{
5953 5953
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5954 5954
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5967,11 +5967,11 @@  discard block
 block discarded – undo
5967 5967
 	* @return Array the airport list
5968 5968
 	*
5969 5969
 	*/
5970
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5970
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5971 5971
 	{
5972
-		$filter_query = $this->getFilter($filters,true,true);
5973
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5974
-		$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 
5972
+		$filter_query = $this->getFilter($filters, true, true);
5973
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5974
+		$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 
5975 5975
 			    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 <> '' 
5976 5976
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5977 5977
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5983,7 +5983,7 @@  discard block
 block discarded – undo
5983 5983
 		$airport_array = array();
5984 5984
 		$temp_array = array();
5985 5985
         
5986
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5986
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5987 5987
 		{
5988 5988
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5989 5989
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6004,11 +6004,11 @@  discard block
 block discarded – undo
6004 6004
 	* @return Array the airport list
6005 6005
 	*
6006 6006
 	*/
6007
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6007
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6008 6008
 	{
6009
-		$filter_query = $this->getFilter($filters,true,true);
6010
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6011
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6009
+		$filter_query = $this->getFilter($filters, true, true);
6010
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6011
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6012 6012
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6013 6013
                     GROUP BY spotter_output.departure_airport_country
6014 6014
 					ORDER BY airport_departure_country_count DESC";
@@ -6020,7 +6020,7 @@  discard block
 block discarded – undo
6020 6020
 		$airport_array = array();
6021 6021
 		$temp_array = array();
6022 6022
         
6023
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6023
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6024 6024
 		{
6025 6025
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6026 6026
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6038,11 +6038,11 @@  discard block
 block discarded – undo
6038 6038
 	* @return Array the airport list
6039 6039
 	*
6040 6040
 	*/
6041
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6041
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
6042 6042
 	{
6043
-		$filter_query = $this->getFilter($filters,true,true);
6044
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6045
-		$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 
6043
+		$filter_query = $this->getFilter($filters, true, true);
6044
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6045
+		$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 
6046 6046
 			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 <> '' 
6047 6047
                     GROUP BY spotter_output.departure_airport_icao
6048 6048
 					ORDER BY airport_departure_icao_count DESC";
@@ -6054,7 +6054,7 @@  discard block
 block discarded – undo
6054 6054
 		$airport_array = array();
6055 6055
 		$temp_array = array();
6056 6056
         
6057
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6057
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6058 6058
 		{
6059 6059
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6060 6060
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6075,11 +6075,11 @@  discard block
 block discarded – undo
6075 6075
 	* @return Array the airport list
6076 6076
 	*
6077 6077
 	*/
6078
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6078
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6079 6079
 	{
6080
-		$filter_query = $this->getFilter($filters,true,true);
6081
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6082
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6080
+		$filter_query = $this->getFilter($filters, true, true);
6081
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6082
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6083 6083
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
6084 6084
                     GROUP BY spotter_output.departure_airport_country
6085 6085
 					ORDER BY airport_departure_country_count DESC";
@@ -6091,7 +6091,7 @@  discard block
 block discarded – undo
6091 6091
 		$airport_array = array();
6092 6092
 		$temp_array = array();
6093 6093
         
6094
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6094
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6095 6095
 		{
6096 6096
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6097 6097
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6109,11 +6109,11 @@  discard block
 block discarded – undo
6109 6109
 	* @return Array the airport list
6110 6110
 	*
6111 6111
 	*/
6112
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6112
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6113 6113
 	{
6114
-		$filter_query = $this->getFilter($filters,true,true);
6115
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6116
-		$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 
6114
+		$filter_query = $this->getFilter($filters, true, true);
6115
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6116
+		$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 
6117 6117
 			    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 <> '' 
6118 6118
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6119 6119
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6125,7 +6125,7 @@  discard block
 block discarded – undo
6125 6125
 		$airport_array = array();
6126 6126
 		$temp_array = array();
6127 6127
         
6128
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6128
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6129 6129
 		{
6130 6130
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6131 6131
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6146,11 +6146,11 @@  discard block
 block discarded – undo
6146 6146
 	* @return Array the airport list
6147 6147
 	*
6148 6148
 	*/
6149
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6149
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6150 6150
 	{
6151
-		$filter_query = $this->getFilter($filters,true,true);
6152
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6153
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6151
+		$filter_query = $this->getFilter($filters, true, true);
6152
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6153
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6154 6154
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6155 6155
                     GROUP BY spotter_output.departure_airport_country
6156 6156
 					ORDER BY airport_departure_country_count DESC";
@@ -6162,7 +6162,7 @@  discard block
 block discarded – undo
6162 6162
 		$airport_array = array();
6163 6163
 		$temp_array = array();
6164 6164
         
6165
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6165
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6166 6166
 		{
6167 6167
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6168 6168
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6181,11 +6181,11 @@  discard block
 block discarded – undo
6181 6181
 	* @return Array the airport list
6182 6182
 	*
6183 6183
 	*/
6184
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6184
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6185 6185
 	{
6186
-		$filter_query = $this->getFilter($filters,true,true);
6187
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6188
-		$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 
6186
+		$filter_query = $this->getFilter($filters, true, true);
6187
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6188
+		$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 
6189 6189
 			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 <> '' 
6190 6190
                     GROUP BY spotter_output.departure_airport_icao
6191 6191
 					ORDER BY airport_departure_icao_count DESC";
@@ -6197,7 +6197,7 @@  discard block
 block discarded – undo
6197 6197
 		$airport_array = array();
6198 6198
 		$temp_array = array();
6199 6199
         
6200
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6200
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6201 6201
 		{
6202 6202
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6203 6203
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6218,11 +6218,11 @@  discard block
 block discarded – undo
6218 6218
 	* @return Array the airport list
6219 6219
 	*
6220 6220
 	*/
6221
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6221
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6222 6222
 	{
6223
-		$filter_query = $this->getFilter($filters,true,true);
6224
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6225
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6223
+		$filter_query = $this->getFilter($filters, true, true);
6224
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6225
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6226 6226
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6227 6227
                     GROUP BY spotter_output.departure_airport_country
6228 6228
 					ORDER BY airport_departure_country_count DESC";
@@ -6234,7 +6234,7 @@  discard block
 block discarded – undo
6234 6234
 		$airport_array = array();
6235 6235
 		$temp_array = array();
6236 6236
         
6237
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6237
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6238 6238
 		{
6239 6239
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6240 6240
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6252,11 +6252,11 @@  discard block
 block discarded – undo
6252 6252
 	* @return Array the airport list
6253 6253
 	*
6254 6254
 	*/
6255
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6255
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6256 6256
 	{
6257 6257
 		global $globalTimezone, $globalDBdriver;
6258
-		$filter_query = $this->getFilter($filters,true,true);
6259
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6258
+		$filter_query = $this->getFilter($filters, true, true);
6259
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6260 6260
 		if ($globalTimezone != '') {
6261 6261
 			date_default_timezone_set($globalTimezone);
6262 6262
 			$datetime = new DateTime($date);
@@ -6264,12 +6264,12 @@  discard block
 block discarded – undo
6264 6264
 		} else $offset = '+00:00';
6265 6265
 
6266 6266
 		if ($globalDBdriver == 'mysql') {
6267
-			$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 
6267
+			$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 
6268 6268
 					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
6269 6269
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6270 6270
 					ORDER BY airport_departure_icao_count DESC";
6271 6271
 		} else {
6272
-			$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 
6272
+			$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 
6273 6273
 					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
6274 6274
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6275 6275
 					ORDER BY airport_departure_icao_count DESC";
@@ -6281,7 +6281,7 @@  discard block
 block discarded – undo
6281 6281
 		$airport_array = array();
6282 6282
 		$temp_array = array();
6283 6283
         
6284
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6284
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6285 6285
 		{
6286 6286
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6287 6287
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6302,11 +6302,11 @@  discard block
 block discarded – undo
6302 6302
 	* @return Array the airport list
6303 6303
 	*
6304 6304
 	*/
6305
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6305
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6306 6306
 	{
6307 6307
 		global $globalTimezone, $globalDBdriver;
6308
-		$filter_query = $this->getFilter($filters,true,true);
6309
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6308
+		$filter_query = $this->getFilter($filters, true, true);
6309
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6310 6310
 		if ($globalTimezone != '') {
6311 6311
 			date_default_timezone_set($globalTimezone);
6312 6312
 			$datetime = new DateTime($date);
@@ -6314,12 +6314,12 @@  discard block
 block discarded – undo
6314 6314
 		} else $offset = '+00:00';
6315 6315
 
6316 6316
 		if ($globalDBdriver == 'mysql') {
6317
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6317
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6318 6318
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6319 6319
 					GROUP BY spotter_output.departure_airport_country
6320 6320
 					ORDER BY airport_departure_country_count DESC";
6321 6321
 		} else {
6322
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6322
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6323 6323
 					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 
6324 6324
 					GROUP BY spotter_output.departure_airport_country
6325 6325
 					ORDER BY airport_departure_country_count DESC";
@@ -6331,7 +6331,7 @@  discard block
 block discarded – undo
6331 6331
 		$airport_array = array();
6332 6332
 		$temp_array = array();
6333 6333
         
6334
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6334
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6335 6335
 		{
6336 6336
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6337 6337
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6349,11 +6349,11 @@  discard block
 block discarded – undo
6349 6349
 	* @return Array the airport list
6350 6350
 	*
6351 6351
 	*/
6352
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6352
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6353 6353
 	{
6354
-		$filter_query = $this->getFilter($filters,true,true);
6355
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6356
-		$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 
6354
+		$filter_query = $this->getFilter($filters, true, true);
6355
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6356
+		$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 
6357 6357
 		    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 
6358 6358
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6359 6359
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6365,7 +6365,7 @@  discard block
 block discarded – undo
6365 6365
 		$airport_array = array();
6366 6366
 		$temp_array = array();
6367 6367
         
6368
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6368
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6369 6369
 		{
6370 6370
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6371 6371
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6387,11 +6387,11 @@  discard block
 block discarded – undo
6387 6387
 	* @return Array the airport list
6388 6388
 	*
6389 6389
 	*/
6390
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6390
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6391 6391
 	{
6392
-		$filter_query = $this->getFilter($filters,true,true);
6393
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6394
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6392
+		$filter_query = $this->getFilter($filters, true, true);
6393
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6394
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6395 6395
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6396 6396
                     GROUP BY spotter_output.departure_airport_country
6397 6397
 					ORDER BY airport_departure_country_count DESC";
@@ -6403,7 +6403,7 @@  discard block
 block discarded – undo
6403 6403
 		$airport_array = array();
6404 6404
 		$temp_array = array();
6405 6405
         
6406
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6406
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6407 6407
 		{
6408 6408
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6409 6409
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6422,12 +6422,12 @@  discard block
 block discarded – undo
6422 6422
 	* @return Array the airport list
6423 6423
 	*
6424 6424
 	*/
6425
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6425
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6426 6426
 	{
6427
-		$filter_query = $this->getFilter($filters,true,true);
6428
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6427
+		$filter_query = $this->getFilter($filters, true, true);
6428
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6429 6429
 
6430
-		$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 
6430
+		$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 
6431 6431
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6432 6432
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6433 6433
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6439,7 +6439,7 @@  discard block
 block discarded – undo
6439 6439
 		$airport_array = array();
6440 6440
 		$temp_array = array();
6441 6441
         
6442
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6442
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6443 6443
 		{
6444 6444
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6445 6445
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6460,11 +6460,11 @@  discard block
 block discarded – undo
6460 6460
 	* @return Array the airport list
6461 6461
 	*
6462 6462
 	*/
6463
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6463
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6464 6464
 	{
6465
-		$filter_query = $this->getFilter($filters,true,true);
6466
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6467
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6465
+		$filter_query = $this->getFilter($filters, true, true);
6466
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6467
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6468 6468
 			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 
6469 6469
                     GROUP BY spotter_output.departure_airport_country
6470 6470
 					ORDER BY airport_departure_country_count DESC";
@@ -6476,7 +6476,7 @@  discard block
 block discarded – undo
6476 6476
 		$airport_array = array();
6477 6477
 		$temp_array = array();
6478 6478
         
6479
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6479
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6480 6480
 		{
6481 6481
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6482 6482
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6499,11 +6499,11 @@  discard block
 block discarded – undo
6499 6499
 	* @return Array the airport list
6500 6500
 	*
6501 6501
 	*/
6502
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6502
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6503 6503
 	{
6504 6504
 		global $globalDBdriver;
6505
-		$filter_query = $this->getFilter($filters,true,true);
6506
-		$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 
6505
+		$filter_query = $this->getFilter($filters, true, true);
6506
+		$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 
6507 6507
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6508 6508
                 if ($olderthanmonths > 0) {
6509 6509
             		if ($globalDBdriver == 'mysql') {
@@ -6533,7 +6533,7 @@  discard block
 block discarded – undo
6533 6533
 		$airport_array = array();
6534 6534
 		$temp_array = array();
6535 6535
         
6536
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6536
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6537 6537
 		{
6538 6538
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6539 6539
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6556,11 +6556,11 @@  discard block
 block discarded – undo
6556 6556
 	* @return Array the airport list
6557 6557
 	*
6558 6558
 	*/
6559
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6559
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6560 6560
 	{
6561 6561
 		global $globalDBdriver;
6562
-		$filter_query = $this->getFilter($filters,true,true);
6563
-		$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 
6562
+		$filter_query = $this->getFilter($filters, true, true);
6563
+		$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 
6564 6564
 			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 <> '' ";
6565 6565
                 if ($olderthanmonths > 0) {
6566 6566
             		if ($globalDBdriver == 'mysql') {
@@ -6590,7 +6590,7 @@  discard block
 block discarded – undo
6590 6590
 		$airport_array = array();
6591 6591
 		$temp_array = array();
6592 6592
         
6593
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6593
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6594 6594
 		{
6595 6595
 			$temp_array['airline_icao'] = $row['airline_icao'];
6596 6596
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6615,11 +6615,11 @@  discard block
 block discarded – undo
6615 6615
 	* @return Array the airport list
6616 6616
 	*
6617 6617
 	*/
6618
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6618
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6619 6619
 	{
6620 6620
 		global $globalDBdriver;
6621
-		$filter_query = $this->getFilter($filters,true,true);
6622
-		$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 
6621
+		$filter_query = $this->getFilter($filters, true, true);
6622
+		$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 
6623 6623
 			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";
6624 6624
                 if ($olderthanmonths > 0) {
6625 6625
             		if ($globalDBdriver == 'mysql') {
@@ -6648,7 +6648,7 @@  discard block
 block discarded – undo
6648 6648
 		$airport_array = array();
6649 6649
 		$temp_array = array();
6650 6650
         
6651
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6651
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6652 6652
 		{
6653 6653
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6654 6654
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6671,11 +6671,11 @@  discard block
 block discarded – undo
6671 6671
 	* @return Array the airport list
6672 6672
 	*
6673 6673
 	*/
6674
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6674
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6675 6675
 	{
6676 6676
 		global $globalDBdriver;
6677
-		$filter_query = $this->getFilter($filters,true,true);
6678
-		$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 
6677
+		$filter_query = $this->getFilter($filters, true, true);
6678
+		$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 
6679 6679
 			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 ";
6680 6680
                 if ($olderthanmonths > 0) {
6681 6681
             		if ($globalDBdriver == 'mysql') {
@@ -6705,7 +6705,7 @@  discard block
 block discarded – undo
6705 6705
 		$airport_array = array();
6706 6706
 		$temp_array = array();
6707 6707
         
6708
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6708
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6709 6709
 		{
6710 6710
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6711 6711
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6731,9 +6731,9 @@  discard block
 block discarded – undo
6731 6731
 	*/
6732 6732
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6733 6733
 	{
6734
-		$filter_query = $this->getFilter($filters,true,true);
6735
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6736
-		$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 
6734
+		$filter_query = $this->getFilter($filters, true, true);
6735
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6736
+		$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 
6737 6737
 			    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 
6738 6738
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6739 6739
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6744,7 +6744,7 @@  discard block
 block discarded – undo
6744 6744
 		$airport_array = array();
6745 6745
 		$temp_array = array();
6746 6746
         
6747
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6747
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6748 6748
 		{
6749 6749
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6750 6750
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6765,12 +6765,12 @@  discard block
 block discarded – undo
6765 6765
 	* @return Array the airport list
6766 6766
 	*
6767 6767
 	*/
6768
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6768
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6769 6769
 	{
6770
-		$filter_query = $this->getFilter($filters,true,true);
6771
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6770
+		$filter_query = $this->getFilter($filters, true, true);
6771
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6772 6772
 					
6773
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6773
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6774 6774
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6775 6775
                     GROUP BY spotter_output.arrival_airport_country
6776 6776
 					ORDER BY airport_arrival_country_count DESC";
@@ -6782,7 +6782,7 @@  discard block
 block discarded – undo
6782 6782
 		$airport_array = array();
6783 6783
 		$temp_array = array();
6784 6784
         
6785
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6785
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6786 6786
 		{
6787 6787
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6788 6788
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6800,11 +6800,11 @@  discard block
 block discarded – undo
6800 6800
 	* @return Array the airport list
6801 6801
 	*
6802 6802
 	*/
6803
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6803
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6804 6804
 	{
6805
-		$filter_query = $this->getFilter($filters,true,true);
6806
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6807
-		$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 
6805
+		$filter_query = $this->getFilter($filters, true, true);
6806
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6807
+		$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 
6808 6808
 			    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 
6809 6809
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6810 6810
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6816,7 +6816,7 @@  discard block
 block discarded – undo
6816 6816
 		$airport_array = array();
6817 6817
 		$temp_array = array();
6818 6818
         
6819
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6819
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6820 6820
 		{
6821 6821
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6822 6822
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6838,11 +6838,11 @@  discard block
 block discarded – undo
6838 6838
 	* @return Array the airport list
6839 6839
 	*
6840 6840
 	*/
6841
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6841
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6842 6842
 	{
6843
-		$filter_query = $this->getFilter($filters,true,true);
6844
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6845
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6843
+		$filter_query = $this->getFilter($filters, true, true);
6844
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6845
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6846 6846
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6847 6847
                     GROUP BY spotter_output.arrival_airport_country
6848 6848
 					ORDER BY airport_arrival_country_count DESC";
@@ -6854,7 +6854,7 @@  discard block
 block discarded – undo
6854 6854
 		$airport_array = array();
6855 6855
 		$temp_array = array();
6856 6856
         
6857
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6857
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6858 6858
 		{
6859 6859
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6860 6860
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6872,12 +6872,12 @@  discard block
 block discarded – undo
6872 6872
 	* @return Array the airport list
6873 6873
 	*
6874 6874
 	*/
6875
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6875
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6876 6876
 	{
6877
-		$filter_query = $this->getFilter($filters,true,true);
6878
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6877
+		$filter_query = $this->getFilter($filters, true, true);
6878
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6879 6879
 
6880
-		$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 
6880
+		$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 
6881 6881
 			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 
6882 6882
                     GROUP BY spotter_output.arrival_airport_icao
6883 6883
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6889,7 +6889,7 @@  discard block
 block discarded – undo
6889 6889
 		$airport_array = array();
6890 6890
 		$temp_array = array();
6891 6891
         
6892
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6892
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6893 6893
 		{
6894 6894
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6895 6895
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6910,11 +6910,11 @@  discard block
 block discarded – undo
6910 6910
 	* @return Array the airport list
6911 6911
 	*
6912 6912
 	*/
6913
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6913
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6914 6914
 	{
6915
-		$filter_query = $this->getFilter($filters,true,true);
6916
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6917
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6915
+		$filter_query = $this->getFilter($filters, true, true);
6916
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6917
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6918 6918
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6919 6919
                     GROUP BY spotter_output.arrival_airport_country
6920 6920
 					ORDER BY airport_arrival_country_count DESC";
@@ -6926,7 +6926,7 @@  discard block
 block discarded – undo
6926 6926
 		$airport_array = array();
6927 6927
 		$temp_array = array();
6928 6928
         
6929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6930 6930
 		{
6931 6931
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6932 6932
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6945,11 +6945,11 @@  discard block
 block discarded – undo
6945 6945
 	* @return Array the airport list
6946 6946
 	*
6947 6947
 	*/
6948
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6948
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6949 6949
 	{
6950
-		$filter_query = $this->getFilter($filters,true,true);
6951
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6952
-		$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 
6950
+		$filter_query = $this->getFilter($filters, true, true);
6951
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6952
+		$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 
6953 6953
 			    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 
6954 6954
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6955 6955
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6961,7 +6961,7 @@  discard block
 block discarded – undo
6961 6961
 		$airport_array = array();
6962 6962
 		$temp_array = array();
6963 6963
         
6964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6965 6965
 		{
6966 6966
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6967 6967
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6982,11 +6982,11 @@  discard block
 block discarded – undo
6982 6982
 	* @return Array the airport list
6983 6983
 	*
6984 6984
 	*/
6985
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6985
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6986 6986
 	{
6987
-		$filter_query = $this->getFilter($filters,true,true);
6988
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6989
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6987
+		$filter_query = $this->getFilter($filters, true, true);
6988
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6989
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6990 6990
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6991 6991
                     GROUP BY spotter_output.arrival_airport_country
6992 6992
 					ORDER BY airport_arrival_country_count DESC";
@@ -6998,7 +6998,7 @@  discard block
 block discarded – undo
6998 6998
 		$airport_array = array();
6999 6999
 		$temp_array = array();
7000 7000
         
7001
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7001
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7002 7002
 		{
7003 7003
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7004 7004
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7016,11 +7016,11 @@  discard block
 block discarded – undo
7016 7016
 	* @return Array the airport list
7017 7017
 	*
7018 7018
 	*/
7019
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7019
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7020 7020
 	{
7021
-		$filter_query = $this->getFilter($filters,true,true);
7022
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7023
-		$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 
7021
+		$filter_query = $this->getFilter($filters, true, true);
7022
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7023
+		$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 
7024 7024
 			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 
7025 7025
                     GROUP BY spotter_output.arrival_airport_icao
7026 7026
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7032,7 +7032,7 @@  discard block
 block discarded – undo
7032 7032
 		$airport_array = array();
7033 7033
 		$temp_array = array();
7034 7034
         
7035
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7035
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7036 7036
 		{
7037 7037
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7038 7038
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7054,11 +7054,11 @@  discard block
 block discarded – undo
7054 7054
 	* @return Array the airport list
7055 7055
 	*
7056 7056
 	*/
7057
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7057
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7058 7058
 	{
7059
-		$filter_query = $this->getFilter($filters,true,true);
7060
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7061
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7059
+		$filter_query = $this->getFilter($filters, true, true);
7060
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7061
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7062 7062
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7063 7063
                     GROUP BY spotter_output.arrival_airport_country
7064 7064
 					ORDER BY airport_arrival_country_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['arrival_airport_country'] = $row['arrival_airport_country'];
7076 7076
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7089,11 +7089,11 @@  discard block
 block discarded – undo
7089 7089
 	* @return Array the airport list
7090 7090
 	*
7091 7091
 	*/
7092
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7092
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7093 7093
 	{
7094 7094
 		global $globalTimezone, $globalDBdriver;
7095
-		$filter_query = $this->getFilter($filters,true,true);
7096
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7095
+		$filter_query = $this->getFilter($filters, true, true);
7096
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7097 7097
 		if ($globalTimezone != '') {
7098 7098
 			date_default_timezone_set($globalTimezone);
7099 7099
 			$datetime = new DateTime($date);
@@ -7101,12 +7101,12 @@  discard block
 block discarded – undo
7101 7101
 		} else $offset = '+00:00';
7102 7102
 
7103 7103
 		if ($globalDBdriver == 'mysql') {
7104
-			$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 
7104
+			$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 
7105 7105
 					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  
7106 7106
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7107 7107
 					ORDER BY airport_arrival_icao_count DESC";
7108 7108
 		} else {
7109
-			$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 
7109
+			$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 
7110 7110
 					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  
7111 7111
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7112 7112
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7118,7 +7118,7 @@  discard block
 block discarded – undo
7118 7118
 		$airport_array = array();
7119 7119
 		$temp_array = array();
7120 7120
         
7121
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7121
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7122 7122
 		{
7123 7123
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7124 7124
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7142,8 +7142,8 @@  discard block
 block discarded – undo
7142 7142
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7143 7143
 	{
7144 7144
 		global $globalTimezone, $globalDBdriver;
7145
-		$filter_query = $this->getFilter($filters,true,true);
7146
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7145
+		$filter_query = $this->getFilter($filters, true, true);
7146
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7147 7147
 		if ($globalTimezone != '') {
7148 7148
 			date_default_timezone_set($globalTimezone);
7149 7149
 			$datetime = new DateTime($date);
@@ -7151,12 +7151,12 @@  discard block
 block discarded – undo
7151 7151
 		} else $offset = '+00:00';
7152 7152
 
7153 7153
 		if ($globalDBdriver == 'mysql') {
7154
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7154
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7155 7155
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7156 7156
 					GROUP BY spotter_output.arrival_airport_country
7157 7157
 					ORDER BY airport_arrival_country_count DESC";
7158 7158
 		} else {
7159
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7159
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7160 7160
 					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 
7161 7161
 					GROUP BY spotter_output.arrival_airport_country
7162 7162
 					ORDER BY airport_arrival_country_count DESC";
@@ -7168,7 +7168,7 @@  discard block
 block discarded – undo
7168 7168
 		$airport_array = array();
7169 7169
 		$temp_array = array();
7170 7170
         
7171
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7171
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7172 7172
 		{
7173 7173
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7174 7174
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7186,11 +7186,11 @@  discard block
 block discarded – undo
7186 7186
 	* @return Array the airport list
7187 7187
 	*
7188 7188
 	*/
7189
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7189
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7190 7190
 	{
7191
-		$filter_query = $this->getFilter($filters,true,true);
7192
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7193
-		$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 
7191
+		$filter_query = $this->getFilter($filters, true, true);
7192
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7193
+		$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 
7194 7194
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
7195 7195
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7196 7196
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7202,7 +7202,7 @@  discard block
 block discarded – undo
7202 7202
 		$airport_array = array();
7203 7203
 		$temp_array = array();
7204 7204
         
7205
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7205
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7206 7206
 		{
7207 7207
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7208 7208
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7225,9 +7225,9 @@  discard block
 block discarded – undo
7225 7225
 	*/
7226 7226
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7227 7227
 	{
7228
-		$filter_query = $this->getFilter($filters,true,true);
7229
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7230
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7228
+		$filter_query = $this->getFilter($filters, true, true);
7229
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7230
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7231 7231
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7232 7232
                     GROUP BY spotter_output.arrival_airport_country
7233 7233
 					ORDER BY airport_arrival_country_count DESC";
@@ -7239,7 +7239,7 @@  discard block
 block discarded – undo
7239 7239
 		$airport_array = array();
7240 7240
 		$temp_array = array();
7241 7241
         
7242
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7242
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7243 7243
 		{
7244 7244
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7245 7245
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7258,11 +7258,11 @@  discard block
 block discarded – undo
7258 7258
 	* @return Array the airport list
7259 7259
 	*
7260 7260
 	*/
7261
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7261
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7262 7262
 	{
7263
-		$filter_query = $this->getFilter($filters,true,true);
7264
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7265
-		$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 
7263
+		$filter_query = $this->getFilter($filters, true, true);
7264
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7265
+		$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 
7266 7266
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7267 7267
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7268 7268
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7274,7 +7274,7 @@  discard block
 block discarded – undo
7274 7274
 		$airport_array = array();
7275 7275
 		$temp_array = array();
7276 7276
         
7277
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7277
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7278 7278
 		{
7279 7279
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7280 7280
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7295,11 +7295,11 @@  discard block
 block discarded – undo
7295 7295
 	* @return Array the airport list
7296 7296
 	*
7297 7297
 	*/
7298
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7298
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7299 7299
 	{
7300
-		$filter_query = $this->getFilter($filters,true,true);
7301
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7302
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7300
+		$filter_query = $this->getFilter($filters, true, true);
7301
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7302
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7303 7303
 			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 
7304 7304
                     GROUP BY spotter_output.arrival_airport_country
7305 7305
 					ORDER BY airport_arrival_country_count DESC";
@@ -7311,7 +7311,7 @@  discard block
 block discarded – undo
7311 7311
 		$airport_array = array();
7312 7312
 		$temp_array = array();
7313 7313
         
7314
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7314
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7315 7315
 		{
7316 7316
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7317 7317
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7332,7 +7332,7 @@  discard block
 block discarded – undo
7332 7332
 	*/
7333 7333
 	public function countAllDepartureCountries($filters = array())
7334 7334
 	{
7335
-		$filter_query = $this->getFilter($filters,true,true);
7335
+		$filter_query = $this->getFilter($filters, true, true);
7336 7336
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7337 7337
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
7338 7338
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7346,7 +7346,7 @@  discard block
 block discarded – undo
7346 7346
 		$airport_array = array();
7347 7347
 		$temp_array = array();
7348 7348
         
7349
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7349
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7350 7350
 		{
7351 7351
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7352 7352
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7364,9 +7364,9 @@  discard block
 block discarded – undo
7364 7364
 	* @return Array the airport arrival list
7365 7365
 	*
7366 7366
 	*/
7367
-	public function countAllArrivalCountries($limit = true,$filters = array())
7367
+	public function countAllArrivalCountries($limit = true, $filters = array())
7368 7368
 	{
7369
-		$filter_query = $this->getFilter($filters,true,true);
7369
+		$filter_query = $this->getFilter($filters, true, true);
7370 7370
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7371 7371
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7372 7372
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7380,7 +7380,7 @@  discard block
 block discarded – undo
7380 7380
 		$airport_array = array();
7381 7381
 		$temp_array = array();
7382 7382
         
7383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7384 7384
 		{
7385 7385
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7386 7386
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7403,8 +7403,8 @@  discard block
 block discarded – undo
7403 7403
 	*/
7404 7404
 	public function countAllRoutes($filters = array())
7405 7405
 	{
7406
-		$filter_query = $this->getFilter($filters,true,true);
7407
-		$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
7406
+		$filter_query = $this->getFilter($filters, true, true);
7407
+		$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
7408 7408
 		    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 <> ''
7409 7409
                     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
7410 7410
                     ORDER BY route_count DESC
@@ -7417,7 +7417,7 @@  discard block
 block discarded – undo
7417 7417
 		$routes_array = array();
7418 7418
 		$temp_array = array();
7419 7419
         
7420
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7420
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7421 7421
 		{
7422 7422
 			$temp_array['route_count'] = $row['route_count'];
7423 7423
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7444,11 +7444,11 @@  discard block
 block discarded – undo
7444 7444
 	* @return Array the route list
7445 7445
 	*
7446 7446
 	*/
7447
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7447
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7448 7448
 	{
7449
-		$filter_query = $this->getFilter($filters,true,true);
7450
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7451
-		$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
7449
+		$filter_query = $this->getFilter($filters, true, true);
7450
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7451
+		$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
7452 7452
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7453 7453
 			    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 
7454 7454
 			    ORDER BY route_count DESC";
@@ -7459,7 +7459,7 @@  discard block
 block discarded – undo
7459 7459
 		$routes_array = array();
7460 7460
 		$temp_array = array();
7461 7461
         
7462
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7462
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7463 7463
 		{
7464 7464
 			$temp_array['route_count'] = $row['route_count'];
7465 7465
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7486,9 +7486,9 @@  discard block
 block discarded – undo
7486 7486
 	*/
7487 7487
 	public function countAllRoutesByRegistration($registration, $filters = array())
7488 7488
 	{
7489
-		$filter_query = $this->getFilter($filters,true,true);
7489
+		$filter_query = $this->getFilter($filters, true, true);
7490 7490
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7491
-		$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
7491
+		$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
7492 7492
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7493 7493
                     GROUP BY route
7494 7494
                     ORDER BY route_count DESC";
@@ -7500,7 +7500,7 @@  discard block
 block discarded – undo
7500 7500
 		$routes_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['route_count'] = $row['route_count'];
7506 7506
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7528,9 +7528,9 @@  discard block
 block discarded – undo
7528 7528
 	*/
7529 7529
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7530 7530
 	{
7531
-		$filter_query = $this->getFilter($filters,true,true);
7532
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7533
-		$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
7531
+		$filter_query = $this->getFilter($filters, true, true);
7532
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7533
+		$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
7534 7534
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7535 7535
 			    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 
7536 7536
 			    ORDER BY route_count DESC";
@@ -7542,7 +7542,7 @@  discard block
 block discarded – undo
7542 7542
 		$routes_array = array();
7543 7543
 		$temp_array = array();
7544 7544
         
7545
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7545
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7546 7546
 		{
7547 7547
 			$temp_array['route_count'] = $row['route_count'];
7548 7548
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7570,9 +7570,9 @@  discard block
 block discarded – undo
7570 7570
 	*/
7571 7571
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7572 7572
 	{
7573
-		$filter_query = $this->getFilter($filters,true,true);
7574
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7575
-		$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
7573
+		$filter_query = $this->getFilter($filters, true, true);
7574
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7575
+		$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
7576 7576
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7577 7577
 			    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 
7578 7578
 			    ORDER BY route_count DESC";
@@ -7583,7 +7583,7 @@  discard block
 block discarded – undo
7583 7583
 		$routes_array = array();
7584 7584
 		$temp_array = array();
7585 7585
         
7586
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7586
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7587 7587
 		{
7588 7588
 			$temp_array['route_count'] = $row['route_count'];
7589 7589
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7611,9 +7611,9 @@  discard block
 block discarded – undo
7611 7611
 	*/
7612 7612
 	public function countAllRoutesByCountry($country, $filters = array())
7613 7613
 	{
7614
-		$filter_query = $this->getFilter($filters,true,true);
7615
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7616
-		$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
7614
+		$filter_query = $this->getFilter($filters, true, true);
7615
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7616
+		$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
7617 7617
 			    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 
7618 7618
 			    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 
7619 7619
 			    ORDER BY route_count DESC";
@@ -7624,7 +7624,7 @@  discard block
 block discarded – undo
7624 7624
 		$routes_array = array();
7625 7625
 		$temp_array = array();
7626 7626
         
7627
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7627
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7628 7628
 		{
7629 7629
 			$temp_array['route_count'] = $row['route_count'];
7630 7630
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7652,8 +7652,8 @@  discard block
 block discarded – undo
7652 7652
 	public function countAllRoutesByDate($date, $filters = array())
7653 7653
 	{
7654 7654
 		global $globalTimezone, $globalDBdriver;
7655
-		$filter_query = $this->getFilter($filters,true,true);
7656
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7655
+		$filter_query = $this->getFilter($filters, true, true);
7656
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7657 7657
 		if ($globalTimezone != '') {
7658 7658
 			date_default_timezone_set($globalTimezone);
7659 7659
 			$datetime = new DateTime($date);
@@ -7661,12 +7661,12 @@  discard block
 block discarded – undo
7661 7661
 		} else $offset = '+00:00';
7662 7662
 		
7663 7663
 		if ($globalDBdriver == 'mysql') {
7664
-			$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
7664
+			$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
7665 7665
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7666 7666
 				    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
7667 7667
 				    ORDER BY route_count DESC";
7668 7668
 		} else {
7669
-			$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
7669
+			$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
7670 7670
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7671 7671
 				    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
7672 7672
 				    ORDER BY route_count DESC";
@@ -7678,7 +7678,7 @@  discard block
 block discarded – undo
7678 7678
 		$routes_array = array();
7679 7679
 		$temp_array = array();
7680 7680
         
7681
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7681
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7682 7682
 		{
7683 7683
 			$temp_array['route_count'] = $row['route_count'];
7684 7684
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7705,9 +7705,9 @@  discard block
 block discarded – undo
7705 7705
 	*/
7706 7706
 	public function countAllRoutesByIdent($ident, $filters = array())
7707 7707
 	{
7708
-		$filter_query = $this->getFilter($filters,true,true);
7709
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7710
-		$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
7708
+		$filter_query = $this->getFilter($filters, true, true);
7709
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7710
+		$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
7711 7711
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7712 7712
                     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
7713 7713
                     ORDER BY route_count DESC";
@@ -7719,7 +7719,7 @@  discard block
 block discarded – undo
7719 7719
 		$routes_array = array();
7720 7720
 		$temp_array = array();
7721 7721
         
7722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7723 7723
 		{
7724 7724
 			$temp_array['route_count'] = $row['route_count'];
7725 7725
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7746,9 +7746,9 @@  discard block
 block discarded – undo
7746 7746
 	*/
7747 7747
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7748 7748
 	{
7749
-		$filter_query = $this->getFilter($filters,true,true);
7750
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7751
-		$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
7749
+		$filter_query = $this->getFilter($filters, true, true);
7750
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7751
+		$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
7752 7752
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7753 7753
                     GROUP BY route
7754 7754
                     ORDER BY route_count DESC";
@@ -7760,7 +7760,7 @@  discard block
 block discarded – undo
7760 7760
 		$routes_array = array();
7761 7761
 		$temp_array = array();
7762 7762
         
7763
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7763
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7764 7764
 		{
7765 7765
 			$temp_array['route_count'] = $row['route_count'];
7766 7766
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7788,8 +7788,8 @@  discard block
 block discarded – undo
7788 7788
 	*/
7789 7789
 	public function countAllRoutesWithWaypoints($filters = array())
7790 7790
 	{
7791
-		$filter_query = $this->getFilter($filters,true,true);
7792
-		$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
7791
+		$filter_query = $this->getFilter($filters, true, true);
7792
+		$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
7793 7793
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7794 7794
                     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
7795 7795
                     ORDER BY route_count DESC
@@ -7802,7 +7802,7 @@  discard block
 block discarded – undo
7802 7802
 		$routes_array = array();
7803 7803
 		$temp_array = array();
7804 7804
         
7805
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7805
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7806 7806
 		{
7807 7807
 			$temp_array['spotter_id'] = $row['spotter_id'];
7808 7808
 			$temp_array['route_count'] = $row['route_count'];
@@ -7827,11 +7827,11 @@  discard block
 block discarded – undo
7827 7827
 	* @return Array the callsign list
7828 7828
 	*
7829 7829
 	*/
7830
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7830
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7831 7831
 	{
7832 7832
 		global $globalDBdriver;
7833
-		$filter_query = $this->getFilter($filters,true,true);
7834
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7833
+		$filter_query = $this->getFilter($filters, true, true);
7834
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7835 7835
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7836 7836
 		 if ($olderthanmonths > 0) {
7837 7837
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7850,7 +7850,7 @@  discard block
 block discarded – undo
7850 7850
 		$callsign_array = array();
7851 7851
 		$temp_array = array();
7852 7852
         
7853
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7853
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7854 7854
 		{
7855 7855
 			$temp_array['callsign_icao'] = $row['ident'];
7856 7856
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7872,8 +7872,8 @@  discard block
 block discarded – undo
7872 7872
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7873 7873
 	{
7874 7874
 		global $globalDBdriver;
7875
-		$filter_query = $this->getFilter($filters,true,true);
7876
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7875
+		$filter_query = $this->getFilter($filters, true, true);
7876
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7877 7877
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7878 7878
 		 if ($olderthanmonths > 0) {
7879 7879
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7892,7 +7892,7 @@  discard block
 block discarded – undo
7892 7892
 		$callsign_array = array();
7893 7893
 		$temp_array = array();
7894 7894
         
7895
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7895
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7896 7896
 		{
7897 7897
 			$temp_array['callsign_icao'] = $row['ident'];
7898 7898
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7946,7 +7946,7 @@  discard block
 block discarded – undo
7946 7946
 		$date_array = array();
7947 7947
 		$temp_array = array();
7948 7948
         
7949
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7949
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7950 7950
 		{
7951 7951
 			$temp_array['date_name'] = $row['date_name'];
7952 7952
 			$temp_array['date_count'] = $row['date_count'];
@@ -7971,15 +7971,15 @@  discard block
 block discarded – undo
7971 7971
 			$datetime = new DateTime();
7972 7972
 			$offset = $datetime->format('P');
7973 7973
 		} else $offset = '+00:00';
7974
-		$filter_query = $this->getFilter($filters,true,true);
7974
+		$filter_query = $this->getFilter($filters, true, true);
7975 7975
 		if ($globalDBdriver == 'mysql') {
7976
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7976
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7977 7977
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7978 7978
 								GROUP BY spotter_output.airline_icao, date_name 
7979 7979
 								ORDER BY date_count DESC
7980 7980
 								LIMIT 10 OFFSET 0";
7981 7981
 		} else {
7982
-			$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
7982
+			$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
7983 7983
 								FROM spotter_output 
7984 7984
 								WHERE spotter_output.airline_icao <> '' 
7985 7985
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7994,7 +7994,7 @@  discard block
 block discarded – undo
7994 7994
 		$date_array = array();
7995 7995
 		$temp_array = array();
7996 7996
         
7997
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7997
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7998 7998
 		{
7999 7999
 			$temp_array['date_name'] = $row['date_name'];
8000 8000
 			$temp_array['date_count'] = $row['date_count'];
@@ -8020,7 +8020,7 @@  discard block
 block discarded – undo
8020 8020
 			$datetime = new DateTime();
8021 8021
 			$offset = $datetime->format('P');
8022 8022
 		} else $offset = '+00:00';
8023
-		$filter_query = $this->getFilter($filters,true,true);
8023
+		$filter_query = $this->getFilter($filters, true, true);
8024 8024
 		if ($globalDBdriver == 'mysql') {
8025 8025
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8026 8026
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -8041,7 +8041,7 @@  discard block
 block discarded – undo
8041 8041
 		$date_array = array();
8042 8042
 		$temp_array = array();
8043 8043
         
8044
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8044
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8045 8045
 		{
8046 8046
 			$temp_array['date_name'] = $row['date_name'];
8047 8047
 			$temp_array['date_count'] = $row['date_count'];
@@ -8066,7 +8066,7 @@  discard block
 block discarded – undo
8066 8066
 			$datetime = new DateTime();
8067 8067
 			$offset = $datetime->format('P');
8068 8068
 		} else $offset = '+00:00';
8069
-		$filter_query = $this->getFilter($filters,true,true);
8069
+		$filter_query = $this->getFilter($filters, true, true);
8070 8070
 		if ($globalDBdriver == 'mysql') {
8071 8071
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8072 8072
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -8087,7 +8087,7 @@  discard block
 block discarded – undo
8087 8087
 		$date_array = array();
8088 8088
 		$temp_array = array();
8089 8089
         
8090
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8090
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8091 8091
 		{
8092 8092
 			$temp_array['date_name'] = $row['date_name'];
8093 8093
 			$temp_array['date_count'] = $row['date_count'];
@@ -8108,7 +8108,7 @@  discard block
 block discarded – undo
8108 8108
 	public function countAllDatesLastMonthByAirlines($filters = array())
8109 8109
 	{
8110 8110
 		global $globalTimezone, $globalDBdriver;
8111
-		$filter_query = $this->getFilter($filters,true,true);
8111
+		$filter_query = $this->getFilter($filters, true, true);
8112 8112
 		if ($globalTimezone != '') {
8113 8113
 			date_default_timezone_set($globalTimezone);
8114 8114
 			$datetime = new DateTime();
@@ -8116,13 +8116,13 @@  discard block
 block discarded – undo
8116 8116
 		} else $offset = '+00:00';
8117 8117
 		
8118 8118
 		if ($globalDBdriver == 'mysql') {
8119
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8119
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8120 8120
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
8121 8121
 								GROUP BY spotter_output.airline_icao, date_name 
8122 8122
 								ORDER BY spotter_output.date ASC";
8123 8123
 			$query_data = array(':offset' => $offset);
8124 8124
 		} else {
8125
-			$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
8125
+			$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
8126 8126
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
8127 8127
 								GROUP BY spotter_output.airline_icao, date_name 
8128 8128
 								ORDER BY date_name ASC";
@@ -8135,7 +8135,7 @@  discard block
 block discarded – undo
8135 8135
 		$date_array = array();
8136 8136
 		$temp_array = array();
8137 8137
         
8138
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8138
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8139 8139
 		{
8140 8140
 			$temp_array['date_name'] = $row['date_name'];
8141 8141
 			$temp_array['date_count'] = $row['date_count'];
@@ -8182,7 +8182,7 @@  discard block
 block discarded – undo
8182 8182
 		$date_array = array();
8183 8183
 		$temp_array = array();
8184 8184
         
8185
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8185
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8186 8186
 		{
8187 8187
 			$temp_array['month_name'] = $row['month_name'];
8188 8188
 			$temp_array['year_name'] = $row['year_name'];
@@ -8203,7 +8203,7 @@  discard block
 block discarded – undo
8203 8203
 	public function countAllMonthsByAirlines($filters = array())
8204 8204
 	{
8205 8205
 		global $globalTimezone, $globalDBdriver;
8206
-		$filter_query = $this->getFilter($filters,true,true);
8206
+		$filter_query = $this->getFilter($filters, true, true);
8207 8207
 		if ($globalTimezone != '') {
8208 8208
 			date_default_timezone_set($globalTimezone);
8209 8209
 			$datetime = new DateTime();
@@ -8211,12 +8211,12 @@  discard block
 block discarded – undo
8211 8211
 		} else $offset = '+00:00';
8212 8212
 
8213 8213
 		if ($globalDBdriver == 'mysql') {
8214
-			$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
8214
+			$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
8215 8215
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8216 8216
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8217 8217
 								ORDER BY date_count DESC";
8218 8218
 		} else {
8219
-			$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
8219
+			$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
8220 8220
 								FROM spotter_output 
8221 8221
 								WHERE spotter_output.airline_icao <> '' 
8222 8222
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8230,7 +8230,7 @@  discard block
 block discarded – undo
8230 8230
 		$date_array = array();
8231 8231
 		$temp_array = array();
8232 8232
         
8233
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8233
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8234 8234
 		{
8235 8235
 			$temp_array['month_name'] = $row['month_name'];
8236 8236
 			$temp_array['year_name'] = $row['year_name'];
@@ -8257,14 +8257,14 @@  discard block
 block discarded – undo
8257 8257
 			$datetime = new DateTime();
8258 8258
 			$offset = $datetime->format('P');
8259 8259
 		} else $offset = '+00:00';
8260
-		$filter_query = $this->getFilter($filters,true,true);
8260
+		$filter_query = $this->getFilter($filters, true, true);
8261 8261
 		if ($globalDBdriver == 'mysql') {
8262
-			$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
8262
+			$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
8263 8263
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8264 8264
 								GROUP BY year_name, month_name 
8265 8265
 								ORDER BY date_count DESC";
8266 8266
 		} else {
8267
-			$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
8267
+			$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
8268 8268
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8269 8269
 								GROUP BY year_name, month_name 
8270 8270
 								ORDER BY date_count DESC";
@@ -8276,7 +8276,7 @@  discard block
 block discarded – undo
8276 8276
 		$date_array = array();
8277 8277
 		$temp_array = array();
8278 8278
         
8279
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8279
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8280 8280
 		{
8281 8281
 			$temp_array['month_name'] = $row['month_name'];
8282 8282
 			$temp_array['year_name'] = $row['year_name'];
@@ -8302,15 +8302,15 @@  discard block
 block discarded – undo
8302 8302
 			$datetime = new DateTime();
8303 8303
 			$offset = $datetime->format('P');
8304 8304
 		} else $offset = '+00:00';
8305
-		$filter_query = $this->getFilter($filters,true,true);
8305
+		$filter_query = $this->getFilter($filters, true, true);
8306 8306
 
8307 8307
 		if ($globalDBdriver == 'mysql') {
8308
-			$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
8308
+			$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
8309 8309
 								FROM spotter_output".$filter_query." owner_name <> ''
8310 8310
 								GROUP BY year_name, month_name
8311 8311
 								ORDER BY date_count DESC";
8312 8312
 		} else {
8313
-			$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
8313
+			$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
8314 8314
 								FROM spotter_output".$filter_query." owner_name <> ''
8315 8315
 								GROUP BY year_name, month_name
8316 8316
 								ORDER BY date_count DESC";
@@ -8322,7 +8322,7 @@  discard block
 block discarded – undo
8322 8322
 		$date_array = array();
8323 8323
 		$temp_array = array();
8324 8324
         
8325
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8325
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8326 8326
 		{
8327 8327
 			$temp_array['month_name'] = $row['month_name'];
8328 8328
 			$temp_array['year_name'] = $row['year_name'];
@@ -8343,7 +8343,7 @@  discard block
 block discarded – undo
8343 8343
 	public function countAllMonthsOwnersByAirlines($filters = array())
8344 8344
 	{
8345 8345
 		global $globalTimezone, $globalDBdriver;
8346
-		$filter_query = $this->getFilter($filters,true,true);
8346
+		$filter_query = $this->getFilter($filters, true, true);
8347 8347
 		if ($globalTimezone != '') {
8348 8348
 			date_default_timezone_set($globalTimezone);
8349 8349
 			$datetime = new DateTime();
@@ -8351,12 +8351,12 @@  discard block
 block discarded – undo
8351 8351
 		} else $offset = '+00:00';
8352 8352
 
8353 8353
 		if ($globalDBdriver == 'mysql') {
8354
-			$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
8354
+			$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
8355 8355
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8356 8356
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8357 8357
 								ORDER BY date_count DESC";
8358 8358
 		} else {
8359
-			$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
8359
+			$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
8360 8360
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8361 8361
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8362 8362
 								ORDER BY date_count DESC";
@@ -8368,7 +8368,7 @@  discard block
 block discarded – undo
8368 8368
 		$date_array = array();
8369 8369
 		$temp_array = array();
8370 8370
         
8371
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8371
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8372 8372
 		{
8373 8373
 			$temp_array['month_name'] = $row['month_name'];
8374 8374
 			$temp_array['year_name'] = $row['year_name'];
@@ -8395,15 +8395,15 @@  discard block
 block discarded – undo
8395 8395
 			$datetime = new DateTime();
8396 8396
 			$offset = $datetime->format('P');
8397 8397
 		} else $offset = '+00:00';
8398
-		$filter_query = $this->getFilter($filters,true,true);
8398
+		$filter_query = $this->getFilter($filters, true, true);
8399 8399
 
8400 8400
 		if ($globalDBdriver == 'mysql') {
8401
-			$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
8401
+			$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
8402 8402
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8403 8403
 								GROUP BY year_name, month_name
8404 8404
 								ORDER BY date_count DESC";
8405 8405
 		} else {
8406
-			$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
8406
+			$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
8407 8407
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8408 8408
 								GROUP BY year_name, month_name
8409 8409
 								ORDER BY date_count DESC";
@@ -8415,7 +8415,7 @@  discard block
 block discarded – undo
8415 8415
 		$date_array = array();
8416 8416
 		$temp_array = array();
8417 8417
         
8418
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8418
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8419 8419
 		{
8420 8420
 			$temp_array['month_name'] = $row['month_name'];
8421 8421
 			$temp_array['year_name'] = $row['year_name'];
@@ -8436,7 +8436,7 @@  discard block
 block discarded – undo
8436 8436
 	public function countAllMonthsPilotsByAirlines($filters = array())
8437 8437
 	{
8438 8438
 		global $globalTimezone, $globalDBdriver;
8439
-		$filter_query = $this->getFilter($filters,true,true);
8439
+		$filter_query = $this->getFilter($filters, true, true);
8440 8440
 		if ($globalTimezone != '') {
8441 8441
 			date_default_timezone_set($globalTimezone);
8442 8442
 			$datetime = new DateTime();
@@ -8444,12 +8444,12 @@  discard block
 block discarded – undo
8444 8444
 		} else $offset = '+00:00';
8445 8445
 
8446 8446
 		if ($globalDBdriver == 'mysql') {
8447
-			$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
8447
+			$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
8448 8448
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8449 8449
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8450 8450
 								ORDER BY date_count DESC";
8451 8451
 		} else {
8452
-			$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
8452
+			$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
8453 8453
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8454 8454
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8455 8455
 								ORDER BY date_count DESC";
@@ -8461,7 +8461,7 @@  discard block
 block discarded – undo
8461 8461
 		$date_array = array();
8462 8462
 		$temp_array = array();
8463 8463
         
8464
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8464
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8465 8465
 		{
8466 8466
 			$temp_array['month_name'] = $row['month_name'];
8467 8467
 			$temp_array['year_name'] = $row['year_name'];
@@ -8483,7 +8483,7 @@  discard block
 block discarded – undo
8483 8483
 	public function countAllMonthsAirlines($filters = array())
8484 8484
 	{
8485 8485
 		global $globalTimezone, $globalDBdriver;
8486
-		$filter_query = $this->getFilter($filters,true,true);
8486
+		$filter_query = $this->getFilter($filters, true, true);
8487 8487
 		if ($globalTimezone != '') {
8488 8488
 			date_default_timezone_set($globalTimezone);
8489 8489
 			$datetime = new DateTime();
@@ -8491,12 +8491,12 @@  discard block
 block discarded – undo
8491 8491
 		} else $offset = '+00:00';
8492 8492
 
8493 8493
 		if ($globalDBdriver == 'mysql') {
8494
-			$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
8494
+			$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
8495 8495
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8496 8496
 								GROUP BY year_name, month_name
8497 8497
 								ORDER BY date_count DESC";
8498 8498
 		} else {
8499
-			$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
8499
+			$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
8500 8500
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8501 8501
 								GROUP BY year_name, month_name
8502 8502
 								ORDER BY date_count DESC";
@@ -8508,7 +8508,7 @@  discard block
 block discarded – undo
8508 8508
 		$date_array = array();
8509 8509
 		$temp_array = array();
8510 8510
         
8511
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8511
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8512 8512
 		{
8513 8513
 			$temp_array['month_name'] = $row['month_name'];
8514 8514
 			$temp_array['year_name'] = $row['year_name'];
@@ -8534,15 +8534,15 @@  discard block
 block discarded – undo
8534 8534
 			$datetime = new DateTime();
8535 8535
 			$offset = $datetime->format('P');
8536 8536
 		} else $offset = '+00:00';
8537
-		$filter_query = $this->getFilter($filters,true,true);
8537
+		$filter_query = $this->getFilter($filters, true, true);
8538 8538
 
8539 8539
 		if ($globalDBdriver == 'mysql') {
8540
-			$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
8540
+			$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
8541 8541
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8542 8542
 								GROUP BY year_name, month_name
8543 8543
 								ORDER BY date_count DESC";
8544 8544
 		} else {
8545
-			$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
8545
+			$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
8546 8546
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8547 8547
 								GROUP BY year_name, month_name
8548 8548
 								ORDER BY date_count DESC";
@@ -8554,7 +8554,7 @@  discard block
 block discarded – undo
8554 8554
 		$date_array = array();
8555 8555
 		$temp_array = array();
8556 8556
         
8557
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8557
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8558 8558
 		{
8559 8559
 			$temp_array['month_name'] = $row['month_name'];
8560 8560
 			$temp_array['year_name'] = $row['year_name'];
@@ -8576,7 +8576,7 @@  discard block
 block discarded – undo
8576 8576
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8577 8577
 	{
8578 8578
 		global $globalTimezone, $globalDBdriver;
8579
-		$filter_query = $this->getFilter($filters,true,true);
8579
+		$filter_query = $this->getFilter($filters, true, true);
8580 8580
 		if ($globalTimezone != '') {
8581 8581
 			date_default_timezone_set($globalTimezone);
8582 8582
 			$datetime = new DateTime();
@@ -8584,12 +8584,12 @@  discard block
 block discarded – undo
8584 8584
 		} else $offset = '+00:00';
8585 8585
 
8586 8586
 		if ($globalDBdriver == 'mysql') {
8587
-			$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
8587
+			$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
8588 8588
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8589 8589
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8590 8590
 								ORDER BY date_count DESC";
8591 8591
 		} else {
8592
-			$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
8592
+			$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
8593 8593
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8594 8594
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8595 8595
 								ORDER BY date_count DESC";
@@ -8601,7 +8601,7 @@  discard block
 block discarded – undo
8601 8601
 		$date_array = array();
8602 8602
 		$temp_array = array();
8603 8603
         
8604
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8604
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8605 8605
 		{
8606 8606
 			$temp_array['month_name'] = $row['month_name'];
8607 8607
 			$temp_array['year_name'] = $row['year_name'];
@@ -8628,15 +8628,15 @@  discard block
 block discarded – undo
8628 8628
 			$datetime = new DateTime();
8629 8629
 			$offset = $datetime->format('P');
8630 8630
 		} else $offset = '+00:00';
8631
-		$filter_query = $this->getFilter($filters,true,true);
8631
+		$filter_query = $this->getFilter($filters, true, true);
8632 8632
 
8633 8633
 		if ($globalDBdriver == 'mysql') {
8634
-			$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
8634
+			$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
8635 8635
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8636 8636
 								GROUP BY year_name, month_name
8637 8637
 								ORDER BY date_count DESC";
8638 8638
 		} else {
8639
-			$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
8639
+			$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
8640 8640
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8641 8641
 								GROUP BY year_name, month_name
8642 8642
 								ORDER BY date_count DESC";
@@ -8648,7 +8648,7 @@  discard block
 block discarded – undo
8648 8648
 		$date_array = array();
8649 8649
 		$temp_array = array();
8650 8650
         
8651
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8651
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8652 8652
 		{
8653 8653
 			$temp_array['month_name'] = $row['month_name'];
8654 8654
 			$temp_array['year_name'] = $row['year_name'];
@@ -8670,7 +8670,7 @@  discard block
 block discarded – undo
8670 8670
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8671 8671
 	{
8672 8672
 		global $globalTimezone, $globalDBdriver;
8673
-		$filter_query = $this->getFilter($filters,true,true);
8673
+		$filter_query = $this->getFilter($filters, true, true);
8674 8674
 		if ($globalTimezone != '') {
8675 8675
 			date_default_timezone_set($globalTimezone);
8676 8676
 			$datetime = new DateTime();
@@ -8678,12 +8678,12 @@  discard block
 block discarded – undo
8678 8678
 		} else $offset = '+00:00';
8679 8679
 
8680 8680
 		if ($globalDBdriver == 'mysql') {
8681
-			$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
8681
+			$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
8682 8682
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8683 8683
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8684 8684
 								ORDER BY date_count DESC";
8685 8685
 		} else {
8686
-			$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
8686
+			$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
8687 8687
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8688 8688
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8689 8689
 								ORDER BY date_count DESC";
@@ -8695,7 +8695,7 @@  discard block
 block discarded – undo
8695 8695
 		$date_array = array();
8696 8696
 		$temp_array = array();
8697 8697
         
8698
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8698
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8699 8699
 		{
8700 8700
 			$temp_array['month_name'] = $row['month_name'];
8701 8701
 			$temp_array['year_name'] = $row['year_name'];
@@ -8723,7 +8723,7 @@  discard block
 block discarded – undo
8723 8723
 			$datetime = new DateTime();
8724 8724
 			$offset = $datetime->format('P');
8725 8725
 		} else $offset = '+00:00';
8726
-		$filter_query = $this->getFilter($filters,true,true);
8726
+		$filter_query = $this->getFilter($filters, true, true);
8727 8727
 		if ($globalDBdriver == 'mysql') {
8728 8728
 			$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
8729 8729
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8744,7 +8744,7 @@  discard block
 block discarded – undo
8744 8744
 		$date_array = array();
8745 8745
 		$temp_array = array();
8746 8746
         
8747
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8747
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8748 8748
 		{
8749 8749
 			$temp_array['year_name'] = $row['year_name'];
8750 8750
 			$temp_array['month_name'] = $row['month_name'];
@@ -8764,7 +8764,7 @@  discard block
 block discarded – undo
8764 8764
 	* @return Array the hour list
8765 8765
 	*
8766 8766
 	*/
8767
-	public function countAllHours($orderby,$filters = array())
8767
+	public function countAllHours($orderby, $filters = array())
8768 8768
 	{
8769 8769
 		global $globalTimezone, $globalDBdriver;
8770 8770
 		if ($globalTimezone != '') {
@@ -8812,7 +8812,7 @@  discard block
 block discarded – undo
8812 8812
 		$hour_array = array();
8813 8813
 		$temp_array = array();
8814 8814
         
8815
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8815
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8816 8816
 		{
8817 8817
 			$temp_array['hour_name'] = $row['hour_name'];
8818 8818
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8832,7 +8832,7 @@  discard block
 block discarded – undo
8832 8832
 	public function countAllHoursByAirlines($orderby, $filters = array())
8833 8833
 	{
8834 8834
 		global $globalTimezone, $globalDBdriver;
8835
-		$filter_query = $this->getFilter($filters,true,true);
8835
+		$filter_query = $this->getFilter($filters, true, true);
8836 8836
 		if ($globalTimezone != '') {
8837 8837
 			date_default_timezone_set($globalTimezone);
8838 8838
 			$datetime = new DateTime();
@@ -8850,7 +8850,7 @@  discard block
 block discarded – undo
8850 8850
 		}
8851 8851
 		
8852 8852
 		if ($globalDBdriver == 'mysql') {
8853
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8853
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8854 8854
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8855 8855
 								GROUP BY spotter_output.airline_icao, hour_name 
8856 8856
 								".$orderby_sql;
@@ -8863,7 +8863,7 @@  discard block
 block discarded – undo
8863 8863
   */    
8864 8864
 		$query_data = array(':offset' => $offset);
8865 8865
 		} else {
8866
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8866
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8867 8867
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8868 8868
 								GROUP BY spotter_output.airline_icao, hour_name 
8869 8869
 								".$orderby_sql;
@@ -8876,7 +8876,7 @@  discard block
 block discarded – undo
8876 8876
 		$hour_array = array();
8877 8877
 		$temp_array = array();
8878 8878
         
8879
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8879
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8880 8880
 		{
8881 8881
 			$temp_array['hour_name'] = $row['hour_name'];
8882 8882
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8899,34 +8899,34 @@  discard block
 block discarded – undo
8899 8899
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8900 8900
 	{
8901 8901
 		global $globalTimezone, $globalDBdriver;
8902
-		$filter_query = $this->getFilter($filters,true,true);
8902
+		$filter_query = $this->getFilter($filters, true, true);
8903 8903
 		if ($globalTimezone != '') {
8904 8904
 			date_default_timezone_set($globalTimezone);
8905 8905
 			$datetime = new DateTime();
8906 8906
 			$offset = $datetime->format('P');
8907 8907
 		} else $offset = '+00:00';
8908 8908
 
8909
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8909
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8910 8910
 
8911 8911
 		if ($globalDBdriver == 'mysql') {
8912
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8912
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8913 8913
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8914 8914
 								GROUP BY hour_name 
8915 8915
 								ORDER BY hour_name ASC";
8916 8916
 		} else {
8917
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8917
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8918 8918
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8919 8919
 								GROUP BY hour_name 
8920 8920
 								ORDER BY hour_name ASC";
8921 8921
 		}
8922 8922
 		
8923 8923
 		$sth = $this->db->prepare($query);
8924
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8924
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8925 8925
       
8926 8926
 		$hour_array = array();
8927 8927
 		$temp_array = array();
8928 8928
         
8929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8930 8930
 		{
8931 8931
 			$temp_array['hour_name'] = $row['hour_name'];
8932 8932
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8949,8 +8949,8 @@  discard block
 block discarded – undo
8949 8949
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8950 8950
 	{
8951 8951
 		global $globalTimezone, $globalDBdriver;
8952
-		$filter_query = $this->getFilter($filters,true,true);
8953
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8952
+		$filter_query = $this->getFilter($filters, true, true);
8953
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8954 8954
 		if ($globalTimezone != '') {
8955 8955
 			date_default_timezone_set($globalTimezone);
8956 8956
 			$datetime = new DateTime();
@@ -8958,24 +8958,24 @@  discard block
 block discarded – undo
8958 8958
 		} else $offset = '+00:00';
8959 8959
 
8960 8960
 		if ($globalDBdriver == 'mysql') {
8961
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8961
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8962 8962
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8963 8963
 								GROUP BY hour_name 
8964 8964
 								ORDER BY hour_name ASC";
8965 8965
 		} else {
8966
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8966
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8967 8967
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8968 8968
 								GROUP BY hour_name 
8969 8969
 								ORDER BY hour_name ASC";
8970 8970
 		}
8971 8971
 		
8972 8972
 		$sth = $this->db->prepare($query);
8973
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8973
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8974 8974
       
8975 8975
 		$hour_array = array();
8976 8976
 		$temp_array = array();
8977 8977
         
8978
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8978
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8979 8979
 		{
8980 8980
 			$temp_array['hour_name'] = $row['hour_name'];
8981 8981
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8996,8 +8996,8 @@  discard block
 block discarded – undo
8996 8996
 	public function countAllHoursByRegistration($registration, $filters = array())
8997 8997
 	{
8998 8998
 		global $globalTimezone, $globalDBdriver;
8999
-		$filter_query = $this->getFilter($filters,true,true);
9000
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8999
+		$filter_query = $this->getFilter($filters, true, true);
9000
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9001 9001
 		if ($globalTimezone != '') {
9002 9002
 			date_default_timezone_set($globalTimezone);
9003 9003
 			$datetime = new DateTime();
@@ -9005,24 +9005,24 @@  discard block
 block discarded – undo
9005 9005
 		} else $offset = '+00:00';
9006 9006
 
9007 9007
 		if ($globalDBdriver == 'mysql') {
9008
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9008
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9009 9009
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
9010 9010
 								GROUP BY hour_name 
9011 9011
 								ORDER BY hour_name ASC";
9012 9012
 		} else {
9013
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9013
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9014 9014
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
9015 9015
 								GROUP BY hour_name 
9016 9016
 								ORDER BY hour_name ASC";
9017 9017
 		}
9018 9018
 		
9019 9019
 		$sth = $this->db->prepare($query);
9020
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
9020
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
9021 9021
       
9022 9022
 		$hour_array = array();
9023 9023
 		$temp_array = array();
9024 9024
         
9025
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9025
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9026 9026
 		{
9027 9027
 			$temp_array['hour_name'] = $row['hour_name'];
9028 9028
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9043,8 +9043,8 @@  discard block
 block discarded – undo
9043 9043
 	public function countAllHoursByAirport($airport_icao, $filters = array())
9044 9044
 	{
9045 9045
 		global $globalTimezone, $globalDBdriver;
9046
-		$filter_query = $this->getFilter($filters,true,true);
9047
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
9046
+		$filter_query = $this->getFilter($filters, true, true);
9047
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
9048 9048
 		if ($globalTimezone != '') {
9049 9049
 			date_default_timezone_set($globalTimezone);
9050 9050
 			$datetime = new DateTime();
@@ -9052,24 +9052,24 @@  discard block
 block discarded – undo
9052 9052
 		} else $offset = '+00:00';
9053 9053
 
9054 9054
 		if ($globalDBdriver == 'mysql') {
9055
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9055
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9056 9056
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
9057 9057
 								GROUP BY hour_name 
9058 9058
 								ORDER BY hour_name ASC";
9059 9059
 		} else {
9060
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9060
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9061 9061
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
9062 9062
 								GROUP BY hour_name 
9063 9063
 								ORDER BY hour_name ASC";
9064 9064
 		}
9065 9065
 		
9066 9066
 		$sth = $this->db->prepare($query);
9067
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
9067
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
9068 9068
       
9069 9069
 		$hour_array = array();
9070 9070
 		$temp_array = array();
9071 9071
         
9072
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9072
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9073 9073
 		{
9074 9074
 			$temp_array['hour_name'] = $row['hour_name'];
9075 9075
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9088,11 +9088,11 @@  discard block
 block discarded – undo
9088 9088
 	* @return Array the hour list
9089 9089
 	*
9090 9090
 	*/
9091
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9091
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
9092 9092
 	{
9093 9093
 		global $globalTimezone, $globalDBdriver;
9094
-		$filter_query = $this->getFilter($filters,true,true);
9095
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9094
+		$filter_query = $this->getFilter($filters, true, true);
9095
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9096 9096
 		if ($globalTimezone != '') {
9097 9097
 			date_default_timezone_set($globalTimezone);
9098 9098
 			$datetime = new DateTime();
@@ -9100,24 +9100,24 @@  discard block
 block discarded – undo
9100 9100
 		} else $offset = '+00:00';
9101 9101
 
9102 9102
 		if ($globalDBdriver == 'mysql') {
9103
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9103
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9104 9104
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9105 9105
 								GROUP BY hour_name 
9106 9106
 								ORDER BY hour_name ASC";
9107 9107
 		} else {
9108
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9108
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9109 9109
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9110 9110
 								GROUP BY hour_name 
9111 9111
 								ORDER BY hour_name ASC";
9112 9112
 		}
9113 9113
 		
9114 9114
 		$sth = $this->db->prepare($query);
9115
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
9115
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
9116 9116
       
9117 9117
 		$hour_array = array();
9118 9118
 		$temp_array = array();
9119 9119
         
9120
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9120
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9121 9121
 		{
9122 9122
 			$temp_array['hour_name'] = $row['hour_name'];
9123 9123
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9139,8 +9139,8 @@  discard block
 block discarded – undo
9139 9139
 	public function countAllHoursByDate($date, $filters = array())
9140 9140
 	{
9141 9141
 		global $globalTimezone, $globalDBdriver;
9142
-		$filter_query = $this->getFilter($filters,true,true);
9143
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9142
+		$filter_query = $this->getFilter($filters, true, true);
9143
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9144 9144
 		if ($globalTimezone != '') {
9145 9145
 			date_default_timezone_set($globalTimezone);
9146 9146
 			$datetime = new DateTime($date);
@@ -9148,12 +9148,12 @@  discard block
 block discarded – undo
9148 9148
 		} else $offset = '+00:00';
9149 9149
 
9150 9150
 		if ($globalDBdriver == 'mysql') {
9151
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9151
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9152 9152
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9153 9153
 								GROUP BY hour_name 
9154 9154
 								ORDER BY hour_name ASC";
9155 9155
 		} else {
9156
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9156
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9157 9157
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9158 9158
 								GROUP BY hour_name 
9159 9159
 								ORDER BY hour_name ASC";
@@ -9165,7 +9165,7 @@  discard block
 block discarded – undo
9165 9165
 		$hour_array = array();
9166 9166
 		$temp_array = array();
9167 9167
         
9168
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9168
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9169 9169
 		{
9170 9170
 			$temp_array['hour_name'] = $row['hour_name'];
9171 9171
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9187,8 +9187,8 @@  discard block
 block discarded – undo
9187 9187
 	public function countAllHoursByIdent($ident, $filters = array())
9188 9188
 	{
9189 9189
 		global $globalTimezone, $globalDBdriver;
9190
-		$filter_query = $this->getFilter($filters,true,true);
9191
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9190
+		$filter_query = $this->getFilter($filters, true, true);
9191
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9192 9192
 		if ($globalTimezone != '') {
9193 9193
 			date_default_timezone_set($globalTimezone);
9194 9194
 			$datetime = new DateTime();
@@ -9196,12 +9196,12 @@  discard block
 block discarded – undo
9196 9196
 		} else $offset = '+00:00';
9197 9197
 
9198 9198
 		if ($globalDBdriver == 'mysql') {
9199
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9199
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9200 9200
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9201 9201
 								GROUP BY hour_name 
9202 9202
 								ORDER BY hour_name ASC";
9203 9203
 		} else {
9204
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9204
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9205 9205
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9206 9206
 								GROUP BY hour_name 
9207 9207
 								ORDER BY hour_name ASC";
@@ -9209,12 +9209,12 @@  discard block
 block discarded – undo
9209 9209
       
9210 9210
 		
9211 9211
 		$sth = $this->db->prepare($query);
9212
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9212
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9213 9213
       
9214 9214
 		$hour_array = array();
9215 9215
 		$temp_array = array();
9216 9216
         
9217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9218 9218
 		{
9219 9219
 			$temp_array['hour_name'] = $row['hour_name'];
9220 9220
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9233,12 +9233,12 @@  discard block
 block discarded – undo
9233 9233
 	* @return Array the hour list
9234 9234
 	*
9235 9235
 	*/
9236
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9236
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9237 9237
 	{
9238 9238
 		global $globalTimezone, $globalDBdriver;
9239
-		$filter_query = $this->getFilter($filters,true,true);
9240
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9241
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9239
+		$filter_query = $this->getFilter($filters, true, true);
9240
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9241
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9242 9242
 		if ($globalTimezone != '') {
9243 9243
 			date_default_timezone_set($globalTimezone);
9244 9244
 			$datetime = new DateTime();
@@ -9246,24 +9246,24 @@  discard block
 block discarded – undo
9246 9246
 		} else $offset = '+00:00';
9247 9247
 
9248 9248
 		if ($globalDBdriver == 'mysql') {
9249
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9249
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9250 9250
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9251 9251
 								GROUP BY hour_name 
9252 9252
 								ORDER BY hour_name ASC";
9253 9253
 		} else {
9254
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9254
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9255 9255
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9256 9256
 								GROUP BY hour_name 
9257 9257
 								ORDER BY hour_name ASC";
9258 9258
 		}
9259 9259
 		
9260 9260
 		$sth = $this->db->prepare($query);
9261
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9261
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9262 9262
       
9263 9263
 		$hour_array = array();
9264 9264
 		$temp_array = array();
9265 9265
         
9266
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9266
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9267 9267
 		{
9268 9268
 			$temp_array['hour_name'] = $row['hour_name'];
9269 9269
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9284,8 +9284,8 @@  discard block
 block discarded – undo
9284 9284
 	public function countAllHoursByCountry($country, $filters = array())
9285 9285
 	{
9286 9286
 		global $globalTimezone, $globalDBdriver;
9287
-		$filter_query = $this->getFilter($filters,true,true);
9288
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9287
+		$filter_query = $this->getFilter($filters, true, true);
9288
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9289 9289
 		if ($globalTimezone != '') {
9290 9290
 			date_default_timezone_set($globalTimezone);
9291 9291
 			$datetime = new DateTime();
@@ -9293,24 +9293,24 @@  discard block
 block discarded – undo
9293 9293
 		} else $offset = '+00:00';
9294 9294
 
9295 9295
 		if ($globalDBdriver == 'mysql') {
9296
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9296
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9297 9297
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9298 9298
 								GROUP BY hour_name 
9299 9299
 								ORDER BY hour_name ASC";
9300 9300
 		} else {
9301
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9301
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9302 9302
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9303 9303
 								GROUP BY hour_name 
9304 9304
 								ORDER BY hour_name ASC";
9305 9305
 		}
9306 9306
 		
9307 9307
 		$sth = $this->db->prepare($query);
9308
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9308
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9309 9309
       
9310 9310
 		$hour_array = array();
9311 9311
 		$temp_array = array();
9312 9312
         
9313
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9313
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9314 9314
 		{
9315 9315
 			$temp_array['hour_name'] = $row['hour_name'];
9316 9316
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9332,8 +9332,8 @@  discard block
 block discarded – undo
9332 9332
 	*/
9333 9333
 	public function countOverallAircrafts($filters = array())
9334 9334
 	{
9335
-		$filter_query = $this->getFilter($filters,true,true);
9336
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9335
+		$filter_query = $this->getFilter($filters, true, true);
9336
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9337 9337
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9338 9338
 		$sth = $this->db->prepare($query);
9339 9339
 		$sth->execute();
@@ -9348,8 +9348,8 @@  discard block
 block discarded – undo
9348 9348
 	*/
9349 9349
 	public function countOverallArrival($filters = array())
9350 9350
 	{
9351
-		$filter_query = $this->getFilter($filters,true,true);
9352
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9351
+		$filter_query = $this->getFilter($filters, true, true);
9352
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9353 9353
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9354 9354
 		
9355 9355
 		$sth = $this->db->prepare($query);
@@ -9365,8 +9365,8 @@  discard block
 block discarded – undo
9365 9365
 	*/
9366 9366
 	public function countOverallPilots($filters = array())
9367 9367
 	{
9368
-		$filter_query = $this->getFilter($filters,true,true);
9369
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9368
+		$filter_query = $this->getFilter($filters, true, true);
9369
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9370 9370
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9371 9371
 		$sth = $this->db->prepare($query);
9372 9372
 		$sth->execute();
@@ -9381,8 +9381,8 @@  discard block
 block discarded – undo
9381 9381
 	*/
9382 9382
 	public function countOverallOwners($filters = array())
9383 9383
 	{
9384
-		$filter_query = $this->getFilter($filters,true,true);
9385
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9384
+		$filter_query = $this->getFilter($filters, true, true);
9385
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9386 9386
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9387 9387
 		$sth = $this->db->prepare($query);
9388 9388
 		$sth->execute();
@@ -9415,8 +9415,8 @@  discard block
 block discarded – undo
9415 9415
 	*/
9416 9416
 	public function countOverallMilitaryFlights($filters = array())
9417 9417
 	{
9418
-		$filter_query = $this->getFilter($filters,true,true);
9419
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9418
+		$filter_query = $this->getFilter($filters, true, true);
9419
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9420 9420
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9421 9421
       
9422 9422
 		$sth = $this->db->prepare($query);
@@ -9453,7 +9453,7 @@  discard block
 block discarded – undo
9453 9453
 	public function countAllHoursFromToday($filters = array())
9454 9454
 	{
9455 9455
 		global $globalTimezone, $globalDBdriver;
9456
-		$filter_query = $this->getFilter($filters,true,true);
9456
+		$filter_query = $this->getFilter($filters, true, true);
9457 9457
 		if ($globalTimezone != '') {
9458 9458
 			date_default_timezone_set($globalTimezone);
9459 9459
 			$datetime = new DateTime();
@@ -9461,12 +9461,12 @@  discard block
 block discarded – undo
9461 9461
 		} else $offset = '+00:00';
9462 9462
 
9463 9463
 		if ($globalDBdriver == 'mysql') {
9464
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9464
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9465 9465
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9466 9466
 								GROUP BY hour_name 
9467 9467
 								ORDER BY hour_name ASC";
9468 9468
 		} else {
9469
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9469
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9470 9470
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9471 9471
 								GROUP BY hour_name 
9472 9472
 								ORDER BY hour_name ASC";
@@ -9478,7 +9478,7 @@  discard block
 block discarded – undo
9478 9478
 		$hour_array = array();
9479 9479
 		$temp_array = array();
9480 9480
         
9481
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9481
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9482 9482
 		{
9483 9483
 			$temp_array['hour_name'] = $row['hour_name'];
9484 9484
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9497,14 +9497,14 @@  discard block
 block discarded – undo
9497 9497
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9498 9498
 	{
9499 9499
 		global $global_query, $globalDBdriver, $globalTimezone;
9500
-		$filter_query = $this->getFilter($filters,true,true);
9500
+		$filter_query = $this->getFilter($filters, true, true);
9501 9501
 		date_default_timezone_set('UTC');
9502 9502
 		$limit_query = '';
9503 9503
 		if ($limit != "")
9504 9504
 		{
9505 9505
 			$limit_array = explode(",", $limit);
9506
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9507
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9506
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9507
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9508 9508
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9509 9509
 			{
9510 9510
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9557,7 +9557,7 @@  discard block
 block discarded – undo
9557 9557
 			    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')
9558 9558
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9559 9559
 			//echo $query;
9560
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9560
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9561 9561
 			/*
9562 9562
 			$sth = $this->db->prepare($query);
9563 9563
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9576,9 +9576,9 @@  discard block
 block discarded – undo
9576 9576
 	*/
9577 9577
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9578 9578
 	{
9579
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9579
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9580 9580
 
9581
-		$query  = "SELECT spotter_output.spotter_id
9581
+		$query = "SELECT spotter_output.spotter_id
9582 9582
 								FROM spotter_output 
9583 9583
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9584 9584
         
@@ -9586,7 +9586,7 @@  discard block
 block discarded – undo
9586 9586
 		$sth = $this->db->prepare($query);
9587 9587
 		$sth->execute();
9588 9588
 
9589
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9589
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9590 9590
 		{
9591 9591
 			return $row['spotter_id'];
9592 9592
 		}
@@ -9611,23 +9611,23 @@  discard block
 block discarded – undo
9611 9611
 		}
9612 9612
 		
9613 9613
 		$current_date = date("Y-m-d H:i:s");
9614
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9614
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9615 9615
 		
9616 9616
 		$diff = abs(strtotime($current_date) - strtotime($date));
9617 9617
 
9618
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9618
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9619 9619
 		$years = $time_array['years'];
9620 9620
 		
9621
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9621
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9622 9622
 		$months = $time_array['months'];
9623 9623
 		
9624
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9624
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9625 9625
 		$days = $time_array['days'];
9626
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9626
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9627 9627
 		$hours = $time_array['hours'];
9628
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9628
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9629 9629
 		$minutes = $time_array['minutes'];
9630
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9630
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9631 9631
 		
9632 9632
 		return $time_array;	
9633 9633
 	}	
@@ -9653,63 +9653,63 @@  discard block
 block discarded – undo
9653 9653
 			$temp_array['direction_degree'] = $direction;
9654 9654
 			$temp_array['direction_shortname'] = "N";
9655 9655
 			$temp_array['direction_fullname'] = "North";
9656
-		} elseif ($direction >= 22.5 && $direction < 45){
9656
+		} elseif ($direction >= 22.5 && $direction < 45) {
9657 9657
 			$temp_array['direction_degree'] = $direction;
9658 9658
 			$temp_array['direction_shortname'] = "NNE";
9659 9659
 			$temp_array['direction_fullname'] = "North-Northeast";
9660
-		} elseif ($direction >= 45 && $direction < 67.5){
9660
+		} elseif ($direction >= 45 && $direction < 67.5) {
9661 9661
 			$temp_array['direction_degree'] = $direction;
9662 9662
 			$temp_array['direction_shortname'] = "NE";
9663 9663
 			$temp_array['direction_fullname'] = "Northeast";
9664
-		} elseif ($direction >= 67.5 && $direction < 90){
9664
+		} elseif ($direction >= 67.5 && $direction < 90) {
9665 9665
 			$temp_array['direction_degree'] = $direction;
9666 9666
 			$temp_array['direction_shortname'] = "ENE";
9667 9667
 			$temp_array['direction_fullname'] = "East-Northeast";
9668
-		} elseif ($direction >= 90 && $direction < 112.5){
9668
+		} elseif ($direction >= 90 && $direction < 112.5) {
9669 9669
 			$temp_array['direction_degree'] = $direction;
9670 9670
 			$temp_array['direction_shortname'] = "E";
9671 9671
 			$temp_array['direction_fullname'] = "East";
9672
-		} elseif ($direction >= 112.5 && $direction < 135){
9672
+		} elseif ($direction >= 112.5 && $direction < 135) {
9673 9673
 			$temp_array['direction_degree'] = $direction;
9674 9674
 			$temp_array['direction_shortname'] = "ESE";
9675 9675
 			$temp_array['direction_fullname'] = "East-Southeast";
9676
-		} elseif ($direction >= 135 && $direction < 157.5){
9676
+		} elseif ($direction >= 135 && $direction < 157.5) {
9677 9677
 			$temp_array['direction_degree'] = $direction;
9678 9678
 			$temp_array['direction_shortname'] = "SE";
9679 9679
 			$temp_array['direction_fullname'] = "Southeast";
9680
-		} elseif ($direction >= 157.5 && $direction < 180){
9680
+		} elseif ($direction >= 157.5 && $direction < 180) {
9681 9681
 			$temp_array['direction_degree'] = $direction;
9682 9682
 			$temp_array['direction_shortname'] = "SSE";
9683 9683
 			$temp_array['direction_fullname'] = "South-Southeast";
9684
-		} elseif ($direction >= 180 && $direction < 202.5){
9684
+		} elseif ($direction >= 180 && $direction < 202.5) {
9685 9685
 			$temp_array['direction_degree'] = $direction;
9686 9686
 			$temp_array['direction_shortname'] = "S";
9687 9687
 			$temp_array['direction_fullname'] = "South";
9688
-		} elseif ($direction >= 202.5 && $direction < 225){
9688
+		} elseif ($direction >= 202.5 && $direction < 225) {
9689 9689
 			$temp_array['direction_degree'] = $direction;
9690 9690
 			$temp_array['direction_shortname'] = "SSW";
9691 9691
 			$temp_array['direction_fullname'] = "South-Southwest";
9692
-		} elseif ($direction >= 225 && $direction < 247.5){
9692
+		} elseif ($direction >= 225 && $direction < 247.5) {
9693 9693
 			$temp_array['direction_degree'] = $direction;
9694 9694
 			$temp_array['direction_shortname'] = "SW";
9695 9695
 			$temp_array['direction_fullname'] = "Southwest";
9696
-		} elseif ($direction >= 247.5 && $direction < 270){
9696
+		} elseif ($direction >= 247.5 && $direction < 270) {
9697 9697
 			$temp_array['direction_degree'] = $direction;
9698 9698
 			$temp_array['direction_shortname'] = "WSW";
9699 9699
 			$temp_array['direction_fullname'] = "West-Southwest";
9700
-		} elseif ($direction >= 270 && $direction < 292.5){
9700
+		} elseif ($direction >= 270 && $direction < 292.5) {
9701 9701
 			$temp_array['direction_degree'] = $direction;
9702 9702
 			$temp_array['direction_shortname'] = "W";
9703 9703
 			$temp_array['direction_fullname'] = "West";
9704
-		} elseif ($direction >= 292.5 && $direction < 315){
9704
+		} elseif ($direction >= 292.5 && $direction < 315) {
9705 9705
 			$temp_array['direction_degree'] = $direction;
9706 9706
 			$temp_array['direction_shortname'] = "WNW";
9707 9707
 			$temp_array['direction_fullname'] = "West-Northwest";
9708
-		} elseif ($direction >= 315 && $direction < 337.5){
9708
+		} elseif ($direction >= 315 && $direction < 337.5) {
9709 9709
 			$temp_array['direction_degree'] = $direction;
9710 9710
 			$temp_array['direction_shortname'] = "NW";
9711 9711
 			$temp_array['direction_fullname'] = "Northwest";
9712
-		} elseif ($direction >= 337.5 && $direction < 360){
9712
+		} elseif ($direction >= 337.5 && $direction < 360) {
9713 9713
 			$temp_array['direction_degree'] = $direction;
9714 9714
 			$temp_array['direction_shortname'] = "NNW";
9715 9715
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9762,9 +9762,9 @@  discard block
 block discarded – undo
9762 9762
 	*/
9763 9763
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9764 9764
 	{
9765
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9765
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9766 9766
 	
9767
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9767
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9768 9768
 		
9769 9769
 		$sth = $this->db->prepare($query);
9770 9770
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9787,9 +9787,9 @@  discard block
 block discarded – undo
9787 9787
 	*/
9788 9788
 	public function getAircraftTypeBymodeS($aircraft_modes)
9789 9789
 	{
9790
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9790
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9791 9791
 	
9792
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9792
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9793 9793
 		
9794 9794
 		$sth = $this->db->prepare($query);
9795 9795
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9810,11 +9810,11 @@  discard block
 block discarded – undo
9810 9810
 	* @param Float $longitude longitute of the flight
9811 9811
 	* @return String the countrie
9812 9812
 	*/
9813
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9813
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9814 9814
 	{
9815 9815
 		global $globalDBdriver, $globalDebug;
9816
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9817
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9816
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9817
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9818 9818
 	
9819 9819
 		$Connection = new Connection($this->db);
9820 9820
 		if (!$Connection->tableExists('countries')) return '';
@@ -9854,7 +9854,7 @@  discard block
 block discarded – undo
9854 9854
 	public function getCountryFromISO2($iso2)
9855 9855
 	{
9856 9856
 		global $globalDBdriver, $globalDebug;
9857
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9857
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
9858 9858
 	
9859 9859
 		$Connection = new Connection($this->db);
9860 9860
 		if (!$Connection->tableExists('countries')) return '';
@@ -9886,19 +9886,19 @@  discard block
 block discarded – undo
9886 9886
 	*/
9887 9887
 	public function convertAircraftRegistration($registration)
9888 9888
 	{
9889
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9889
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9890 9890
 		$registration_prefix = '';
9891 9891
 		$registration_1 = substr($registration, 0, 1);
9892 9892
 		$registration_2 = substr($registration, 0, 2);
9893 9893
 
9894 9894
 		//first get the prefix based on two characters
9895
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9895
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9896 9896
       
9897 9897
 		
9898 9898
 		$sth = $this->db->prepare($query);
9899 9899
 		$sth->execute(array(':registration_2' => $registration_2));
9900 9900
         
9901
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9901
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9902 9902
 		{
9903 9903
 			$registration_prefix = $row['registration_prefix'];
9904 9904
 		}
@@ -9906,11 +9906,11 @@  discard block
 block discarded – undo
9906 9906
 		//if we didn't find a two chracter prefix lets just search the one with one character
9907 9907
 		if ($registration_prefix == '')
9908 9908
 		{
9909
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9909
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9910 9910
 			$sth = $this->db->prepare($query);
9911 9911
 			$sth->execute(array(':registration_1' => $registration_1));
9912 9912
 	        
9913
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9913
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9914 9914
 			{
9915 9915
 				$registration_prefix = $row['registration_prefix'];
9916 9916
 			}
@@ -9924,7 +9924,7 @@  discard block
 block discarded – undo
9924 9924
 			} else {
9925 9925
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9926 9926
 			}
9927
-		} else if(strlen($registration_prefix) == 2){
9927
+		} else if (strlen($registration_prefix) == 2) {
9928 9928
 			if (0 === strpos($registration, 'N')) {
9929 9929
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9930 9930
 			} else {
@@ -9943,17 +9943,17 @@  discard block
 block discarded – undo
9943 9943
 	*/
9944 9944
 	public function countryFromAircraftRegistration($registration)
9945 9945
 	{
9946
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9946
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9947 9947
 		
9948 9948
 		$registration_prefix = '';
9949
-		$registration_test = explode('-',$registration);
9949
+		$registration_test = explode('-', $registration);
9950 9950
 		$country = '';
9951 9951
 		if ($registration_test[0] != $registration) {
9952 9952
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9953 9953
 	      
9954 9954
 			$sth = $this->db->prepare($query);
9955 9955
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9956
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9956
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9957 9957
 			{
9958 9958
 				//$registration_prefix = $row['registration_prefix'];
9959 9959
 				$country = $row['country'];
@@ -9964,13 +9964,13 @@  discard block
 block discarded – undo
9964 9964
 
9965 9965
 			$country = '';
9966 9966
 			//first get the prefix based on two characters
9967
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9967
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9968 9968
       
9969 9969
 			
9970 9970
 			$sth = $this->db->prepare($query);
9971 9971
 			$sth->execute(array(':registration_2' => $registration_2));
9972 9972
         
9973
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9973
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9974 9974
 			{
9975 9975
 				$registration_prefix = $row['registration_prefix'];
9976 9976
 				$country = $row['country'];
@@ -9979,12 +9979,12 @@  discard block
 block discarded – undo
9979 9979
 			//if we didn't find a two chracter prefix lets just search the one with one character
9980 9980
 			if ($registration_prefix == "")
9981 9981
 			{
9982
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9982
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9983 9983
 	      
9984 9984
 				$sth = $this->db->prepare($query);
9985 9985
 				$sth->execute(array(':registration_1' => $registration_1));
9986 9986
 	        
9987
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9987
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9988 9988
 				{
9989 9989
 					//$registration_prefix = $row['registration_prefix'];
9990 9990
 					$country = $row['country'];
@@ -10004,17 +10004,17 @@  discard block
 block discarded – undo
10004 10004
 	*/
10005 10005
 	public function registrationPrefixFromAircraftRegistration($registration)
10006 10006
 	{
10007
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10007
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10008 10008
 		
10009 10009
 		$registration_prefix = '';
10010
-		$registration_test = explode('-',$registration);
10010
+		$registration_test = explode('-', $registration);
10011 10011
 		//$country = '';
10012 10012
 		if ($registration_test[0] != $registration) {
10013
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10013
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10014 10014
 	      
10015 10015
 			$sth = $this->db->prepare($query);
10016 10016
 			$sth->execute(array(':registration_1' => $registration_test[0]));
10017
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10017
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10018 10018
 			{
10019 10019
 				$registration_prefix = $row['registration_prefix'];
10020 10020
 				//$country = $row['country'];
@@ -10024,13 +10024,13 @@  discard block
 block discarded – undo
10024 10024
 		        $registration_2 = substr($registration, 0, 2);
10025 10025
 
10026 10026
 			//first get the prefix based on two characters
10027
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
10027
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
10028 10028
       
10029 10029
 			
10030 10030
 			$sth = $this->db->prepare($query);
10031 10031
 			$sth->execute(array(':registration_2' => $registration_2));
10032 10032
         
10033
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10033
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10034 10034
 			{
10035 10035
 				$registration_prefix = $row['registration_prefix'];
10036 10036
 				//$country = $row['country'];
@@ -10039,12 +10039,12 @@  discard block
 block discarded – undo
10039 10039
 			//if we didn't find a two chracter prefix lets just search the one with one character
10040 10040
 			if ($registration_prefix == "")
10041 10041
 			{
10042
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10042
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10043 10043
 	      
10044 10044
 				$sth = $this->db->prepare($query);
10045 10045
 				$sth->execute(array(':registration_1' => $registration_1));
10046 10046
 	        
10047
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
10047
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10048 10048
 				{
10049 10049
 					$registration_prefix = $row['registration_prefix'];
10050 10050
 					//$country = $row['country'];
@@ -10065,13 +10065,13 @@  discard block
 block discarded – undo
10065 10065
 	*/
10066 10066
 	public function countryFromAircraftRegistrationCode($registration)
10067 10067
 	{
10068
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10068
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10069 10069
 		
10070 10070
 		$country = '';
10071
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
10071
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
10072 10072
 		$sth = $this->db->prepare($query);
10073 10073
 		$sth->execute(array(':registration' => $registration));
10074
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10074
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10075 10075
 		{
10076 10076
 			$country = $row['country'];
10077 10077
 		}
@@ -10084,9 +10084,9 @@  discard block
 block discarded – undo
10084 10084
 	* @param String $flightaware_id flightaware_id from spotter_output table
10085 10085
 	* @param String $highlight New highlight value
10086 10086
 	*/
10087
-	public function setHighlightFlight($flightaware_id,$highlight) {
10087
+	public function setHighlightFlight($flightaware_id, $highlight) {
10088 10088
 		
10089
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
10089
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
10090 10090
 		$sth = $this->db->prepare($query);
10091 10091
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
10092 10092
 	}
@@ -10098,13 +10098,13 @@  discard block
 block discarded – undo
10098 10098
 	* @param String $date Date of spotted aircraft
10099 10099
 	* @param String $highlight New highlight value
10100 10100
 	*/
10101
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
10101
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
10102 10102
 		if ($date == '') {
10103 10103
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
10104 10104
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
10105 10105
 		} else {
10106 10106
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
10107
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
10107
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
10108 10108
 		}
10109 10109
 		$sth = $this->db->prepare($query);
10110 10110
 		$sth->execute($query_values);
@@ -10134,7 +10134,7 @@  discard block
 block discarded – undo
10134 10134
 		
10135 10135
 		$bitly_data = json_decode($bitly_data);
10136 10136
 		$bitly_url = '';
10137
-		if ($bitly_data->status_txt = "OK"){
10137
+		if ($bitly_data->status_txt = "OK") {
10138 10138
 			$bitly_url = $bitly_data->data->url;
10139 10139
 		}
10140 10140
 
@@ -10144,7 +10144,7 @@  discard block
 block discarded – undo
10144 10144
 
10145 10145
 	public function getOrderBy()
10146 10146
 	{
10147
-		$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"));
10147
+		$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"));
10148 10148
 		
10149 10149
 		return $orderby;
10150 10150
 		
@@ -10278,14 +10278,14 @@  discard block
 block discarded – undo
10278 10278
 		}
10279 10279
 		$sth = $this->db->prepare($query);
10280 10280
 		$sth->execute();
10281
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10281
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10282 10282
 		{
10283 10283
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10284 10284
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10285 10285
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10286
-				$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";
10286
+				$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";
10287 10287
 				$sthu = $this->db->prepare($update_query);
10288
-				$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']));
10288
+				$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']));
10289 10289
 			}
10290 10290
 		}
10291 10291
 		
@@ -10298,7 +10298,7 @@  discard block
 block discarded – undo
10298 10298
 		}
10299 10299
 		$sth = $this->db->prepare($query);
10300 10300
 		$sth->execute();
10301
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10301
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10302 10302
 		{
10303 10303
 			if (is_numeric(substr($row['ident'], -1, 1)))
10304 10304
 			{
@@ -10307,11 +10307,11 @@  discard block
 block discarded – undo
10307 10307
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10308 10308
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10309 10309
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10310
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10310
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10311 10311
 				if (isset($airline_array[0]['name'])) {
10312
-					$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";
10312
+					$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";
10313 10313
 					$sthu = $this->db->prepare($update_query);
10314
-					$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']));
10314
+					$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']));
10315 10315
 				}
10316 10316
 			}
10317 10317
 		}
@@ -10331,18 +10331,18 @@  discard block
 block discarded – undo
10331 10331
 		}
10332 10332
 		$sth = $this->db->prepare($query);
10333 10333
 		$sth->execute();
10334
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10334
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10335 10335
 		{
10336 10336
 			if ($row['aircraft_icao'] != '') {
10337 10337
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10338
-				if ($row['registration'] != ""){
10338
+				if ($row['registration'] != "") {
10339 10339
 					$image_array = $Image->getSpotterImage($row['registration']);
10340 10340
 					if (!isset($image_array[0]['registration'])) {
10341 10341
 						$Image->addSpotterImage($row['registration']);
10342 10342
 					}
10343 10343
 				}
10344 10344
 				if (count($aircraft_name) > 0) {
10345
-					$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";
10345
+					$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";
10346 10346
 					$sthu = $this->db->prepare($update_query);
10347 10347
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10348 10348
 				}
@@ -10357,10 +10357,10 @@  discard block
 block discarded – undo
10357 10357
 		$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";
10358 10358
 		$sth = $this->db->prepare($query);
10359 10359
 		$sth->execute();
10360
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10360
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10361 10361
 		{
10362 10362
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10363
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10363
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10364 10364
 				$airport_icao = '';
10365 10365
 				 if (isset($closestAirports[0])) {
10366 10366
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10374,7 +10374,7 @@  discard block
 block discarded – undo
10374 10374
 								break;
10375 10375
 							}
10376 10376
 						}
10377
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10377
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10378 10378
 						$airport_icao = $closestAirports[0]['icao'];
10379 10379
 						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";
10380 10380
 					} else {
@@ -10385,28 +10385,28 @@  discard block
 block discarded – undo
10385 10385
 				}
10386 10386
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10387 10387
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10388
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10388
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10389 10389
 					$sthu = $this->db->prepare($update_query);
10390
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10390
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10391 10391
 				}
10392 10392
 			}
10393 10393
 		}
10394 10394
 	}
10395 10395
 	
10396
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10396
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10397 10397
 		global $globalDBdriver;
10398
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10398
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10399 10399
 /*
10400 10400
 		$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 
10401 10401
                       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)) 
10402 10402
                       having distance < $dist ORDER BY distance limit 100;";
10403 10403
 */
10404 10404
 		if ($globalDBdriver == 'mysql') {
10405
-			$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 
10405
+			$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 
10406 10406
 	                      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)) 
10407 10407
 	                      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;";
10408 10408
                 } else {
10409
-			$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 
10409
+			$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 
10410 10410
 	                      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)) 
10411 10411
 	                      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;";
10412 10412
     		}
Please login to merge, or discard this patch.
Braces   +695 added lines, -241 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
 
@@ -1832,7 +1934,9 @@  discard block
 block discarded – undo
1832 1934
 		{
1833 1935
 			$highlight = $row['highlight'];
1834 1936
 		}
1835
-		if (isset($highlight)) return $highlight;
1937
+		if (isset($highlight)) {
1938
+			return $highlight;
1939
+		}
1836 1940
 	}
1837 1941
 
1838 1942
 	
@@ -1860,7 +1964,9 @@  discard block
 block discarded – undo
1860 1964
 		$sth->closeCursor();
1861 1965
 		if (count($row) > 0) {
1862 1966
 			return $row['usage'];
1863
-		} else return '';
1967
+		} else {
1968
+			return '';
1969
+		}
1864 1970
 	}
1865 1971
 
1866 1972
 	/**
@@ -1885,7 +1991,9 @@  discard block
 block discarded – undo
1885 1991
 		$sth->closeCursor();
1886 1992
 		if (count($row) > 0) {
1887 1993
 			return $row['icao'];
1888
-		} else return '';
1994
+		} else {
1995
+			return '';
1996
+		}
1889 1997
 	}
1890 1998
 
1891 1999
 	/**
@@ -1913,7 +2021,9 @@  discard block
 block discarded – undo
1913 2021
 			$airport_longitude = $row['longitude'];
1914 2022
 			$Common = new Common();
1915 2023
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1916
-		} else return '';
2024
+		} else {
2025
+			return '';
2026
+		}
1917 2027
 	}
1918 2028
 	
1919 2029
 	/**
@@ -2025,7 +2135,9 @@  discard block
 block discarded – undo
2025 2135
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2026 2136
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2027 2137
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2028
-		} else return array();
2138
+		} else {
2139
+			return array();
2140
+		}
2029 2141
 		if ($globalDBdriver == 'mysql') {
2030 2142
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2031 2143
 		} else {
@@ -2060,7 +2172,9 @@  discard block
 block discarded – undo
2060 2172
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2061 2173
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2062 2174
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2063
-		} else return array();
2175
+		} else {
2176
+			return array();
2177
+		}
2064 2178
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2065 2179
 		$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.")";
2066 2180
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2095,7 +2209,9 @@  discard block
 block discarded – undo
2095 2209
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2096 2210
 	{
2097 2211
 		global $globalUseRealAirlines;
2098
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2212
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2213
+			$fromsource = NULL;
2214
+		}
2099 2215
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2100 2216
 		if ($airline_icao == 'NA') {
2101 2217
 			$airline_array = array();
@@ -2145,7 +2261,9 @@  discard block
 block discarded – undo
2145 2261
 				$sth->execute(array(':fromsource' => $fromsource));
2146 2262
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2147 2263
 				$sth->closeCursor();
2148
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2264
+				if ($row['nb'] == 0) {
2265
+					$result = $this->getAllAirlineInfo($airline_icao);
2266
+				}
2149 2267
 			}
2150 2268
 			return $result;
2151 2269
 		}
@@ -2161,7 +2279,9 @@  discard block
 block discarded – undo
2161 2279
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2162 2280
 	{
2163 2281
 		global $globalUseRealAirlines;
2164
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2282
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2283
+			$fromsource = NULL;
2284
+		}
2165 2285
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2166 2286
 		$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";
2167 2287
 		$sth = $this->db->prepare($query);
@@ -2177,7 +2297,9 @@  discard block
 block discarded – undo
2177 2297
 			$sth->execute(array(':fromsource' => $fromsource));
2178 2298
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2179 2299
 			$sth->closeCursor();
2180
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2300
+			if ($row['nb'] == 0) {
2301
+				$result = $this->getAllAirlineInfoByName($airline_name);
2302
+			}
2181 2303
 		}
2182 2304
 		return $result;
2183 2305
 	}
@@ -2240,15 +2362,20 @@  discard block
 block discarded – undo
2240 2362
 				'A320-211' => 'A320',
2241 2363
 				'747-8i' => 'B748',
2242 2364
 				'A380' => 'A388');
2243
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2365
+		if (isset($all_aircraft[$aircraft_type])) {
2366
+			return $all_aircraft[$aircraft_type];
2367
+		}
2244 2368
 
2245 2369
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2246 2370
 		$aircraft_type = strtoupper($aircraft_type);
2247 2371
 		$sth = $this->db->prepare($query);
2248 2372
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2249 2373
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2250
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2251
-		else return '';
2374
+		if (isset($result[0]['icao'])) {
2375
+			return $result[0]['icao'];
2376
+		} else {
2377
+			return '';
2378
+		}
2252 2379
 	}
2253 2380
 	
2254 2381
 	/**
@@ -2271,9 +2398,13 @@  discard block
 block discarded – undo
2271 2398
 		$sth->closeCursor();
2272 2399
 		if (isset($row['icaotypecode'])) {
2273 2400
 			$icao = $row['icaotypecode'];
2274
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2401
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2402
+				$icao = $this->aircraft_correct_icaotype[$icao];
2403
+			}
2275 2404
 			return $icao;
2276
-		} else return '';
2405
+		} else {
2406
+			return '';
2407
+		}
2277 2408
 	}
2278 2409
 
2279 2410
 	/**
@@ -2296,7 +2427,9 @@  discard block
 block discarded – undo
2296 2427
 		$sth->closeCursor();
2297 2428
 		if (isset($row['icaotypecode'])) {
2298 2429
 			return $row['icaotypecode'];
2299
-		} else return '';
2430
+		} else {
2431
+			return '';
2432
+		}
2300 2433
 	}
2301 2434
 
2302 2435
 	/**
@@ -2318,7 +2451,9 @@  discard block
 block discarded – undo
2318 2451
 		$sth->closeCursor();
2319 2452
 		if (isset($row['operator_correct'])) {
2320 2453
 			return $row['operator_correct'];
2321
-		} else return $operator;
2454
+		} else {
2455
+			return $operator;
2456
+		}
2322 2457
 	}
2323 2458
 
2324 2459
 	/**
@@ -2331,7 +2466,9 @@  discard block
 block discarded – undo
2331 2466
 	public function getRouteInfo($callsign)
2332 2467
 	{
2333 2468
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2334
-                if ($callsign == '') return array();
2469
+                if ($callsign == '') {
2470
+                	return array();
2471
+                }
2335 2472
 		$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";
2336 2473
 		
2337 2474
 		$sth = $this->db->prepare($query);
@@ -2341,7 +2478,9 @@  discard block
 block discarded – undo
2341 2478
 		$sth->closeCursor();
2342 2479
 		if (count($row) > 0) {
2343 2480
 			return $row;
2344
-		} else return array();
2481
+		} else {
2482
+			return array();
2483
+		}
2345 2484
 	}
2346 2485
 	
2347 2486
 	/**
@@ -2394,7 +2533,9 @@  discard block
 block discarded – undo
2394 2533
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2395 2534
 			$sth->closeCursor();
2396 2535
 			return $result;
2397
-		} else return array();
2536
+		} else {
2537
+			return array();
2538
+		}
2398 2539
 	}
2399 2540
 	
2400 2541
   
@@ -2553,8 +2694,11 @@  discard block
 block discarded – undo
2553 2694
 		$query .= " ORDER BY spotter_output.source_name ASC";
2554 2695
 
2555 2696
 		$sth = $this->db->prepare($query);
2556
-		if (!empty($query_values)) $sth->execute($query_values);
2557
-		else $sth->execute();
2697
+		if (!empty($query_values)) {
2698
+			$sth->execute($query_values);
2699
+		} else {
2700
+			$sth->execute();
2701
+		}
2558 2702
 
2559 2703
 		$source_array = array();
2560 2704
 		$temp_array = array();
@@ -2587,9 +2731,13 @@  discard block
 block discarded – undo
2587 2731
 								WHERE spotter_output.airline_icao <> '' 
2588 2732
 								ORDER BY spotter_output.airline_name ASC";
2589 2733
 			*/
2590
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2591
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2592
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2734
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2735
+				$forsource = $globalAirlinesSource;
2736
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2737
+				$forsource = 'vatsim';
2738
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2739
+				$forsource = 'ivao';
2740
+			}
2593 2741
 			if ($forsource === NULL) {
2594 2742
 				$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";
2595 2743
 				$query_data = array();
@@ -2632,9 +2780,13 @@  discard block
 block discarded – undo
2632 2780
 	{
2633 2781
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2634 2782
 		$filter_query = $this->getFilter($filters,true,true);
2635
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2636
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2637
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2783
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2784
+			$forsource = $globalAirlinesSource;
2785
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2786
+			$forsource = 'vatsim';
2787
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2788
+			$forsource = 'ivao';
2789
+		}
2638 2790
 		if ($forsource === NULL) {
2639 2791
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2640 2792
 			$query_data = array();
@@ -2909,7 +3061,9 @@  discard block
 block discarded – undo
2909 3061
 			date_default_timezone_set($globalTimezone);
2910 3062
 			$datetime = new DateTime();
2911 3063
 			$offset = $datetime->format('P');
2912
-		} else $offset = '+00:00';
3064
+		} else {
3065
+			$offset = '+00:00';
3066
+		}
2913 3067
 		if ($airport_icao == '') {
2914 3068
 			if ($globalDBdriver == 'mysql') {
2915 3069
 				$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";
@@ -2941,7 +3095,9 @@  discard block
 block discarded – undo
2941 3095
 			date_default_timezone_set($globalTimezone);
2942 3096
 			$datetime = new DateTime();
2943 3097
 			$offset = $datetime->format('P');
2944
-		} else $offset = '+00:00';
3098
+		} else {
3099
+			$offset = '+00:00';
3100
+		}
2945 3101
 		if ($airport_icao == '') {
2946 3102
 			if ($globalDBdriver == 'mysql') {
2947 3103
 				$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";
@@ -2974,7 +3130,9 @@  discard block
 block discarded – undo
2974 3130
 			date_default_timezone_set($globalTimezone);
2975 3131
 			$datetime = new DateTime();
2976 3132
 			$offset = $datetime->format('P');
2977
-		} else $offset = '+00:00';
3133
+		} else {
3134
+			$offset = '+00:00';
3135
+		}
2978 3136
 		if ($airport_icao == '') {
2979 3137
 			if ($globalDBdriver == 'mysql') {
2980 3138
 				$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 
@@ -3013,7 +3171,9 @@  discard block
 block discarded – undo
3013 3171
 			date_default_timezone_set($globalTimezone);
3014 3172
 			$datetime = new DateTime();
3015 3173
 			$offset = $datetime->format('P');
3016
-		} else $offset = '+00:00';
3174
+		} else {
3175
+			$offset = '+00:00';
3176
+		}
3017 3177
 		if ($airport_icao == '') {
3018 3178
 			if ($globalDBdriver == 'mysql') {
3019 3179
 				$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 
@@ -3058,7 +3218,9 @@  discard block
 block discarded – undo
3058 3218
 			date_default_timezone_set($globalTimezone);
3059 3219
 			$datetime = new DateTime();
3060 3220
 			$offset = $datetime->format('P');
3061
-		} else $offset = '+00:00';
3221
+		} else {
3222
+			$offset = '+00:00';
3223
+		}
3062 3224
 		if ($airport_icao == '') {
3063 3225
 			if ($globalDBdriver == 'mysql') {
3064 3226
 				$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";
@@ -3093,7 +3255,9 @@  discard block
 block discarded – undo
3093 3255
 			date_default_timezone_set($globalTimezone);
3094 3256
 			$datetime = new DateTime();
3095 3257
 			$offset = $datetime->format('P');
3096
-		} else $offset = '+00:00';
3258
+		} else {
3259
+			$offset = '+00:00';
3260
+		}
3097 3261
 		if ($airport_icao == '') {
3098 3262
 			if ($globalDBdriver == 'mysql') {
3099 3263
 				$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 
@@ -3135,7 +3299,9 @@  discard block
 block discarded – undo
3135 3299
 			date_default_timezone_set($globalTimezone);
3136 3300
 			$datetime = new DateTime();
3137 3301
 			$offset = $datetime->format('P');
3138
-		} else $offset = '+00:00';
3302
+		} else {
3303
+			$offset = '+00:00';
3304
+		}
3139 3305
 		if ($airport_icao == '') {
3140 3306
 			if ($globalDBdriver == 'mysql') {
3141 3307
 				$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";
@@ -3169,7 +3335,9 @@  discard block
 block discarded – undo
3169 3335
 			date_default_timezone_set($globalTimezone);
3170 3336
 			$datetime = new DateTime();
3171 3337
 			$offset = $datetime->format('P');
3172
-		} else $offset = '+00:00';
3338
+		} else {
3339
+			$offset = '+00:00';
3340
+		}
3173 3341
 		if ($airport_icao == '') {
3174 3342
 			if ($globalDBdriver == 'mysql') {
3175 3343
 				$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 
@@ -3217,7 +3385,9 @@  discard block
 block discarded – undo
3217 3385
 			date_default_timezone_set($globalTimezone);
3218 3386
 			$datetime = new DateTime();
3219 3387
 			$offset = $datetime->format('P');
3220
-		} else $offset = '+00:00';
3388
+		} else {
3389
+			$offset = '+00:00';
3390
+		}
3221 3391
 
3222 3392
 		if ($globalDBdriver == 'mysql') {
3223 3393
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3337,7 +3507,9 @@  discard block
 block discarded – undo
3337 3507
 	*/	
3338 3508
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3339 3509
 	{
3340
-		if ($groundspeed == '') $groundspeed = NULL;
3510
+		if ($groundspeed == '') {
3511
+			$groundspeed = NULL;
3512
+		}
3341 3513
 		$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';
3342 3514
                 $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);
3343 3515
 
@@ -3387,10 +3559,18 @@  discard block
 block discarded – undo
3387 3559
 		$Image = new Image($this->db);
3388 3560
 		$Common = new Common();
3389 3561
 		
3390
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3391
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3392
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3393
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3562
+		if (!isset($globalIVAO)) {
3563
+			$globalIVAO = FALSE;
3564
+		}
3565
+		if (!isset($globalVATSIM)) {
3566
+			$globalVATSIM = FALSE;
3567
+		}
3568
+		if (!isset($globalphpVMS)) {
3569
+			$globalphpVMS = FALSE;
3570
+		}
3571
+		if (!isset($globalVAM)) {
3572
+			$globalVAM = FALSE;
3573
+		}
3394 3574
 		date_default_timezone_set('UTC');
3395 3575
 		
3396 3576
 		//getting the registration
@@ -3403,23 +3583,33 @@  discard block
 block discarded – undo
3403 3583
 				if ($ModeS != '') {
3404 3584
 					$timeelapsed = microtime(true);
3405 3585
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3406
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3586
+					if ($globalDebugTimeElapsed) {
3587
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3588
+					}
3407 3589
 				} else {
3408 3590
 					$myhex = explode('-',$flightaware_id);
3409 3591
 					if (count($myhex) > 0) {
3410 3592
 						$timeelapsed = microtime(true);
3411 3593
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3412
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3594
+						if ($globalDebugTimeElapsed) {
3595
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3596
+						}
3413 3597
 					}
3414 3598
 				}
3415 3599
 			}
3416 3600
 		}
3417 3601
 		$fromsource = NULL;
3418
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3419
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3420
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3421
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3422
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3602
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3603
+			$fromsource = $globalAirlinesSource;
3604
+		} elseif ($format_source == 'vatsimtxt') {
3605
+			$fromsource = 'vatsim';
3606
+		} elseif ($format_source == 'whazzup') {
3607
+			$fromsource = 'ivao';
3608
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3609
+			$fromsource = 'vatsim';
3610
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3611
+			$fromsource = 'ivao';
3612
+		}
3423 3613
 		//getting the airline information
3424 3614
 		if ($ident != "")
3425 3615
 		{
@@ -3443,15 +3633,21 @@  discard block
 block discarded – undo
3443 3633
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3444 3634
 						$airline_array = $this->getAllAirlineInfo("NA");
3445 3635
 					}
3446
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3636
+					if ($globalDebugTimeElapsed) {
3637
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3638
+					}
3447 3639
 
3448 3640
 				} else {
3449 3641
 					$timeelapsed = microtime(true);
3450 3642
 					$airline_array = $this->getAllAirlineInfo("NA");
3451
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3643
+					if ($globalDebugTimeElapsed) {
3644
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3645
+					}
3452 3646
 				}
3453 3647
 			}
3454
-		} else $airline_array = array();
3648
+		} else {
3649
+			$airline_array = array();
3650
+		}
3455 3651
 		
3456 3652
 		//getting the aircraft information
3457 3653
 		$aircraft_array = array();
@@ -3465,27 +3661,37 @@  discard block
 block discarded – undo
3465 3661
 				{
3466 3662
 					$timeelapsed = microtime(true);
3467 3663
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3468
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3664
+					if ($globalDebugTimeElapsed) {
3665
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3666
+					}
3469 3667
 				} else {
3470 3668
 					$timeelapsed = microtime(true);
3471 3669
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3472
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3670
+					if ($globalDebugTimeElapsed) {
3671
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3672
+					}
3473 3673
 				}
3474 3674
 			}
3475 3675
 		} else {
3476 3676
 			if ($ModeS != '') {
3477 3677
 				$timeelapsed = microtime(true);
3478 3678
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3479
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3679
+				if ($globalDebugTimeElapsed) {
3680
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3681
+				}
3480 3682
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3481 3683
 				{
3482 3684
 					$timeelapsed = microtime(true);
3483 3685
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3484
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3686
+					if ($globalDebugTimeElapsed) {
3687
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3688
+					}
3485 3689
 				} else {
3486 3690
 					$timeelapsed = microtime(true);
3487 3691
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3488
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3692
+					if ($globalDebugTimeElapsed) {
3693
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3694
+					}
3489 3695
 				}
3490 3696
 			}
3491 3697
 		}
@@ -3501,7 +3707,9 @@  discard block
 block discarded – undo
3501 3707
 			} else {
3502 3708
 				$timeelapsed = microtime(true);
3503 3709
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3504
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3710
+				if ($globalDebugTimeElapsed) {
3711
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3712
+				}
3505 3713
 			}
3506 3714
 		}
3507 3715
 		
@@ -3516,7 +3724,9 @@  discard block
 block discarded – undo
3516 3724
 			} else {
3517 3725
 				$timeelapsed = microtime(true);
3518 3726
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3519
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3727
+				if ($globalDebugTimeElapsed) {
3728
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3729
+				}
3520 3730
 			}
3521 3731
 		}
3522 3732
 
@@ -3550,7 +3760,9 @@  discard block
 block discarded – undo
3550 3760
 			{
3551 3761
 				return false;
3552 3762
 			}
3553
-		} else $altitude = 0;
3763
+		} else {
3764
+			$altitude = 0;
3765
+		}
3554 3766
 		
3555 3767
 		if ($heading != "")
3556 3768
 		{
@@ -3579,7 +3791,9 @@  discard block
 block discarded – undo
3579 3791
 		{
3580 3792
 			$timeelapsed = microtime(true);
3581 3793
 			$image_array = $Image->getSpotterImage($registration);
3582
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3794
+			if ($globalDebugTimeElapsed) {
3795
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3796
+			}
3583 3797
 			if (!isset($image_array[0]['registration']))
3584 3798
 			{
3585 3799
 				//echo "Add image !!!! \n";
@@ -3587,14 +3801,21 @@  discard block
 block discarded – undo
3587 3801
 			}
3588 3802
 			$timeelapsed = microtime(true);
3589 3803
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3590
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3591
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3804
+			if ($globalDebugTimeElapsed) {
3805
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3806
+			}
3807
+			if ($owner_info['owner'] != '') {
3808
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3809
+			}
3592 3810
 		}
3593 3811
     
3594 3812
 		if ($globalIVAO && $aircraft_icao != '')
3595 3813
 		{
3596
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3597
-            		else $airline_icao = '';
3814
+            		if (isset($airline_array[0]['icao'])) {
3815
+            			$airline_icao = $airline_array[0]['icao'];
3816
+            		} else {
3817
+            			$airline_icao = '';
3818
+            		}
3598 3819
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3599 3820
 			if (!isset($image_array[0]['registration']))
3600 3821
 			{
@@ -3639,16 +3860,28 @@  discard block
 block discarded – undo
3639 3860
                 {
3640 3861
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3641 3862
                 }
3642
-                if ($registration == '') $registration = 'NA';
3863
+                if ($registration == '') {
3864
+                	$registration = 'NA';
3865
+                }
3643 3866
                 if ($latitude == '' && $longitude == '') {
3644 3867
             		$latitude = 0;
3645 3868
             		$longitude = 0;
3646 3869
             	}
3647
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3648
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3649
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3650
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3651
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3870
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3871
+                	$squawk = NULL;
3872
+                }
3873
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3874
+                	$verticalrate = NULL;
3875
+                }
3876
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3877
+                	$heading = 0;
3878
+                }
3879
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3880
+                	$groundspeed = 0;
3881
+                }
3882
+                if (!isset($aircraft_owner)) {
3883
+                	$aircraft_owner = NULL;
3884
+                }
3652 3885
                 $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) 
3653 3886
                 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)";
3654 3887
 
@@ -3659,9 +3892,13 @@  discard block
 block discarded – undo
3659 3892
 		if ($airline_type == '') {
3660 3893
 			$timeelapsed = microtime(true);
3661 3894
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3662
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3895
+			if ($globalDebugTimeElapsed) {
3896
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3897
+			}
3898
+		}
3899
+		if ($airline_type == null) {
3900
+			$airline_type = '';
3663 3901
 		}
3664
-		if ($airline_type == null) $airline_type = '';
3665 3902
                 $aircraft_type = $aircraft_array[0]['type'];
3666 3903
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3667 3904
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3797,7 +4034,9 @@  discard block
 block discarded – undo
3797 4034
 			}
3798 4035
 		}
3799 4036
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3800
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4037
+		if ($limit) {
4038
+			$query .= " LIMIT 10 OFFSET 0";
4039
+		}
3801 4040
 		
3802 4041
 		$sth = $this->db->prepare($query);
3803 4042
 		$sth->execute();
@@ -3842,7 +4081,9 @@  discard block
 block discarded – undo
3842 4081
 			}
3843 4082
 		}
3844 4083
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3845
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4084
+		if ($limit) {
4085
+			$query .= " LIMIT 10 OFFSET 0";
4086
+		}
3846 4087
       
3847 4088
 		
3848 4089
 		$sth = $this->db->prepare($query);
@@ -3888,7 +4129,9 @@  discard block
 block discarded – undo
3888 4129
 			}
3889 4130
 		}
3890 4131
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3891
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4132
+		if ($limit) {
4133
+			$query .= " LIMIT 10 OFFSET 0";
4134
+		}
3892 4135
       
3893 4136
 		
3894 4137
 		$sth = $this->db->prepare($query);
@@ -3936,7 +4179,9 @@  discard block
 block discarded – undo
3936 4179
 			}
3937 4180
 		}
3938 4181
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3939
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4182
+		if ($limit) {
4183
+			$query .= " LIMIT 10 OFFSET 0";
4184
+		}
3940 4185
       
3941 4186
 		
3942 4187
 		$sth = $this->db->prepare($query);
@@ -3981,7 +4226,9 @@  discard block
 block discarded – undo
3981 4226
 			}
3982 4227
 		}
3983 4228
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3984
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4229
+		if ($limit) {
4230
+			$query .= " LIMIT 10 OFFSET 0";
4231
+		}
3985 4232
       
3986 4233
 		
3987 4234
 		$sth = $this->db->prepare($query);
@@ -4224,7 +4471,9 @@  discard block
 block discarded – undo
4224 4471
 			date_default_timezone_set($globalTimezone);
4225 4472
 			$datetime = new DateTime($date);
4226 4473
 			$offset = $datetime->format('P');
4227
-		} else $offset = '+00:00';
4474
+		} else {
4475
+			$offset = '+00:00';
4476
+		}
4228 4477
 
4229 4478
 		if ($globalDBdriver == 'mysql') {
4230 4479
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4272,7 +4521,9 @@  discard block
 block discarded – undo
4272 4521
 			date_default_timezone_set($globalTimezone);
4273 4522
 			$datetime = new DateTime($date);
4274 4523
 			$offset = $datetime->format('P');
4275
-		} else $offset = '+00:00';
4524
+		} else {
4525
+			$offset = '+00:00';
4526
+		}
4276 4527
 		
4277 4528
 		if ($globalDBdriver == 'mysql') {
4278 4529
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4490,7 +4741,9 @@  discard block
 block discarded – undo
4490 4741
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4491 4742
 					GROUP BY spotter_output.airline_country
4492 4743
 					ORDER BY airline_country_count DESC";
4493
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4744
+		if ($limit) {
4745
+			$query .= " LIMIT 10 OFFSET 0";
4746
+		}
4494 4747
       
4495 4748
 		$sth = $this->db->prepare($query);
4496 4749
 		$sth->execute();
@@ -4518,7 +4771,9 @@  discard block
 block discarded – undo
4518 4771
 		global $globalDBdriver;
4519 4772
 		//$filter_query = $this->getFilter($filters,true,true);
4520 4773
 		$Connection= new Connection($this->db);
4521
-		if (!$Connection->tableExists('countries')) return array();
4774
+		if (!$Connection->tableExists('countries')) {
4775
+			return array();
4776
+		}
4522 4777
 		/*
4523 4778
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4524 4779
 					FROM countries c, spotter_output s
@@ -4550,7 +4805,9 @@  discard block
 block discarded – undo
4550 4805
 		}
4551 4806
 		$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 ";
4552 4807
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4553
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4808
+		if ($limit) {
4809
+			$query .= " LIMIT 10 OFFSET 0";
4810
+		}
4554 4811
       
4555 4812
 		
4556 4813
 		$sth = $this->db->prepare($query);
@@ -4600,7 +4857,9 @@  discard block
 block discarded – undo
4600 4857
 		}
4601 4858
 
4602 4859
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4603
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4860
+		if ($limit) {
4861
+			$query .= " LIMIT 10 OFFSET 0";
4862
+		}
4604 4863
  
4605 4864
 		$sth = $this->db->prepare($query);
4606 4865
 		$sth->execute();
@@ -4646,7 +4905,9 @@  discard block
 block discarded – undo
4646 4905
 		}
4647 4906
 
4648 4907
 		$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";
4649
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4908
+		if ($limit) {
4909
+			$query .= " LIMIT 10 OFFSET 0";
4910
+		}
4650 4911
  
4651 4912
 		$sth = $this->db->prepare($query);
4652 4913
 		$sth->execute();
@@ -4693,7 +4954,9 @@  discard block
 block discarded – undo
4693 4954
 		}
4694 4955
 
4695 4956
 		$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";
4696
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4957
+		if ($limit) {
4958
+			$query .= " LIMIT 10 OFFSET 0";
4959
+		}
4697 4960
  
4698 4961
 		$sth = $this->db->prepare($query);
4699 4962
 		$sth->execute();
@@ -4746,7 +5009,9 @@  discard block
 block discarded – undo
4746 5009
 			if($row['registration'] != "")
4747 5010
 			{
4748 5011
 				$image_array = $Image->getSpotterImage($row['registration']);
4749
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5012
+				if (isset($image_array[0]['image_thumbnail'])) {
5013
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5014
+				}
4750 5015
 			}
4751 5016
 			$temp_array['registration_count'] = $row['registration_count'];
4752 5017
 
@@ -4821,7 +5086,9 @@  discard block
 block discarded – undo
4821 5086
 			if($row['registration'] != "")
4822 5087
 			{
4823 5088
 				$image_array = $Image->getSpotterImage($row['registration']);
4824
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5089
+				if (isset($image_array[0]['image_thumbnail'])) {
5090
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5091
+				}
4825 5092
 			}
4826 5093
 			$temp_array['registration_count'] = $row['registration_count'];
4827 5094
 
@@ -4928,7 +5195,9 @@  discard block
 block discarded – undo
4928 5195
 			if($row['registration'] != "")
4929 5196
 			{
4930 5197
 				$image_array = $Image->getSpotterImage($row['registration']);
4931
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5198
+				if (isset($image_array[0]['image_thumbnail'])) {
5199
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5200
+				}
4932 5201
 			}
4933 5202
 			$temp_array['registration_count'] = $row['registration_count'];
4934 5203
 			$aircraft_array[] = $temp_array;
@@ -5053,7 +5322,9 @@  discard block
 block discarded – undo
5053 5322
 			date_default_timezone_set($globalTimezone);
5054 5323
 			$datetime = new DateTime($date);
5055 5324
 			$offset = $datetime->format('P');
5056
-		} else $offset = '+00:00';
5325
+		} else {
5326
+			$offset = '+00:00';
5327
+		}
5057 5328
 
5058 5329
 		if ($globalDBdriver == 'mysql') {
5059 5330
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5100,7 +5371,9 @@  discard block
 block discarded – undo
5100 5371
 			date_default_timezone_set($globalTimezone);
5101 5372
 			$datetime = new DateTime($date);
5102 5373
 			$offset = $datetime->format('P');
5103
-		} else $offset = '+00:00';
5374
+		} else {
5375
+			$offset = '+00:00';
5376
+		}
5104 5377
 
5105 5378
 		if ($globalDBdriver == 'mysql') {
5106 5379
 			$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 
@@ -5129,7 +5402,9 @@  discard block
 block discarded – undo
5129 5402
 			if($row['registration'] != "")
5130 5403
 			{
5131 5404
 				$image_array = $Image->getSpotterImage($row['registration']);
5132
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5405
+				if (isset($image_array[0]['image_thumbnail'])) {
5406
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5407
+				}
5133 5408
 			}
5134 5409
 			$temp_array['registration_count'] = $row['registration_count'];
5135 5410
  
@@ -5154,7 +5429,9 @@  discard block
 block discarded – undo
5154 5429
 			date_default_timezone_set($globalTimezone);
5155 5430
 			$datetime = new DateTime($date);
5156 5431
 			$offset = $datetime->format('P');
5157
-		} else $offset = '+00:00';
5432
+		} else {
5433
+			$offset = '+00:00';
5434
+		}
5158 5435
 
5159 5436
 		if ($globalDBdriver == 'mysql') {
5160 5437
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5252,8 +5529,11 @@  discard block
 block discarded – undo
5252 5529
 			if($row['registration'] != "")
5253 5530
 			{
5254 5531
 				$image_array = $Image->getSpotterImage($row['registration']);
5255
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5256
-				else $temp_array['image_thumbnail'] = '';
5532
+				if (isset($image_array[0]['image_thumbnail'])) {
5533
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5534
+				} else {
5535
+					$temp_array['image_thumbnail'] = '';
5536
+				}
5257 5537
 			}
5258 5538
 			$temp_array['registration_count'] = $row['registration_count'];
5259 5539
 			$aircraft_array[] = $temp_array;
@@ -5360,7 +5640,9 @@  discard block
 block discarded – undo
5360 5640
 			if($row['registration'] != "")
5361 5641
 			{
5362 5642
 				$image_array = $Image->getSpotterImage($row['registration']);
5363
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5643
+				if (isset($image_array[0]['image_thumbnail'])) {
5644
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5645
+				}
5364 5646
 			}
5365 5647
 			$temp_array['registration_count'] = $row['registration_count'];
5366 5648
           
@@ -5477,7 +5759,9 @@  discard block
 block discarded – undo
5477 5759
 			if($row['registration'] != "")
5478 5760
 			{
5479 5761
 				$image_array = $Image->getSpotterImage($row['registration']);
5480
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5762
+				if (isset($image_array[0]['image_thumbnail'])) {
5763
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5764
+				}
5481 5765
 			}
5482 5766
 			$temp_array['registration_count'] = $row['registration_count'];
5483 5767
           
@@ -5589,7 +5873,9 @@  discard block
 block discarded – undo
5589 5873
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5590 5874
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5591 5875
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5592
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5876
+		if ($limit) {
5877
+			$query .= " LIMIT 10 OFFSET 0";
5878
+		}
5593 5879
 		
5594 5880
 		$sth = $this->db->prepare($query);
5595 5881
 		$sth->execute();
@@ -5608,7 +5894,9 @@  discard block
 block discarded – undo
5608 5894
 			if($row['registration'] != "")
5609 5895
 			{
5610 5896
 				$image_array = $Image->getSpotterImage($row['registration']);
5611
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5897
+				if (isset($image_array[0]['image_thumbnail'])) {
5898
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5899
+				}
5612 5900
 			}
5613 5901
           
5614 5902
 			$aircraft_array[] = $temp_array;
@@ -5649,7 +5937,9 @@  discard block
 block discarded – undo
5649 5937
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5650 5938
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5651 5939
                 $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";
5652
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5940
+		if ($limit) {
5941
+			$query .= " LIMIT 10 OFFSET 0";
5942
+		}
5653 5943
 		
5654 5944
 		$sth = $this->db->prepare($query);
5655 5945
 		$sth->execute();
@@ -5669,7 +5959,9 @@  discard block
 block discarded – undo
5669 5959
 			if($row['registration'] != "")
5670 5960
 			{
5671 5961
 				$image_array = $Image->getSpotterImage($row['registration']);
5672
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5962
+				if (isset($image_array[0]['image_thumbnail'])) {
5963
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5964
+				}
5673 5965
 			}
5674 5966
           
5675 5967
 			$aircraft_array[] = $temp_array;
@@ -5710,7 +6002,9 @@  discard block
 block discarded – undo
5710 6002
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5711 6003
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5712 6004
 				ORDER BY airport_departure_icao_count DESC";
5713
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6005
+		if ($limit) {
6006
+			$query .= " LIMIT 10 OFFSET 0";
6007
+		}
5714 6008
       
5715 6009
 		$sth = $this->db->prepare($query);
5716 6010
 		$sth->execute();
@@ -5762,7 +6056,9 @@  discard block
 block discarded – undo
5762 6056
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5763 6057
                 $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
5764 6058
 				ORDER BY airport_departure_icao_count DESC";
5765
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6059
+		if ($limit) {
6060
+			$query .= " LIMIT 10 OFFSET 0";
6061
+		}
5766 6062
       
5767 6063
 		$sth = $this->db->prepare($query);
5768 6064
 		$sth->execute();
@@ -5814,7 +6110,9 @@  discard block
 block discarded – undo
5814 6110
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5815 6111
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5816 6112
 				ORDER BY airport_departure_icao_count DESC";
5817
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6113
+		if ($limit) {
6114
+			$query .= " LIMIT 10 OFFSET 0";
6115
+		}
5818 6116
     		//echo $query;
5819 6117
 		$sth = $this->db->prepare($query);
5820 6118
 		$sth->execute();
@@ -5866,7 +6164,9 @@  discard block
 block discarded – undo
5866 6164
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5867 6165
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5868 6166
 				ORDER BY airport_departure_icao_count DESC";
5869
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6167
+		if ($limit) {
6168
+			$query .= " LIMIT 10 OFFSET 0";
6169
+		}
5870 6170
       
5871 6171
 		$sth = $this->db->prepare($query);
5872 6172
 		$sth->execute();
@@ -6261,7 +6561,9 @@  discard block
 block discarded – undo
6261 6561
 			date_default_timezone_set($globalTimezone);
6262 6562
 			$datetime = new DateTime($date);
6263 6563
 			$offset = $datetime->format('P');
6264
-		} else $offset = '+00:00';
6564
+		} else {
6565
+			$offset = '+00:00';
6566
+		}
6265 6567
 
6266 6568
 		if ($globalDBdriver == 'mysql') {
6267 6569
 			$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 
@@ -6311,7 +6613,9 @@  discard block
 block discarded – undo
6311 6613
 			date_default_timezone_set($globalTimezone);
6312 6614
 			$datetime = new DateTime($date);
6313 6615
 			$offset = $datetime->format('P');
6314
-		} else $offset = '+00:00';
6616
+		} else {
6617
+			$offset = '+00:00';
6618
+		}
6315 6619
 
6316 6620
 		if ($globalDBdriver == 'mysql') {
6317 6621
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6524,7 +6828,9 @@  discard block
 block discarded – undo
6524 6828
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6525 6829
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6526 6830
 					ORDER BY airport_arrival_icao_count DESC";
6527
-		if ($limit) $query .= " LIMIT 10";
6831
+		if ($limit) {
6832
+			$query .= " LIMIT 10";
6833
+		}
6528 6834
       
6529 6835
 		
6530 6836
 		$sth = $this->db->prepare($query);
@@ -6544,7 +6850,9 @@  discard block
 block discarded – undo
6544 6850
 			if ($icaoaskey) {
6545 6851
 				$icao = $row['arrival_airport_icao'];
6546 6852
 				$airport_array[$icao] = $temp_array;
6547
-			} else $airport_array[] = $temp_array;
6853
+			} else {
6854
+				$airport_array[] = $temp_array;
6855
+			}
6548 6856
 		}
6549 6857
 
6550 6858
 		return $airport_array;
@@ -6581,7 +6889,9 @@  discard block
 block discarded – undo
6581 6889
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6582 6890
                 $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
6583 6891
 					ORDER BY airport_arrival_icao_count DESC";
6584
-		if ($limit) $query .= " LIMIT 10";
6892
+		if ($limit) {
6893
+			$query .= " LIMIT 10";
6894
+		}
6585 6895
       
6586 6896
 		
6587 6897
 		$sth = $this->db->prepare($query);
@@ -6602,7 +6912,9 @@  discard block
 block discarded – undo
6602 6912
 			if ($icaoaskey) {
6603 6913
 				$icao = $row['arrival_airport_icao'];
6604 6914
 				$airport_array[$icao] = $temp_array;
6605
-			} else $airport_array[] = $temp_array;
6915
+			} else {
6916
+				$airport_array[] = $temp_array;
6917
+			}
6606 6918
 		}
6607 6919
 
6608 6920
 		return $airport_array;
@@ -6639,7 +6951,9 @@  discard block
 block discarded – undo
6639 6951
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6640 6952
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6641 6953
 					ORDER BY airport_arrival_icao_count DESC";
6642
-		if ($limit) $query .= " LIMIT 10";
6954
+		if ($limit) {
6955
+			$query .= " LIMIT 10";
6956
+		}
6643 6957
       
6644 6958
 		
6645 6959
 		$sth = $this->db->prepare($query);
@@ -6659,7 +6973,9 @@  discard block
 block discarded – undo
6659 6973
 			if ($icaoaskey) {
6660 6974
 				$icao = $row['arrival_airport_icao'];
6661 6975
 				$airport_array[$icao] = $temp_array;
6662
-			} else $airport_array[] = $temp_array;
6976
+			} else {
6977
+				$airport_array[] = $temp_array;
6978
+			}
6663 6979
 		}
6664 6980
 
6665 6981
 		return $airport_array;
@@ -6696,7 +7012,9 @@  discard block
 block discarded – undo
6696 7012
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6697 7013
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6698 7014
 					ORDER BY airport_arrival_icao_count DESC";
6699
-		if ($limit) $query .= " LIMIT 10";
7015
+		if ($limit) {
7016
+			$query .= " LIMIT 10";
7017
+		}
6700 7018
       
6701 7019
 		
6702 7020
 		$sth = $this->db->prepare($query);
@@ -6717,7 +7035,9 @@  discard block
 block discarded – undo
6717 7035
 			if ($icaoaskey) {
6718 7036
 				$icao = $row['arrival_airport_icao'];
6719 7037
 				$airport_array[$icao] = $temp_array;
6720
-			} else $airport_array[] = $temp_array;
7038
+			} else {
7039
+				$airport_array[] = $temp_array;
7040
+			}
6721 7041
 		}
6722 7042
 
6723 7043
 		return $airport_array;
@@ -7098,7 +7418,9 @@  discard block
 block discarded – undo
7098 7418
 			date_default_timezone_set($globalTimezone);
7099 7419
 			$datetime = new DateTime($date);
7100 7420
 			$offset = $datetime->format('P');
7101
-		} else $offset = '+00:00';
7421
+		} else {
7422
+			$offset = '+00:00';
7423
+		}
7102 7424
 
7103 7425
 		if ($globalDBdriver == 'mysql') {
7104 7426
 			$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 
@@ -7148,7 +7470,9 @@  discard block
 block discarded – undo
7148 7470
 			date_default_timezone_set($globalTimezone);
7149 7471
 			$datetime = new DateTime($date);
7150 7472
 			$offset = $datetime->format('P');
7151
-		} else $offset = '+00:00';
7473
+		} else {
7474
+			$offset = '+00:00';
7475
+		}
7152 7476
 
7153 7477
 		if ($globalDBdriver == 'mysql') {
7154 7478
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7371,7 +7695,9 @@  discard block
 block discarded – undo
7371 7695
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7372 7696
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7373 7697
 					ORDER BY airport_arrival_country_count DESC";
7374
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7698
+		if ($limit) {
7699
+			$query .= " LIMIT 10 OFFSET 0";
7700
+		}
7375 7701
       
7376 7702
 		
7377 7703
 		$sth = $this->db->prepare($query);
@@ -7658,7 +7984,9 @@  discard block
 block discarded – undo
7658 7984
 			date_default_timezone_set($globalTimezone);
7659 7985
 			$datetime = new DateTime($date);
7660 7986
 			$offset = $datetime->format('P');
7661
-		} else $offset = '+00:00';
7987
+		} else {
7988
+			$offset = '+00:00';
7989
+		}
7662 7990
 		
7663 7991
 		if ($globalDBdriver == 'mysql') {
7664 7992
 			$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
@@ -7834,15 +8162,23 @@  discard block
 block discarded – undo
7834 8162
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7835 8163
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7836 8164
 		 if ($olderthanmonths > 0) {
7837
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7838
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8165
+			if ($globalDBdriver == 'mysql') {
8166
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8167
+			} else {
8168
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8169
+			}
7839 8170
 		}
7840 8171
 		if ($sincedate != '') {
7841
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7842
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8172
+			if ($globalDBdriver == 'mysql') {
8173
+				$query .= " AND spotter_output.date > '".$sincedate."'";
8174
+			} else {
8175
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8176
+			}
7843 8177
 		}
7844 8178
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7845
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8179
+		if ($limit) {
8180
+			$query .= " LIMIT 10 OFFSET 0";
8181
+		}
7846 8182
       		
7847 8183
 		$sth = $this->db->prepare($query);
7848 8184
 		$sth->execute();
@@ -7876,15 +8212,23 @@  discard block
 block discarded – undo
7876 8212
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7877 8213
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7878 8214
 		 if ($olderthanmonths > 0) {
7879
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7880
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8215
+			if ($globalDBdriver == 'mysql') {
8216
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8217
+			} else {
8218
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8219
+			}
7881 8220
 		}
7882 8221
 		if ($sincedate != '') {
7883
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7884
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8222
+			if ($globalDBdriver == 'mysql') {
8223
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8224
+			} else {
8225
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8226
+			}
7885 8227
 		}
7886 8228
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7887
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8229
+		if ($limit) {
8230
+			$query .= " LIMIT 10 OFFSET 0";
8231
+		}
7888 8232
       		
7889 8233
 		$sth = $this->db->prepare($query);
7890 8234
 		$sth->execute();
@@ -7921,7 +8265,9 @@  discard block
 block discarded – undo
7921 8265
 			date_default_timezone_set($globalTimezone);
7922 8266
 			$datetime = new DateTime();
7923 8267
 			$offset = $datetime->format('P');
7924
-		} else $offset = '+00:00';
8268
+		} else {
8269
+			$offset = '+00:00';
8270
+		}
7925 8271
 
7926 8272
 		if ($globalDBdriver == 'mysql') {
7927 8273
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7970,7 +8316,9 @@  discard block
 block discarded – undo
7970 8316
 			date_default_timezone_set($globalTimezone);
7971 8317
 			$datetime = new DateTime();
7972 8318
 			$offset = $datetime->format('P');
7973
-		} else $offset = '+00:00';
8319
+		} else {
8320
+			$offset = '+00:00';
8321
+		}
7974 8322
 		$filter_query = $this->getFilter($filters,true,true);
7975 8323
 		if ($globalDBdriver == 'mysql') {
7976 8324
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8019,7 +8367,9 @@  discard block
 block discarded – undo
8019 8367
 			date_default_timezone_set($globalTimezone);
8020 8368
 			$datetime = new DateTime();
8021 8369
 			$offset = $datetime->format('P');
8022
-		} else $offset = '+00:00';
8370
+		} else {
8371
+			$offset = '+00:00';
8372
+		}
8023 8373
 		$filter_query = $this->getFilter($filters,true,true);
8024 8374
 		if ($globalDBdriver == 'mysql') {
8025 8375
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8065,7 +8415,9 @@  discard block
 block discarded – undo
8065 8415
 			date_default_timezone_set($globalTimezone);
8066 8416
 			$datetime = new DateTime();
8067 8417
 			$offset = $datetime->format('P');
8068
-		} else $offset = '+00:00';
8418
+		} else {
8419
+			$offset = '+00:00';
8420
+		}
8069 8421
 		$filter_query = $this->getFilter($filters,true,true);
8070 8422
 		if ($globalDBdriver == 'mysql') {
8071 8423
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8113,7 +8465,9 @@  discard block
 block discarded – undo
8113 8465
 			date_default_timezone_set($globalTimezone);
8114 8466
 			$datetime = new DateTime();
8115 8467
 			$offset = $datetime->format('P');
8116
-		} else $offset = '+00:00';
8468
+		} else {
8469
+			$offset = '+00:00';
8470
+		}
8117 8471
 		
8118 8472
 		if ($globalDBdriver == 'mysql') {
8119 8473
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8161,7 +8515,9 @@  discard block
 block discarded – undo
8161 8515
 			date_default_timezone_set($globalTimezone);
8162 8516
 			$datetime = new DateTime();
8163 8517
 			$offset = $datetime->format('P');
8164
-		} else $offset = '+00:00';
8518
+		} else {
8519
+			$offset = '+00:00';
8520
+		}
8165 8521
 
8166 8522
 		if ($globalDBdriver == 'mysql') {
8167 8523
 			$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
@@ -8208,7 +8564,9 @@  discard block
 block discarded – undo
8208 8564
 			date_default_timezone_set($globalTimezone);
8209 8565
 			$datetime = new DateTime();
8210 8566
 			$offset = $datetime->format('P');
8211
-		} else $offset = '+00:00';
8567
+		} else {
8568
+			$offset = '+00:00';
8569
+		}
8212 8570
 
8213 8571
 		if ($globalDBdriver == 'mysql') {
8214 8572
 			$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
@@ -8256,7 +8614,9 @@  discard block
 block discarded – undo
8256 8614
 			date_default_timezone_set($globalTimezone);
8257 8615
 			$datetime = new DateTime();
8258 8616
 			$offset = $datetime->format('P');
8259
-		} else $offset = '+00:00';
8617
+		} else {
8618
+			$offset = '+00:00';
8619
+		}
8260 8620
 		$filter_query = $this->getFilter($filters,true,true);
8261 8621
 		if ($globalDBdriver == 'mysql') {
8262 8622
 			$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
@@ -8301,7 +8661,9 @@  discard block
 block discarded – undo
8301 8661
 			date_default_timezone_set($globalTimezone);
8302 8662
 			$datetime = new DateTime();
8303 8663
 			$offset = $datetime->format('P');
8304
-		} else $offset = '+00:00';
8664
+		} else {
8665
+			$offset = '+00:00';
8666
+		}
8305 8667
 		$filter_query = $this->getFilter($filters,true,true);
8306 8668
 
8307 8669
 		if ($globalDBdriver == 'mysql') {
@@ -8348,7 +8710,9 @@  discard block
 block discarded – undo
8348 8710
 			date_default_timezone_set($globalTimezone);
8349 8711
 			$datetime = new DateTime();
8350 8712
 			$offset = $datetime->format('P');
8351
-		} else $offset = '+00:00';
8713
+		} else {
8714
+			$offset = '+00:00';
8715
+		}
8352 8716
 
8353 8717
 		if ($globalDBdriver == 'mysql') {
8354 8718
 			$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
@@ -8394,7 +8758,9 @@  discard block
 block discarded – undo
8394 8758
 			date_default_timezone_set($globalTimezone);
8395 8759
 			$datetime = new DateTime();
8396 8760
 			$offset = $datetime->format('P');
8397
-		} else $offset = '+00:00';
8761
+		} else {
8762
+			$offset = '+00:00';
8763
+		}
8398 8764
 		$filter_query = $this->getFilter($filters,true,true);
8399 8765
 
8400 8766
 		if ($globalDBdriver == 'mysql') {
@@ -8441,7 +8807,9 @@  discard block
 block discarded – undo
8441 8807
 			date_default_timezone_set($globalTimezone);
8442 8808
 			$datetime = new DateTime();
8443 8809
 			$offset = $datetime->format('P');
8444
-		} else $offset = '+00:00';
8810
+		} else {
8811
+			$offset = '+00:00';
8812
+		}
8445 8813
 
8446 8814
 		if ($globalDBdriver == 'mysql') {
8447 8815
 			$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
@@ -8488,7 +8856,9 @@  discard block
 block discarded – undo
8488 8856
 			date_default_timezone_set($globalTimezone);
8489 8857
 			$datetime = new DateTime();
8490 8858
 			$offset = $datetime->format('P');
8491
-		} else $offset = '+00:00';
8859
+		} else {
8860
+			$offset = '+00:00';
8861
+		}
8492 8862
 
8493 8863
 		if ($globalDBdriver == 'mysql') {
8494 8864
 			$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
@@ -8533,7 +8903,9 @@  discard block
 block discarded – undo
8533 8903
 			date_default_timezone_set($globalTimezone);
8534 8904
 			$datetime = new DateTime();
8535 8905
 			$offset = $datetime->format('P');
8536
-		} else $offset = '+00:00';
8906
+		} else {
8907
+			$offset = '+00:00';
8908
+		}
8537 8909
 		$filter_query = $this->getFilter($filters,true,true);
8538 8910
 
8539 8911
 		if ($globalDBdriver == 'mysql') {
@@ -8581,7 +8953,9 @@  discard block
 block discarded – undo
8581 8953
 			date_default_timezone_set($globalTimezone);
8582 8954
 			$datetime = new DateTime();
8583 8955
 			$offset = $datetime->format('P');
8584
-		} else $offset = '+00:00';
8956
+		} else {
8957
+			$offset = '+00:00';
8958
+		}
8585 8959
 
8586 8960
 		if ($globalDBdriver == 'mysql') {
8587 8961
 			$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
@@ -8627,7 +9001,9 @@  discard block
 block discarded – undo
8627 9001
 			date_default_timezone_set($globalTimezone);
8628 9002
 			$datetime = new DateTime();
8629 9003
 			$offset = $datetime->format('P');
8630
-		} else $offset = '+00:00';
9004
+		} else {
9005
+			$offset = '+00:00';
9006
+		}
8631 9007
 		$filter_query = $this->getFilter($filters,true,true);
8632 9008
 
8633 9009
 		if ($globalDBdriver == 'mysql') {
@@ -8675,7 +9051,9 @@  discard block
 block discarded – undo
8675 9051
 			date_default_timezone_set($globalTimezone);
8676 9052
 			$datetime = new DateTime();
8677 9053
 			$offset = $datetime->format('P');
8678
-		} else $offset = '+00:00';
9054
+		} else {
9055
+			$offset = '+00:00';
9056
+		}
8679 9057
 
8680 9058
 		if ($globalDBdriver == 'mysql') {
8681 9059
 			$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
@@ -8722,7 +9100,9 @@  discard block
 block discarded – undo
8722 9100
 			date_default_timezone_set($globalTimezone);
8723 9101
 			$datetime = new DateTime();
8724 9102
 			$offset = $datetime->format('P');
8725
-		} else $offset = '+00:00';
9103
+		} else {
9104
+			$offset = '+00:00';
9105
+		}
8726 9106
 		$filter_query = $this->getFilter($filters,true,true);
8727 9107
 		if ($globalDBdriver == 'mysql') {
8728 9108
 			$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
@@ -8771,7 +9151,9 @@  discard block
 block discarded – undo
8771 9151
 			date_default_timezone_set($globalTimezone);
8772 9152
 			$datetime = new DateTime();
8773 9153
 			$offset = $datetime->format('P');
8774
-		} else $offset = '+00:00';
9154
+		} else {
9155
+			$offset = '+00:00';
9156
+		}
8775 9157
 
8776 9158
 		$orderby_sql = '';
8777 9159
 		if ($orderby == "hour")
@@ -8837,7 +9219,9 @@  discard block
 block discarded – undo
8837 9219
 			date_default_timezone_set($globalTimezone);
8838 9220
 			$datetime = new DateTime();
8839 9221
 			$offset = $datetime->format('P');
8840
-		} else $offset = '+00:00';
9222
+		} else {
9223
+			$offset = '+00:00';
9224
+		}
8841 9225
 
8842 9226
 		$orderby_sql = '';
8843 9227
 		if ($orderby == "hour")
@@ -8904,7 +9288,9 @@  discard block
 block discarded – undo
8904 9288
 			date_default_timezone_set($globalTimezone);
8905 9289
 			$datetime = new DateTime();
8906 9290
 			$offset = $datetime->format('P');
8907
-		} else $offset = '+00:00';
9291
+		} else {
9292
+			$offset = '+00:00';
9293
+		}
8908 9294
 
8909 9295
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8910 9296
 
@@ -8955,7 +9341,9 @@  discard block
 block discarded – undo
8955 9341
 			date_default_timezone_set($globalTimezone);
8956 9342
 			$datetime = new DateTime();
8957 9343
 			$offset = $datetime->format('P');
8958
-		} else $offset = '+00:00';
9344
+		} else {
9345
+			$offset = '+00:00';
9346
+		}
8959 9347
 
8960 9348
 		if ($globalDBdriver == 'mysql') {
8961 9349
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9002,7 +9390,9 @@  discard block
 block discarded – undo
9002 9390
 			date_default_timezone_set($globalTimezone);
9003 9391
 			$datetime = new DateTime();
9004 9392
 			$offset = $datetime->format('P');
9005
-		} else $offset = '+00:00';
9393
+		} else {
9394
+			$offset = '+00:00';
9395
+		}
9006 9396
 
9007 9397
 		if ($globalDBdriver == 'mysql') {
9008 9398
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9049,7 +9439,9 @@  discard block
 block discarded – undo
9049 9439
 			date_default_timezone_set($globalTimezone);
9050 9440
 			$datetime = new DateTime();
9051 9441
 			$offset = $datetime->format('P');
9052
-		} else $offset = '+00:00';
9442
+		} else {
9443
+			$offset = '+00:00';
9444
+		}
9053 9445
 
9054 9446
 		if ($globalDBdriver == 'mysql') {
9055 9447
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9097,7 +9489,9 @@  discard block
 block discarded – undo
9097 9489
 			date_default_timezone_set($globalTimezone);
9098 9490
 			$datetime = new DateTime();
9099 9491
 			$offset = $datetime->format('P');
9100
-		} else $offset = '+00:00';
9492
+		} else {
9493
+			$offset = '+00:00';
9494
+		}
9101 9495
 
9102 9496
 		if ($globalDBdriver == 'mysql') {
9103 9497
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9145,7 +9539,9 @@  discard block
 block discarded – undo
9145 9539
 			date_default_timezone_set($globalTimezone);
9146 9540
 			$datetime = new DateTime($date);
9147 9541
 			$offset = $datetime->format('P');
9148
-		} else $offset = '+00:00';
9542
+		} else {
9543
+			$offset = '+00:00';
9544
+		}
9149 9545
 
9150 9546
 		if ($globalDBdriver == 'mysql') {
9151 9547
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9193,7 +9589,9 @@  discard block
 block discarded – undo
9193 9589
 			date_default_timezone_set($globalTimezone);
9194 9590
 			$datetime = new DateTime();
9195 9591
 			$offset = $datetime->format('P');
9196
-		} else $offset = '+00:00';
9592
+		} else {
9593
+			$offset = '+00:00';
9594
+		}
9197 9595
 
9198 9596
 		if ($globalDBdriver == 'mysql') {
9199 9597
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9243,7 +9641,9 @@  discard block
 block discarded – undo
9243 9641
 			date_default_timezone_set($globalTimezone);
9244 9642
 			$datetime = new DateTime();
9245 9643
 			$offset = $datetime->format('P');
9246
-		} else $offset = '+00:00';
9644
+		} else {
9645
+			$offset = '+00:00';
9646
+		}
9247 9647
 
9248 9648
 		if ($globalDBdriver == 'mysql') {
9249 9649
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9290,7 +9690,9 @@  discard block
 block discarded – undo
9290 9690
 			date_default_timezone_set($globalTimezone);
9291 9691
 			$datetime = new DateTime();
9292 9692
 			$offset = $datetime->format('P');
9293
-		} else $offset = '+00:00';
9693
+		} else {
9694
+			$offset = '+00:00';
9695
+		}
9294 9696
 
9295 9697
 		if ($globalDBdriver == 'mysql') {
9296 9698
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9458,7 +9860,9 @@  discard block
 block discarded – undo
9458 9860
 			date_default_timezone_set($globalTimezone);
9459 9861
 			$datetime = new DateTime();
9460 9862
 			$offset = $datetime->format('P');
9461
-		} else $offset = '+00:00';
9863
+		} else {
9864
+			$offset = '+00:00';
9865
+		}
9462 9866
 
9463 9867
 		if ($globalDBdriver == 'mysql') {
9464 9868
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9644,7 +10048,9 @@  discard block
 block discarded – undo
9644 10048
 	*/
9645 10049
 	public function parseDirection($direction = 0)
9646 10050
 	{
9647
-		if ($direction == '') $direction = 0;
10051
+		if ($direction == '') {
10052
+			$direction = 0;
10053
+		}
9648 10054
 		$direction_array = array();
9649 10055
 		$temp_array = array();
9650 10056
 
@@ -9745,7 +10151,9 @@  discard block
 block discarded – undo
9745 10151
 		if (isset($result->AirlineFlightInfoResult))
9746 10152
 		{
9747 10153
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9748
-		} else return '';
10154
+		} else {
10155
+			return '';
10156
+		}
9749 10157
 		
9750 10158
 		$registration = $this->convertAircraftRegistration($registration);
9751 10159
 		
@@ -9774,7 +10182,9 @@  discard block
 block discarded – undo
9774 10182
 		if (count($row) > 0) {
9775 10183
 		    //return $row['Registration'];
9776 10184
 		    return $row['registration'];
9777
-		} else return '';
10185
+		} else {
10186
+			return '';
10187
+		}
9778 10188
 	
9779 10189
 	}
9780 10190
 
@@ -9797,9 +10207,14 @@  discard block
 block discarded – undo
9797 10207
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9798 10208
 		$sth->closeCursor();
9799 10209
 		if (count($row) > 0) {
9800
-		    if ($row['type_flight'] == null) return '';
9801
-		    else return $row['type_flight'];
9802
-		} else return '';
10210
+		    if ($row['type_flight'] == null) {
10211
+		    	return '';
10212
+		    } else {
10213
+		    	return $row['type_flight'];
10214
+		    }
10215
+		} else {
10216
+			return '';
10217
+		}
9803 10218
 	
9804 10219
 	}
9805 10220
 
@@ -9817,7 +10232,9 @@  discard block
 block discarded – undo
9817 10232
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9818 10233
 	
9819 10234
 		$Connection = new Connection($this->db);
9820
-		if (!$Connection->tableExists('countries')) return '';
10235
+		if (!$Connection->tableExists('countries')) {
10236
+			return '';
10237
+		}
9821 10238
 	
9822 10239
 		try {
9823 10240
 			/*
@@ -9837,9 +10254,13 @@  discard block
 block discarded – undo
9837 10254
 			$sth->closeCursor();
9838 10255
 			if (count($row) > 0) {
9839 10256
 				return $row;
9840
-			} else return '';
10257
+			} else {
10258
+				return '';
10259
+			}
9841 10260
 		} catch (PDOException $e) {
9842
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10261
+			if (isset($globalDebug) && $globalDebug) {
10262
+				echo 'Error : '.$e->getMessage()."\n";
10263
+			}
9843 10264
 			return '';
9844 10265
 		}
9845 10266
 	
@@ -9857,7 +10278,9 @@  discard block
 block discarded – undo
9857 10278
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9858 10279
 	
9859 10280
 		$Connection = new Connection($this->db);
9860
-		if (!$Connection->tableExists('countries')) return '';
10281
+		if (!$Connection->tableExists('countries')) {
10282
+			return '';
10283
+		}
9861 10284
 	
9862 10285
 		try {
9863 10286
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -9869,9 +10292,13 @@  discard block
 block discarded – undo
9869 10292
 			$sth->closeCursor();
9870 10293
 			if (count($row) > 0) {
9871 10294
 				return $row;
9872
-			} else return '';
10295
+			} else {
10296
+				return '';
10297
+			}
9873 10298
 		} catch (PDOException $e) {
9874
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10299
+			if (isset($globalDebug) && $globalDebug) {
10300
+				echo 'Error : '.$e->getMessage()."\n";
10301
+			}
9875 10302
 			return '';
9876 10303
 		}
9877 10304
 	
@@ -10121,7 +10548,9 @@  discard block
 block discarded – undo
10121 10548
 	{
10122 10549
 		global $globalBitlyAccessToken;
10123 10550
 		
10124
-		if ($globalBitlyAccessToken == '') return $url;
10551
+		if ($globalBitlyAccessToken == '') {
10552
+			return $url;
10553
+		}
10125 10554
         
10126 10555
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
10127 10556
 		
@@ -10270,7 +10699,9 @@  discard block
 block discarded – undo
10270 10699
 		
10271 10700
 
10272 10701
 		// routes
10273
-		if ($globalDebug) print "Routes...\n";
10702
+		if ($globalDebug) {
10703
+			print "Routes...\n";
10704
+		}
10274 10705
 		if ($globalDBdriver == 'mysql') {
10275 10706
 			$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)";
10276 10707
 		} else {
@@ -10289,7 +10720,9 @@  discard block
 block discarded – undo
10289 10720
 			}
10290 10721
 		}
10291 10722
 		
10292
-		if ($globalDebug) print "Airlines...\n";
10723
+		if ($globalDebug) {
10724
+			print "Airlines...\n";
10725
+		}
10293 10726
 		//airlines
10294 10727
 		if ($globalDBdriver == 'mysql') {
10295 10728
 			$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)";
@@ -10303,10 +10736,15 @@  discard block
 block discarded – undo
10303 10736
 			if (is_numeric(substr($row['ident'], -1, 1)))
10304 10737
 			{
10305 10738
 				$fromsource = NULL;
10306
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10307
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10308
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10309
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10739
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10740
+					$fromsource = 'vatsim';
10741
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10742
+					$fromsource = 'ivao';
10743
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10744
+					$fromsource = 'vatsim';
10745
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10746
+					$fromsource = 'ivao';
10747
+				}
10310 10748
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10311 10749
 				if (isset($airline_array[0]['name'])) {
10312 10750
 					$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";
@@ -10316,13 +10754,17 @@  discard block
 block discarded – undo
10316 10754
 			}
10317 10755
 		}
10318 10756
 
10319
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10757
+		if ($globalDebug) {
10758
+			print "Remove Duplicate in aircraft_modes...\n";
10759
+		}
10320 10760
 		//duplicate modes
10321 10761
 		$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";
10322 10762
 		$sth = $this->db->prepare($query);
10323 10763
 		$sth->execute();
10324 10764
 		
10325
-		if ($globalDebug) print "Aircraft...\n";
10765
+		if ($globalDebug) {
10766
+			print "Aircraft...\n";
10767
+		}
10326 10768
 		//aircraft
10327 10769
 		if ($globalDBdriver == 'mysql') {
10328 10770
 			$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)";
@@ -10365,26 +10807,38 @@  discard block
 block discarded – undo
10365 10807
 				 if (isset($closestAirports[0])) {
10366 10808
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10367 10809
 						$airport_icao = $closestAirports[0]['icao'];
10368
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10810
+						if ($globalDebug) {
10811
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10812
+						}
10369 10813
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10370 10814
 						foreach ($closestAirports as $airport) {
10371 10815
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10372 10816
 								$airport_icao = $airport['icao'];
10373
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10817
+								if ($globalDebug) {
10818
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10819
+								}
10374 10820
 								break;
10375 10821
 							}
10376 10822
 						}
10377 10823
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10378 10824
 						$airport_icao = $closestAirports[0]['icao'];
10379
-						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";
10825
+						if ($globalDebug) {
10826
+							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";
10827
+						}
10380 10828
 					} else {
10381
-						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";
10829
+						if ($globalDebug) {
10830
+							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";
10831
+						}
10382 10832
 					}
10383 10833
 				} else {
10384
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10834
+					if ($globalDebug) {
10835
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10836
+					}
10385 10837
 				}
10386 10838
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10387
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10839
+					if ($globalDebug) {
10840
+						echo "Updating airport to ".$airport_icao."...\n";
10841
+					}
10388 10842
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10389 10843
 					$sthu = $this->db->prepare($update_query);
10390 10844
 					$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.
date-statistics-registration.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  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
 {
@@ -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 by Registration").'</h2>';
36
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration 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 by registration of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
37 37
 
38 38
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByDate($date);
39 39
 	if (!empty($aircraft_array))
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		print '</thead>';
51 51
 		print '<tbody>';
52 52
 		$i = 1;
53
-		foreach($aircraft_array as $aircraft_item)
53
+		foreach ($aircraft_array as $aircraft_item)
54 54
 		{
55 55
 			print '<tr>';
56 56
 			print '<td><strong>'.$i.'</strong></td>';
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 				if (isset($aircraft_item['aircraft_type'])) {
61 61
 					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
62 62
 				} else {
63
-					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:");' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
63
+					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:"); ' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
64 64
 				}
65 65
 				print '</td>';
66 66
 			} else {
Please login to merge, or discard this patch.
airline-statistics-manufacturer.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airline'])) {
7
-        header('Location: '.$globalURL.'/airline');
8
-        die();
7
+		header('Location: '.$globalURL.'/airline');
8
+		die();
9 9
 }
10 10
 $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/airline');
8 8
         die();
9 9
 }
10
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", "");
13 13
 
14 14
 if (!empty($spotter_array))
15 15
 {
16
-	$title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
16
+	$title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
17 17
 	require_once('header.php');
18 18
 	print '<div class="select-item">';
19 19
 	print '<form action="'.$globalURL.'/airline" method="post">';
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	$Stats = new Stats();
23 23
 	$airline_names = $Stats->getAllAirlineNames();
24 24
 	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
25
-	foreach($airline_names as $airline_name)
25
+	foreach ($airline_names as $airline_name)
26 26
 	{
27
-		if($airline == $airline_name['airline_icao'])
27
+		if ($airline == $airline_name['airline_icao'])
28 28
 		{
29 29
 			print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
30 30
 		} else {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	include('airline-sub-menu.php');
63 63
 	print '<div class="column">';
64 64
 	print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
65
-	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
65
+	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
66 66
 
67 67
 	$manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline($airline);
68 68
 	if (!empty($manufacturers_array))
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		print '</thead>';
78 78
 		print '<tbody>';
79 79
 		$i = 1;
80
-		foreach($manufacturers_array as $manufacturer_item)
80
+		foreach ($manufacturers_array as $manufacturer_item)
81 81
 		{
82 82
 			print '<tr>';
83 83
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 	print '<option></option>';
22 22
 	$Stats = new Stats();
23 23
 	$airline_names = $Stats->getAllAirlineNames();
24
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
24
+	if (empty($airline_names)) {
25
+		$airline_names = $Spotter->getAllAirlineNames();
26
+	}
25 27
 	foreach($airline_names as $airline_name)
26 28
 	{
27 29
 		if($airline == $airline_name['airline_icao'])
@@ -43,8 +45,7 @@  discard block
 block discarded – undo
43 45
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
44 46
 			{
45 47
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
46
-			}
47
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
48
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
48 49
 			{
49 50
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
50 51
 			}
Please login to merge, or discard this patch.
manufacturer-statistics-registration.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_manufacturer'])) {
7
-        header('Location: '.$globalURL.'/manufacturer');
8
-        die();
7
+		header('Location: '.$globalURL.'/manufacturer');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
11
+$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Aircraft by Registration from %s"),$manufacturer);
17
+	$title = sprintf(_("Most Common Aircraft by Registration from %s"), $manufacturer);
18 18
 	require_once('header.php');
19 19
 
20 20
 	print '<div class="select-item">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
28
+		if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 
49 49
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByManufacturer($manufacturer);
50 50
 	if (!empty($aircraft_array))
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		print '</thead>';
62 62
 		print '<tbody>';
63 63
 		$i = 1;
64
-		foreach($aircraft_array as $aircraft_item)
64
+		foreach ($aircraft_array as $aircraft_item)
65 65
 		{
66 66
 			print '<tr>';
67 67
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
highlights-table.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 require_once('header.php');
8 8
 
9 9
 //calculuation for the pagination
10
-if(!isset($_GET['limit']) || $_GET['limit'] == "")
10
+if (!isset($_GET['limit']) || $_GET['limit'] == "")
11 11
 {
12 12
 	$limit_start = 0;
13 13
 	$limit_end = 25;
14 14
 	$absolute_difference = 25;
15
-}  else {
15
+} else {
16 16
 	$limit_explode = explode(",", $_GET['limit']);
17 17
 	$limit_start = $limit_explode[0];
18 18
 	$limit_end = $limit_explode[1];
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 print '<div class="table column">';	
40 40
 print '<p>'._("The table below shows the detailed information of all custom selected flights who have special aspects to it, such as unique liveries, destinations etc.").'</p>';
41 41
 
42
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
42
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
43 43
 if ($sort != '') {
44 44
 	$spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, $sort);
45 45
 } else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 	$limit_start = 0;
13 13
 	$limit_end = 25;
14 14
 	$absolute_difference = 25;
15
-}  else {
15
+} else {
16 16
 	$limit_explode = explode(",", $_GET['limit']);
17 17
 	$limit_start = $limit_explode[0];
18 18
 	$limit_end = $limit_explode[1];
Please login to merge, or discard this patch.