Completed
Push — master ( 4407ee...8e145a )
by Yannick
06:51
created
install/class.update_schema.php 3 patches
Indentation   +594 added lines, -594 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
 class update_schema {
9 9
 
10 10
 	public static function update_schedule() {
11
-	    $Connection = new Connection();
12
-	    $Schedule = new Schedule();
13
-	    $query = "SELECT * FROM schedule";
14
-            try {
15
-            	$sth = $Connection->db->prepare($query);
11
+		$Connection = new Connection();
12
+		$Schedule = new Schedule();
13
+		$query = "SELECT * FROM schedule";
14
+			try {
15
+				$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+			} catch(PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19
-    	    }
20
-    	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
-    	    }
19
+			}
20
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
+			$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
+			}
23 23
 	
24 24
 	}
25 25
 /*
@@ -43,198 +43,198 @@  discard block
 block discarded – undo
43 43
     	}
44 44
 */	
45 45
 	private static function update_from_1() {
46
-    		$Connection = new Connection();
47
-    		// Add new column to routes table
48
-    		//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
46
+			$Connection = new Connection();
47
+			// Add new column to routes table
48
+			//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
49 49
 		$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL";
50
-        	try {
51
-            	    $sth = $Connection->db->prepare($query);
52
-		    $sth->execute();
53
-    		} catch(PDOException $e) {
54
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
-    		}
56
-    		// Copy schedules data to routes table
57
-    		self::update_schedule();
58
-    		// Delete schedule table
50
+			try {
51
+					$sth = $Connection->db->prepare($query);
52
+			$sth->execute();
53
+			} catch(PDOException $e) {
54
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
+			}
56
+			// Copy schedules data to routes table
57
+			self::update_schedule();
58
+			// Delete schedule table
59 59
 		$query = "DROP TABLE `schedule`";
60
-        	try {
61
-            	    $sth = $Connection->db->prepare($query);
62
-		    $sth->execute();
63
-    		} catch(PDOException $e) {
64
-		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65
-    		}
66
-    		// Add source column
67
-    		$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
-    		try {
69
-            	    $sth = $Connection->db->prepare($query);
70
-		    $sth->execute();
71
-    		} catch(PDOException $e) {
72
-		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
-    		}
60
+			try {
61
+					$sth = $Connection->db->prepare($query);
62
+			$sth->execute();
63
+			} catch(PDOException $e) {
64
+			return "error (delete schedule table) : ".$e->getMessage()."\n";
65
+			}
66
+			// Add source column
67
+			$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
+			try {
69
+					$sth = $Connection->db->prepare($query);
70
+			$sth->execute();
71
+			} catch(PDOException $e) {
72
+			return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
+			}
74 74
 		// Delete unused column
75 75
 		$query = "ALTER TABLE `aircraft_modes`  DROP `SerialNo`,  DROP `OperatorFlagCode`,  DROP `Manufacturer`,  DROP `Type`,  DROP `FirstRegDate`,  DROP `CurrentRegDate`,  DROP `Country`,  DROP `PreviousID`,  DROP `DeRegDate`,  DROP `Status`,  DROP `PopularName`,  DROP `GenericName`,  DROP `AircraftClass`,  DROP `Engines`,  DROP `OwnershipStatus`,  DROP `RegisteredOwners`,  DROP `MTOW`,  DROP `TotalHours`,  DROP `YearBuilt`,  DROP `CofACategory`,  DROP `CofAExpiry`,  DROP `UserNotes`,  DROP `Interested`,  DROP `UserTag`,  DROP `InfoUrl`,  DROP `PictureUrl1`,  DROP `PictureUrl2`,  DROP `PictureUrl3`,  DROP `UserBool1`,  DROP `UserBool2`,  DROP `UserBool3`,  DROP `UserBool4`,  DROP `UserBool5`,  DROP `UserString1`,  DROP `UserString2`,  DROP `UserString3`,  DROP `UserString4`,  DROP `UserString5`,  DROP `UserInt1`,  DROP `UserInt2`,  DROP `UserInt3`,  DROP `UserInt4`,  DROP `UserInt5`";
76
-    		try {
77
-            	    $sth = $Connection->db->prepare($query);
78
-		    $sth->execute();
79
-    		} catch(PDOException $e) {
80
-		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
-    		}
76
+			try {
77
+					$sth = $Connection->db->prepare($query);
78
+			$sth->execute();
79
+			} catch(PDOException $e) {
80
+			return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
+			}
82 82
 		// Add ModeS column
83 83
 		$query = "ALTER TABLE `spotter_output`  ADD `ModeS` VARCHAR(255) NULL";
84
-    		try {
85
-            	    $sth = $Connection->db->prepare($query);
86
-		    $sth->execute();
87
-    		} catch(PDOException $e) {
88
-		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
-    		}
84
+			try {
85
+					$sth = $Connection->db->prepare($query);
86
+			$sth->execute();
87
+			} catch(PDOException $e) {
88
+			return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
+			}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91
-    		try {
92
-            	    $sth = $Connection->db->prepare($query);
93
-		    $sth->execute();
94
-    		} catch(PDOException $e) {
95
-		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
-    		}
97
-    		// Add auto_increment for aircraft_modes
98
-    		$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
-    		try {
100
-            	    $sth = $Connection->db->prepare($query);
101
-		    $sth->execute();
102
-    		} catch(PDOException $e) {
103
-		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
-    		}
105
-    		$error = '';
91
+			try {
92
+					$sth = $Connection->db->prepare($query);
93
+			$sth->execute();
94
+			} catch(PDOException $e) {
95
+			return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
+			}
97
+			// Add auto_increment for aircraft_modes
98
+			$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
+			try {
100
+					$sth = $Connection->db->prepare($query);
101
+			$sth->execute();
102
+			} catch(PDOException $e) {
103
+			return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
+			}
105
+			$error = '';
106 106
 		$error .= create_db::import_file('../db/acars_live.sql');
107 107
 		$error .= create_db::import_file('../db/config.sql');
108 108
 		// Update schema_version to 2
109 109
 		$query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'";
110
-        	try {
111
-            	    $sth = $Connection->db->prepare($query);
112
-		    $sth->execute();
113
-    		} catch(PDOException $e) {
114
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
115
-    		}
110
+			try {
111
+					$sth = $Connection->db->prepare($query);
112
+			$sth->execute();
113
+			} catch(PDOException $e) {
114
+			return "error (update schema_version) : ".$e->getMessage()."\n";
115
+			}
116 116
 		return $error;
117
-        }
117
+		}
118 118
 
119 119
 	private static function update_from_2() {
120
-    		$Connection = new Connection();
121
-    		// Add new column decode to acars_live table
120
+			$Connection = new Connection();
121
+			// Add new column decode to acars_live table
122 122
 		$query = "ALTER TABLE `acars_live` ADD `decode` TEXT";
123
-        	try {
124
-            	    $sth = $Connection->db->prepare($query);
125
-		    $sth->execute();
126
-    		} catch(PDOException $e) {
127
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
-    		}
129
-    		$error = '';
130
-    		// Create table acars_archive
123
+			try {
124
+					$sth = $Connection->db->prepare($query);
125
+			$sth->execute();
126
+			} catch(PDOException $e) {
127
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
+			}
129
+			$error = '';
130
+			// Create table acars_archive
131 131
 		$error .= create_db::import_file('../db/acars_archive.sql');
132 132
 		// Update schema_version to 3
133 133
 		$query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'";
134
-        	try {
135
-            	    $sth = $Connection->db->prepare($query);
136
-		    $sth->execute();
137
-    		} catch(PDOException $e) {
138
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
139
-    		}
134
+			try {
135
+					$sth = $Connection->db->prepare($query);
136
+			$sth->execute();
137
+			} catch(PDOException $e) {
138
+			return "error (update schema_version) : ".$e->getMessage()."\n";
139
+			}
140 140
 		return $error;
141 141
 	}
142 142
 
143 143
 	private static function update_from_3() {
144
-    		$Connection = new Connection();
145
-    		// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
144
+			$Connection = new Connection();
145
+			// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
146 146
 		$query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP";
147
-        	try {
148
-            	    $sth = $Connection->db->prepare($query);
149
-		    $sth->execute();
150
-    		} catch(PDOException $e) {
151
-		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
-    		}
153
-    		// Add image_source_website column to spotter_image
147
+			try {
148
+					$sth = $Connection->db->prepare($query);
149
+			$sth->execute();
150
+			} catch(PDOException $e) {
151
+			return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
+			}
153
+			// Add image_source_website column to spotter_image
154 154
 		$query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL";
155
-        	try {
156
-            	    $sth = $Connection->db->prepare($query);
157
-		    $sth->execute();
158
-    		} catch(PDOException $e) {
159
-		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
-    		}
161
-    		$error = '';
155
+			try {
156
+					$sth = $Connection->db->prepare($query);
157
+			$sth->execute();
158
+			} catch(PDOException $e) {
159
+			return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
+			}
161
+			$error = '';
162 162
 		// Update schema_version to 4
163 163
 		$query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'";
164
-        	try {
165
-            	    $sth = $Connection->db->prepare($query);
166
-		    $sth->execute();
167
-    		} catch(PDOException $e) {
168
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
169
-    		}
164
+			try {
165
+					$sth = $Connection->db->prepare($query);
166
+			$sth->execute();
167
+			} catch(PDOException $e) {
168
+			return "error (update schema_version) : ".$e->getMessage()."\n";
169
+			}
170 170
 		return $error;
171 171
 	}
172 172
 	
173 173
 	private static function update_from_4() {
174
-    		$Connection = new Connection();
174
+			$Connection = new Connection();
175 175
 	
176
-    		$error = '';
177
-    		// Create table acars_label
176
+			$error = '';
177
+			// Create table acars_label
178 178
 		$error .= create_db::import_file('../db/acars_label.sql');
179 179
 		if ($error == '') {
180
-		    // Update schema_version to 5
181
-		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
-        	    try {
183
-            		$sth = $Connection->db->prepare($query);
180
+			// Update schema_version to 5
181
+			$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
+				try {
183
+					$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+				} catch(PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187
-    		    }
188
-    		}
187
+				}
188
+			}
189 189
 		return $error;
190 190
 	}
191 191
 
192 192
 	private static function update_from_5() {
193
-    		$Connection = new Connection();
194
-    		// Add columns to translation
193
+			$Connection = new Connection();
194
+			// Add columns to translation
195 195
 		$query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;";
196
-        	try {
197
-            	    $sth = $Connection->db->prepare($query);
198
-		    $sth->execute();
199
-    		} catch(PDOException $e) {
200
-		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
-    		}
202
-    		// Add aircraft_shadow column to aircraft
203
-    		$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
-        	try {
205
-            	    $sth = $Connection->db->prepare($query);
206
-		    $sth->execute();
207
-    		} catch(PDOException $e) {
208
-		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
-    		}
210
-    		// Add aircraft_shadow column to spotter_live
211
-    		$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
-        	try {
213
-            	    $sth = $Connection->db->prepare($query);
214
-		    $sth->execute();
215
-    		} catch(PDOException $e) {
216
-		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
-    		}
218
-    		$error = '';
219
-    		// Update table aircraft
196
+			try {
197
+					$sth = $Connection->db->prepare($query);
198
+			$sth->execute();
199
+			} catch(PDOException $e) {
200
+			return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
+			}
202
+			// Add aircraft_shadow column to aircraft
203
+			$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
+			try {
205
+					$sth = $Connection->db->prepare($query);
206
+			$sth->execute();
207
+			} catch(PDOException $e) {
208
+			return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
+			}
210
+			// Add aircraft_shadow column to spotter_live
211
+			$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
+			try {
213
+					$sth = $Connection->db->prepare($query);
214
+			$sth->execute();
215
+			} catch(PDOException $e) {
216
+			return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
+			}
218
+			$error = '';
219
+			// Update table aircraft
220 220
 		$error .= create_db::import_file('../db/aircraft.sql');
221 221
 		$error .= create_db::import_file('../db/spotter_archive.sql');
222 222
 
223 223
 		// Update schema_version to 6
224 224
 		$query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'";
225
-        	try {
226
-            	    $sth = $Connection->db->prepare($query);
227
-		    $sth->execute();
228
-    		} catch(PDOException $e) {
229
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
230
-    		}
225
+			try {
226
+					$sth = $Connection->db->prepare($query);
227
+			$sth->execute();
228
+			} catch(PDOException $e) {
229
+			return "error (update schema_version) : ".$e->getMessage()."\n";
230
+			}
231 231
 		return $error;
232 232
 	}
233 233
 
234 234
 	private static function update_from_6() {
235
-    		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
-    		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
235
+			$Connection = new Connection();
236
+			if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
+				$query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
240 240
 			ALTER TABLE spotter_live ADD INDEX(flightaware_id);
@@ -247,147 +247,147 @@  discard block
 block discarded – undo
247 247
 			ALTER TABLE aircraft ADD INDEX(icao);
248 248
 			ALTER TABLE airport ADD INDEX(icao);
249 249
 			ALTER TABLE translation ADD INDEX(Operator);";
250
-        	    try {
251
-            		$sth = $Connection->db->prepare($query);
250
+				try {
251
+					$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+				} catch(PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255
-    		    }
256
-    		}
257
-    		$error = '';
258
-    		// Update table countries
259
-    		if ($Connection->tableExists('airspace')) {
260
-    		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
255
+				}
256
+			}
257
+			$error = '';
258
+			// Update table countries
259
+			if ($Connection->tableExists('airspace')) {
260
+				$error .= update_db::update_countries();
261
+			if ($error != '') return $error;
262 262
 		}
263 263
 		// Update schema_version to 7
264 264
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
265
-        	try {
266
-            	    $sth = $Connection->db->prepare($query);
267
-		    $sth->execute();
268
-    		} catch(PDOException $e) {
269
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
270
-    		}
265
+			try {
266
+					$sth = $Connection->db->prepare($query);
267
+			$sth->execute();
268
+			} catch(PDOException $e) {
269
+			return "error (update schema_version) : ".$e->getMessage()."\n";
270
+			}
271 271
 		return $error;
272
-    	}
272
+		}
273 273
 
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276
-    		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
276
+			$Connection = new Connection();
277
+			$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279
-        	try {
280
-            	    $sth = $Connection->db->prepare($query);
281
-		    $sth->execute();
282
-    		} catch(PDOException $e) {
283
-		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
-    		}
285
-    		if ($globalDBdriver == 'mysql') {
286
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
-		    try {
288
-            		$sth = $Connection->db->prepare($query);
279
+			try {
280
+					$sth = $Connection->db->prepare($query);
281
+			$sth->execute();
282
+			} catch(PDOException $e) {
283
+			return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
+			}
285
+			if ($globalDBdriver == 'mysql') {
286
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
+			try {
288
+					$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+				} catch(PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292
-    		    }
293
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
294
-    		    if ($row['engine'] == 'ARCHIVE') {
292
+				}
293
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
294
+				if ($row['engine'] == 'ARCHIVE') {
295 295
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
296 296
 				ALTER TABLE copy ENGINE=ARCHIVE;
297 297
 				ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
298 298
 				INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`;
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301
-            	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
-            	    }
304
-                } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
-                }
307
-        	try {
308
-            	    $sth = $Connection->db->prepare($query);
309
-		    $sth->execute();
310
-    		} catch(PDOException $e) {
311
-		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
-    		}
301
+					} else {
302
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
+					}
304
+				} else {
305
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
+				}
307
+			try {
308
+					$sth = $Connection->db->prepare($query);
309
+			$sth->execute();
310
+			} catch(PDOException $e) {
311
+			return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
+			}
313 313
 
314
-    		$error = '';
315
-    		// Update table aircraft
314
+			$error = '';
315
+			// Update table aircraft
316 316
 		$error .= create_db::import_file('../db/source_location.sql');
317 317
 		if ($error != '') return $error;
318 318
 		// Update schema_version to 6
319 319
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320
-        	try {
321
-            	    $sth = $Connection->db->prepare($query);
322
-		    $sth->execute();
323
-    		} catch(PDOException $e) {
324
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
325
-    		}
320
+			try {
321
+					$sth = $Connection->db->prepare($query);
322
+			$sth->execute();
323
+			} catch(PDOException $e) {
324
+			return "error (update schema_version) : ".$e->getMessage()."\n";
325
+			}
326 326
 		return $error;
327 327
 	}
328 328
 
329 329
 	private static function update_from_8() {
330
-    		$Connection = new Connection();
331
-    		$error = '';
332
-    		// Update table aircraft
330
+			$Connection = new Connection();
331
+			$error = '';
332
+			// Update table aircraft
333 333
 		$error .= create_db::import_file('../db/notam.sql');
334 334
 		if ($error != '') return $error;
335 335
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 336
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 337
                         DELETE FROM config WHERE name = 'last_update_notam_db';
338 338
                         INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
339
-        	try {
340
-            	    $sth = $Connection->db->prepare($query);
341
-		    $sth->execute();
342
-    		} catch(PDOException $e) {
343
-		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344
-    		}
339
+			try {
340
+					$sth = $Connection->db->prepare($query);
341
+			$sth->execute();
342
+			} catch(PDOException $e) {
343
+			return "error (insert last_update values) : ".$e->getMessage()."\n";
344
+			}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346
-        	try {
347
-            	    $sth = $Connection->db->prepare($query);
348
-		    $sth->execute();
349
-    		} catch(PDOException $e) {
350
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
351
-    		}
346
+			try {
347
+					$sth = $Connection->db->prepare($query);
348
+			$sth->execute();
349
+			} catch(PDOException $e) {
350
+			return "error (update schema_version) : ".$e->getMessage()."\n";
351
+			}
352 352
 		return $error;
353 353
 	}
354 354
 
355 355
 	private static function update_from_9() {
356
-    		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
356
+			$Connection = new Connection();
357
+			$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359
-        	try {
360
-            	    $sth = $Connection->db->prepare($query);
361
-		    $sth->execute();
362
-    		} catch(PDOException $e) {
363
-		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
-    		}
359
+			try {
360
+					$sth = $Connection->db->prepare($query);
361
+			$sth->execute();
362
+			} catch(PDOException $e) {
363
+			return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
+			}
365 365
 		$error = '';
366
-    		// Update table atc
366
+			// Update table atc
367 367
 		$error .= create_db::import_file('../db/atc.sql');
368 368
 		if ($error != '') return $error;
369 369
 		
370 370
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371
-        	try {
372
-            	    $sth = $Connection->db->prepare($query);
373
-		    $sth->execute();
374
-    		} catch(PDOException $e) {
375
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
376
-    		}
371
+			try {
372
+					$sth = $Connection->db->prepare($query);
373
+			$sth->execute();
374
+			} catch(PDOException $e) {
375
+			return "error (update schema_version) : ".$e->getMessage()."\n";
376
+			}
377 377
 		return $error;
378 378
 	}
379 379
 
380 380
 	private static function update_from_10() {
381
-    		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
-        	try {
384
-            	    $sth = $Connection->db->prepare($query);
385
-		    $sth->execute();
386
-    		} catch(PDOException $e) {
387
-		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
-    		}
381
+			$Connection = new Connection();
382
+			$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
+			try {
384
+					$sth = $Connection->db->prepare($query);
385
+			$sth->execute();
386
+			} catch(PDOException $e) {
387
+			return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
+			}
389 389
 		$error = '';
390
-    		// Add tables
390
+			// Add tables
391 391
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392 392
 		if ($error != '') return $error;
393 393
 		$error .= create_db::import_file('../db/metar.sql');
@@ -398,76 +398,76 @@  discard block
 block discarded – undo
398 398
 		if ($error != '') return $error;
399 399
 		
400 400
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401
-        	try {
402
-            	    $sth = $Connection->db->prepare($query);
403
-		    $sth->execute();
404
-    		} catch(PDOException $e) {
405
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
406
-    		}
401
+			try {
402
+					$sth = $Connection->db->prepare($query);
403
+			$sth->execute();
404
+			} catch(PDOException $e) {
405
+			return "error (update schema_version) : ".$e->getMessage()."\n";
406
+			}
407 407
 		return $error;
408 408
 	}
409 409
 
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412
-    		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
-        	try {
415
-            	    $sth = $Connection->db->prepare($query);
416
-		    $sth->execute();
417
-    		} catch(PDOException $e) {
418
-		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
-    		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
-        	try {
422
-            	    $sth = $Connection->db->prepare($query);
423
-		    $sth->execute();
424
-    		} catch(PDOException $e) {
425
-		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
-    		}
427
-    		if ($globalDBdriver == 'mysql') {
428
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
-		    try {
430
-            		$sth = $Connection->db->prepare($query);
412
+			$Connection = new Connection();
413
+			$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
+			try {
415
+					$sth = $Connection->db->prepare($query);
431 416
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
417
+			} catch(PDOException $e) {
418
+			return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
+			}
420
+			$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
+			try {
422
+					$sth = $Connection->db->prepare($query);
423
+			$sth->execute();
424
+			} catch(PDOException $e) {
425
+			return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
+			}
427
+			if ($globalDBdriver == 'mysql') {
428
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
+			try {
430
+					$sth = $Connection->db->prepare($query);
431
+			$sth->execute();
432
+				} catch(PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434
-    		    }
435
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
436
-    		    if ($row['engine'] == 'ARCHIVE') {
434
+				}
435
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
436
+				if ($row['engine'] == 'ARCHIVE') {
437 437
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
438 438
 				ALTER TABLE copy ENGINE=ARCHIVE;
439 439
 				ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE;
440 440
 				INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`;
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443
-            	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
-            	    }
446
-                } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
-                }
449
-        	try {
450
-            	    $sth = $Connection->db->prepare($query);
451
-		    $sth->execute();
452
-    		} catch(PDOException $e) {
453
-		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
-    		}
443
+					} else {
444
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
+					}
446
+				} else {
447
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
+				}
449
+			try {
450
+					$sth = $Connection->db->prepare($query);
451
+			$sth->execute();
452
+			} catch(PDOException $e) {
453
+			return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
+			}
455 455
 
456 456
 		$error = '';
457 457
 		
458 458
 		$query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'";
459
-        	try {
460
-            	    $sth = $Connection->db->prepare($query);
461
-		    $sth->execute();
462
-    		} catch(PDOException $e) {
463
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
464
-    		}
459
+			try {
460
+					$sth = $Connection->db->prepare($query);
461
+			$sth->execute();
462
+			} catch(PDOException $e) {
463
+			return "error (update schema_version) : ".$e->getMessage()."\n";
464
+			}
465 465
 		return $error;
466 466
 	}
467 467
 	private static function update_from_12() {
468
-    		$Connection = new Connection();
468
+			$Connection = new Connection();
469 469
 		$error = '';
470
-    		// Add tables
470
+			// Add tables
471 471
 		$error .= create_db::import_file('../db/stats.sql');
472 472
 		if ($error != '') return $error;
473 473
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
@@ -484,166 +484,166 @@  discard block
 block discarded – undo
484 484
 		if ($error != '') return $error;
485 485
 		
486 486
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487
-        	try {
488
-            	    $sth = $Connection->db->prepare($query);
489
-		    $sth->execute();
490
-    		} catch(PDOException $e) {
491
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
492
-    		}
487
+			try {
488
+					$sth = $Connection->db->prepare($query);
489
+			$sth->execute();
490
+			} catch(PDOException $e) {
491
+			return "error (update schema_version) : ".$e->getMessage()."\n";
492
+			}
493 493
 		return $error;
494 494
 	}
495 495
 
496 496
 	private static function update_from_13() {
497
-    		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
497
+			$Connection = new Connection();
498
+			if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
+				$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+				} catch(PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505
-    			}
505
+				}
506 506
 		}
507
-    		$error = '';
507
+			$error = '';
508 508
 		$query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'";
509
-        	try {
510
-            	    $sth = $Connection->db->prepare($query);
511
-		    $sth->execute();
512
-    		} catch(PDOException $e) {
513
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
514
-    		}
509
+			try {
510
+					$sth = $Connection->db->prepare($query);
511
+			$sth->execute();
512
+			} catch(PDOException $e) {
513
+			return "error (update schema_version) : ".$e->getMessage()."\n";
514
+			}
515 515
 		return $error;
516 516
 	}
517 517
 
518 518
 	private static function update_from_14() {
519
-    		$Connection = new Connection();
519
+			$Connection = new Connection();
520 520
 		$error = '';
521
-    		// Add tables
522
-    		if (!$Connection->tableExists('stats_flight')) {
521
+			// Add tables
522
+			if (!$Connection->tableExists('stats_flight')) {
523 523
 			$error .= create_db::import_file('../db/stats_flight.sql');
524 524
 			if ($error != '') return $error;
525 525
 		}
526 526
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527
-        	try {
528
-            	    $sth = $Connection->db->prepare($query);
529
-		    $sth->execute();
530
-    		} catch(PDOException $e) {
531
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
532
-    		}
527
+			try {
528
+					$sth = $Connection->db->prepare($query);
529
+			$sth->execute();
530
+			} catch(PDOException $e) {
531
+			return "error (update schema_version) : ".$e->getMessage()."\n";
532
+			}
533 533
 		return $error;
534 534
 	}
535 535
 
536 536
 
537 537
 	private static function update_from_15() {
538
-    		$Connection = new Connection();
538
+			$Connection = new Connection();
539 539
 		$error = '';
540
-    		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
-        	try {
543
-            	    $sth = $Connection->db->prepare($query);
544
-		    $sth->execute();
545
-    		} catch(PDOException $e) {
546
-		    return "error (update stats) : ".$e->getMessage()."\n";
547
-    		}
540
+			// Add tables
541
+			$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
+			try {
543
+					$sth = $Connection->db->prepare($query);
544
+			$sth->execute();
545
+			} catch(PDOException $e) {
546
+			return "error (update stats) : ".$e->getMessage()."\n";
547
+			}
548 548
 		if ($error != '') return $error;
549 549
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550
-        	try {
551
-            	    $sth = $Connection->db->prepare($query);
552
-		    $sth->execute();
553
-    		} catch(PDOException $e) {
554
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
555
-    		}
550
+			try {
551
+					$sth = $Connection->db->prepare($query);
552
+			$sth->execute();
553
+			} catch(PDOException $e) {
554
+			return "error (update schema_version) : ".$e->getMessage()."\n";
555
+			}
556 556
 		return $error;
557 557
 	}
558 558
 
559 559
 	private static function update_from_16() {
560
-    		$Connection = new Connection();
560
+			$Connection = new Connection();
561 561
 		$error = '';
562
-    		// Add tables
563
-    		if (!$Connection->tableExists('stats_registration')) {
562
+			// Add tables
563
+			if (!$Connection->tableExists('stats_registration')) {
564 564
 			$error .= create_db::import_file('../db/stats_registration.sql');
565 565
 		}
566
-    		if (!$Connection->tableExists('stats_callsign')) {
566
+			if (!$Connection->tableExists('stats_callsign')) {
567 567
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 568
 		}
569 569
 		if ($error != '') return $error;
570 570
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571
-        	try {
572
-            	    $sth = $Connection->db->prepare($query);
573
-		    $sth->execute();
574
-    		} catch(PDOException $e) {
575
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
576
-    		}
571
+			try {
572
+					$sth = $Connection->db->prepare($query);
573
+			$sth->execute();
574
+			} catch(PDOException $e) {
575
+			return "error (update schema_version) : ".$e->getMessage()."\n";
576
+			}
577 577
 		return $error;
578 578
 	}
579 579
 
580 580
 	private static function update_from_17() {
581
-    		$Connection = new Connection();
581
+			$Connection = new Connection();
582 582
 		$error = '';
583
-    		// Add tables
584
-    		if (!$Connection->tableExists('stats_country')) {
583
+			// Add tables
584
+			if (!$Connection->tableExists('stats_country')) {
585 585
 			$error .= create_db::import_file('../db/stats_country.sql');
586 586
 		}
587 587
 		if ($error != '') return $error;
588 588
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589
-        	try {
590
-            	    $sth = $Connection->db->prepare($query);
591
-		    $sth->execute();
592
-    		} catch(PDOException $e) {
593
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
594
-    		}
589
+			try {
590
+					$sth = $Connection->db->prepare($query);
591
+			$sth->execute();
592
+			} catch(PDOException $e) {
593
+			return "error (update schema_version) : ".$e->getMessage()."\n";
594
+			}
595 595
 		return $error;
596 596
 	}
597 597
 	private static function update_from_18() {
598
-    		$Connection = new Connection();
598
+			$Connection = new Connection();
599 599
 		$error = '';
600
-    		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
-    			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
-    	        	try {
604
-	            	    $sth = $Connection->db->prepare($query);
605
-			    $sth->execute();
606
-    			} catch(PDOException $e) {
607
-			    return "error (update stats) : ".$e->getMessage()."\n";
608
-    			}
609
-    		}
600
+			// Modify stats_airport table
601
+			if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
+				$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
+					try {
604
+						$sth = $Connection->db->prepare($query);
605
+				$sth->execute();
606
+				} catch(PDOException $e) {
607
+				return "error (update stats) : ".$e->getMessage()."\n";
608
+				}
609
+			}
610 610
 		if ($error != '') return $error;
611 611
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612
-        	try {
613
-            	    $sth = $Connection->db->prepare($query);
614
-		    $sth->execute();
615
-    		} catch(PDOException $e) {
616
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
617
-    		}
612
+			try {
613
+					$sth = $Connection->db->prepare($query);
614
+			$sth->execute();
615
+			} catch(PDOException $e) {
616
+			return "error (update schema_version) : ".$e->getMessage()."\n";
617
+			}
618 618
 		return $error;
619 619
 	}
620 620
 
621 621
 	private static function update_from_19() {
622
-    		$Connection = new Connection();
622
+			$Connection = new Connection();
623 623
 		$error = '';
624
-    		// Update airport table
624
+			// Update airport table
625 625
 		$error .= create_db::import_file('../db/airport.sql');
626 626
 		if ($error != '') return 'Import airport.sql : '.$error;
627 627
 		// Remove primary key on Spotter_Archive
628 628
 		$query = "alter table spotter_archive drop spotter_archive_id";
629
-        	try {
630
-            	    $sth = $Connection->db->prepare($query);
631
-		    $sth->execute();
632
-    		} catch(PDOException $e) {
633
-		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
-    		}
629
+			try {
630
+					$sth = $Connection->db->prepare($query);
631
+			$sth->execute();
632
+			} catch(PDOException $e) {
633
+			return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
+			}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636
-        	try {
637
-            	    $sth = $Connection->db->prepare($query);
638
-		    $sth->execute();
639
-    		} catch(PDOException $e) {
640
-		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
-    		}
636
+			try {
637
+					$sth = $Connection->db->prepare($query);
638
+			$sth->execute();
639
+			} catch(PDOException $e) {
640
+			return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
+			}
642 642
 		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
643 643
 			// Add column over_country
644
-    			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
644
+				$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646
-            			$sth = $Connection->db->prepare($query);
646
+						$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648 648
 			} catch(PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 		}
652 652
 		if (!$Connection->checkColumnName('spotter_live','over_country')) {
653 653
 			// Add column over_country
654
-    			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
654
+				$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656
-            			$sth = $Connection->db->prepare($query);
656
+						$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658 658
 			} catch(PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -661,74 +661,74 @@  discard block
 block discarded – undo
661 661
 		}
662 662
 		if (!$Connection->checkColumnName('spotter_output','source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664
-    			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
664
+				$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668 668
 			} catch(PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670
-    			}
671
-    		}
670
+				}
671
+			}
672 672
 		if (!$Connection->checkColumnName('spotter_live','source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674
-    			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
674
+				$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678 678
 			} catch(PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680
-    			}
681
-    		}
680
+				}
681
+			}
682 682
 		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684
-    			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
684
+				$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688 688
 			} catch(PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690
-    			}
691
-    		}
690
+				}
691
+			}
692 692
 		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694
-    			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
694
+				$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698 698
 			} catch(PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700
-    			}
701
-    		}
700
+				}
701
+			}
702 702
 		if ($error != '') return $error;
703 703
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704
-        	try {
705
-            	    $sth = $Connection->db->prepare($query);
706
-		    $sth->execute();
707
-    		} catch(PDOException $e) {
708
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
709
-    		}
704
+			try {
705
+					$sth = $Connection->db->prepare($query);
706
+			$sth->execute();
707
+			} catch(PDOException $e) {
708
+			return "error (update schema_version) : ".$e->getMessage()."\n";
709
+			}
710 710
 		return $error;
711 711
 	}
712 712
 
713 713
 	private static function update_from_20() {
714 714
 		global $globalIVAO, $globalVATSIM, $globalphpVMS;
715
-    		$Connection = new Connection();
715
+			$Connection = new Connection();
716 716
 		$error = '';
717
-    		// Update airline table
718
-    		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
717
+			// Update airline table
718
+			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722 722
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 723
 			// Add column over_country
724
-    			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
-        		try {
724
+				$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
+				try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728 728
 			} catch(PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730
-    			}
731
-    		}
730
+				}
731
+			}
732 732
 		if ($error != '') return $error;
733 733
 		/*
734 734
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 		}
739 739
 		*/
740 740
 		$query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'";
741
-        	try {
742
-            	    $sth = $Connection->db->prepare($query);
743
-		    $sth->execute();
744
-    		} catch(PDOException $e) {
745
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
746
-    		}
741
+			try {
742
+					$sth = $Connection->db->prepare($query);
743
+			$sth->execute();
744
+			} catch(PDOException $e) {
745
+			return "error (update schema_version) : ".$e->getMessage()."\n";
746
+			}
747 747
 		return $error;
748 748
 	}
749 749
 
@@ -762,35 +762,35 @@  discard block
 block discarded – undo
762 762
 			if ($error != '') return $error;
763 763
 		}
764 764
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765
-        	try {
766
-            	    $sth = $Connection->db->prepare($query);
767
-		    $sth->execute();
768
-    		} catch(PDOException $e) {
769
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
770
-    		}
765
+			try {
766
+					$sth = $Connection->db->prepare($query);
767
+			$sth->execute();
768
+			} catch(PDOException $e) {
769
+			return "error (update schema_version) : ".$e->getMessage()."\n";
770
+			}
771 771
 		return $error;
772 772
 	}
773 773
 
774 774
 	private static function update_from_22() {
775 775
 		global $globalDBdriver;
776
-    		$Connection = new Connection();
776
+			$Connection = new Connection();
777 777
 		$error = '';
778 778
 		// Add table stats polar
779
-    		if (!$Connection->tableExists('stats_source')) {
779
+			if (!$Connection->tableExists('stats_source')) {
780 780
 			if ($globalDBdriver == 'mysql') {
781
-    				$error .= create_db::import_file('../db/stats_source.sql');
781
+					$error .= create_db::import_file('../db/stats_source.sql');
782 782
 			} else {
783 783
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 784
 			}
785 785
 			if ($error != '') return $error;
786 786
 		}
787 787
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788
-        	try {
789
-            	    $sth = $Connection->db->prepare($query);
790
-		    $sth->execute();
791
-    		} catch(PDOException $e) {
792
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
793
-    		}
788
+			try {
789
+					$sth = $Connection->db->prepare($query);
790
+			$sth->execute();
791
+			} catch(PDOException $e) {
792
+			return "error (update schema_version) : ".$e->getMessage()."\n";
793
+			}
794 794
 		return $error;
795 795
 	}
796 796
 
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 		}
822 822
 		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824
-    			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
824
+				$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828 828
 			} catch(PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830
-    			}
831
-    		}
830
+				}
831
+			}
832 832
 		
833 833
 		$query = "UPDATE config SET value = '24' WHERE name = 'schema_version'";
834 834
 		try {
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 			} catch(PDOException $e) {
1177 1177
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1178 1178
 			}
1179
-                }
1179
+				}
1180 1180
 		if (!$Connection->checkColumnName('aircraft','mfr')) {
1181 1181
 			// Add mfr to aircraft
1182 1182
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 			} catch(PDOException $e) {
1251 1251
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1252 1252
 			}
1253
-                }
1253
+				}
1254 1254
 		if (!$Connection->indexExists('accidents','registration_idx')) {
1255 1255
 			// Add index key
1256 1256
 			$query = "create index registration_idx on accidents (registration)";
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 			} catch(PDOException $e) {
1261 1261
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1262 1262
 			}
1263
-                }
1263
+				}
1264 1264
 		if (!$Connection->indexExists('accidents','rdts')) {
1265 1265
 			// Add index key
1266 1266
 			$query = "create index rdts on accidents (registration,date,type,source)";
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 			} catch(PDOException $e) {
1271 1271
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1272 1272
 			}
1273
-                }
1273
+				}
1274 1274
 
1275 1275
 		$query = "UPDATE config SET value = '31' WHERE name = 'schema_version'";
1276 1276
 		try {
@@ -1384,161 +1384,161 @@  discard block
 block discarded – undo
1384 1384
 	}
1385 1385
 
1386 1386
 
1387
-    	public static function check_version($update = false) {
1388
-    	    global $globalDBname;
1389
-    	    $version = 0;
1390
-    	    $Connection = new Connection();
1391
-    	    if ($Connection->tableExists('aircraft')) {
1392
-    		if (!$Connection->tableExists('config')) {
1393
-    		    $version = '1';
1394
-    		    if ($update) return self::update_from_1();
1395
-    		    else return $version;
1387
+		public static function check_version($update = false) {
1388
+			global $globalDBname;
1389
+			$version = 0;
1390
+			$Connection = new Connection();
1391
+			if ($Connection->tableExists('aircraft')) {
1392
+			if (!$Connection->tableExists('config')) {
1393
+				$version = '1';
1394
+				if ($update) return self::update_from_1();
1395
+				else return $version;
1396 1396
 		} else {
1397
-    		    $Connection = new Connection();
1398
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1399
-		    try {
1400
-            		$sth = $Connection->db->prepare($query);
1401
-		        $sth->execute();
1402
-		    } catch(PDOException $e) {
1397
+				$Connection = new Connection();
1398
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1399
+			try {
1400
+					$sth = $Connection->db->prepare($query);
1401
+				$sth->execute();
1402
+			} catch(PDOException $e) {
1403 1403
 			return "error : ".$e->getMessage()."\n";
1404
-    		    }
1405
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
1406
-    		    if ($update) {
1407
-    			if ($result['value'] == '2') {
1408
-    			    $error = self::update_from_2();
1409
-    			    if ($error != '') return $error;
1410
-    			    else return self::check_version(true);
1411
-    			} elseif ($result['value'] == '3') {
1412
-    			    $error = self::update_from_3();
1413
-    			    if ($error != '') return $error;
1414
-    			    else return self::check_version(true);
1415
-    			} elseif ($result['value'] == '4') {
1416
-    			    $error = self::update_from_4();
1417
-    			    if ($error != '') return $error;
1418
-    			    else return self::check_version(true);
1419
-    			} elseif ($result['value'] == '5') {
1420
-    			    $error = self::update_from_5();
1421
-    			    if ($error != '') return $error;
1422
-    			    else return self::check_version(true);
1423
-    			} elseif ($result['value'] == '6') {
1424
-    			    $error = self::update_from_6();
1425
-    			    if ($error != '') return $error;
1426
-    			    else return self::check_version(true);
1427
-    			} elseif ($result['value'] == '7') {
1428
-    			    $error = self::update_from_7();
1429
-    			    if ($error != '') return $error;
1430
-    			    else return self::check_version(true);
1431
-    			} elseif ($result['value'] == '8') {
1432
-    			    $error = self::update_from_8();
1433
-    			    if ($error != '') return $error;
1434
-    			    else return self::check_version(true);
1435
-    			} elseif ($result['value'] == '9') {
1436
-    			    $error = self::update_from_9();
1437
-    			    if ($error != '') return $error;
1438
-    			    else return self::check_version(true);
1439
-    			} elseif ($result['value'] == '10') {
1440
-    			    $error = self::update_from_10();
1441
-    			    if ($error != '') return $error;
1442
-    			    else return self::check_version(true);
1443
-    			} elseif ($result['value'] == '11') {
1444
-    			    $error = self::update_from_11();
1445
-    			    if ($error != '') return $error;
1446
-    			    else return self::check_version(true);
1447
-    			} elseif ($result['value'] == '12') {
1448
-    			    $error = self::update_from_12();
1449
-    			    if ($error != '') return $error;
1450
-    			    else return self::check_version(true);
1451
-    			} elseif ($result['value'] == '13') {
1452
-    			    $error = self::update_from_13();
1453
-    			    if ($error != '') return $error;
1454
-    			    else return self::check_version(true);
1455
-    			} elseif ($result['value'] == '14') {
1456
-    			    $error = self::update_from_14();
1457
-    			    if ($error != '') return $error;
1458
-    			    else return self::check_version(true);
1459
-    			} elseif ($result['value'] == '15') {
1460
-    			    $error = self::update_from_15();
1461
-    			    if ($error != '') return $error;
1462
-    			    else return self::check_version(true);
1463
-    			} elseif ($result['value'] == '16') {
1464
-    			    $error = self::update_from_16();
1465
-    			    if ($error != '') return $error;
1466
-    			    else return self::check_version(true);
1467
-    			} elseif ($result['value'] == '17') {
1468
-    			    $error = self::update_from_17();
1469
-    			    if ($error != '') return $error;
1470
-    			    else return self::check_version(true);
1471
-    			} elseif ($result['value'] == '18') {
1472
-    			    $error = self::update_from_18();
1473
-    			    if ($error != '') return $error;
1474
-    			    else return self::check_version(true);
1475
-    			} elseif ($result['value'] == '19') {
1476
-    			    $error = self::update_from_19();
1477
-    			    if ($error != '') return $error;
1478
-    			    else return self::check_version(true);
1479
-    			} elseif ($result['value'] == '20') {
1480
-    			    $error = self::update_from_20();
1481
-    			    if ($error != '') return $error;
1482
-    			    else return self::check_version(true);
1483
-    			} elseif ($result['value'] == '21') {
1484
-    			    $error = self::update_from_21();
1485
-    			    if ($error != '') return $error;
1486
-    			    else return self::check_version(true);
1487
-    			} elseif ($result['value'] == '22') {
1488
-    			    $error = self::update_from_22();
1489
-    			    if ($error != '') return $error;
1490
-    			    else return self::check_version(true);
1491
-    			} elseif ($result['value'] == '23') {
1492
-    			    $error = self::update_from_23();
1493
-    			    if ($error != '') return $error;
1494
-    			    else return self::check_version(true);
1495
-    			} elseif ($result['value'] == '24') {
1496
-    			    $error = self::update_from_24();
1497
-    			    if ($error != '') return $error;
1498
-    			    else return self::check_version(true);
1499
-    			} elseif ($result['value'] == '25') {
1500
-    			    $error = self::update_from_25();
1501
-    			    if ($error != '') return $error;
1502
-    			    else return self::check_version(true);
1503
-    			} elseif ($result['value'] == '26') {
1504
-    			    $error = self::update_from_26();
1505
-    			    if ($error != '') return $error;
1506
-    			    else return self::check_version(true);
1507
-    			} elseif ($result['value'] == '27') {
1508
-    			    $error = self::update_from_27();
1509
-    			    if ($error != '') return $error;
1510
-    			    else return self::check_version(true);
1511
-    			} elseif ($result['value'] == '28') {
1512
-    			    $error = self::update_from_28();
1513
-    			    if ($error != '') return $error;
1514
-    			    else return self::check_version(true);
1515
-    			} elseif ($result['value'] == '29') {
1516
-    			    $error = self::update_from_29();
1517
-    			    if ($error != '') return $error;
1518
-    			    else return self::check_version(true);
1519
-    			} elseif ($result['value'] == '30') {
1520
-    			    $error = self::update_from_30();
1521
-    			    if ($error != '') return $error;
1522
-    			    else return self::check_version(true);
1523
-    			} elseif ($result['value'] == '31') {
1524
-    			    $error = self::update_from_31();
1525
-    			    if ($error != '') return $error;
1526
-    			    else return self::check_version(true);
1527
-    			} elseif ($result['value'] == '32') {
1528
-    			    $error = self::update_from_32();
1529
-    			    if ($error != '') return $error;
1530
-    			    else return self::check_version(true);
1531
-    			} elseif ($result['value'] == '33') {
1532
-    			    $error = self::update_from_33();
1533
-    			    if ($error != '') return $error;
1534
-    			    else return self::check_version(true);
1535
-    			} else return '';
1536
-    		    }
1537
-    		    else return $result['value'];
1404
+				}
1405
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
1406
+				if ($update) {
1407
+				if ($result['value'] == '2') {
1408
+					$error = self::update_from_2();
1409
+					if ($error != '') return $error;
1410
+					else return self::check_version(true);
1411
+				} elseif ($result['value'] == '3') {
1412
+					$error = self::update_from_3();
1413
+					if ($error != '') return $error;
1414
+					else return self::check_version(true);
1415
+				} elseif ($result['value'] == '4') {
1416
+					$error = self::update_from_4();
1417
+					if ($error != '') return $error;
1418
+					else return self::check_version(true);
1419
+				} elseif ($result['value'] == '5') {
1420
+					$error = self::update_from_5();
1421
+					if ($error != '') return $error;
1422
+					else return self::check_version(true);
1423
+				} elseif ($result['value'] == '6') {
1424
+					$error = self::update_from_6();
1425
+					if ($error != '') return $error;
1426
+					else return self::check_version(true);
1427
+				} elseif ($result['value'] == '7') {
1428
+					$error = self::update_from_7();
1429
+					if ($error != '') return $error;
1430
+					else return self::check_version(true);
1431
+				} elseif ($result['value'] == '8') {
1432
+					$error = self::update_from_8();
1433
+					if ($error != '') return $error;
1434
+					else return self::check_version(true);
1435
+				} elseif ($result['value'] == '9') {
1436
+					$error = self::update_from_9();
1437
+					if ($error != '') return $error;
1438
+					else return self::check_version(true);
1439
+				} elseif ($result['value'] == '10') {
1440
+					$error = self::update_from_10();
1441
+					if ($error != '') return $error;
1442
+					else return self::check_version(true);
1443
+				} elseif ($result['value'] == '11') {
1444
+					$error = self::update_from_11();
1445
+					if ($error != '') return $error;
1446
+					else return self::check_version(true);
1447
+				} elseif ($result['value'] == '12') {
1448
+					$error = self::update_from_12();
1449
+					if ($error != '') return $error;
1450
+					else return self::check_version(true);
1451
+				} elseif ($result['value'] == '13') {
1452
+					$error = self::update_from_13();
1453
+					if ($error != '') return $error;
1454
+					else return self::check_version(true);
1455
+				} elseif ($result['value'] == '14') {
1456
+					$error = self::update_from_14();
1457
+					if ($error != '') return $error;
1458
+					else return self::check_version(true);
1459
+				} elseif ($result['value'] == '15') {
1460
+					$error = self::update_from_15();
1461
+					if ($error != '') return $error;
1462
+					else return self::check_version(true);
1463
+				} elseif ($result['value'] == '16') {
1464
+					$error = self::update_from_16();
1465
+					if ($error != '') return $error;
1466
+					else return self::check_version(true);
1467
+				} elseif ($result['value'] == '17') {
1468
+					$error = self::update_from_17();
1469
+					if ($error != '') return $error;
1470
+					else return self::check_version(true);
1471
+				} elseif ($result['value'] == '18') {
1472
+					$error = self::update_from_18();
1473
+					if ($error != '') return $error;
1474
+					else return self::check_version(true);
1475
+				} elseif ($result['value'] == '19') {
1476
+					$error = self::update_from_19();
1477
+					if ($error != '') return $error;
1478
+					else return self::check_version(true);
1479
+				} elseif ($result['value'] == '20') {
1480
+					$error = self::update_from_20();
1481
+					if ($error != '') return $error;
1482
+					else return self::check_version(true);
1483
+				} elseif ($result['value'] == '21') {
1484
+					$error = self::update_from_21();
1485
+					if ($error != '') return $error;
1486
+					else return self::check_version(true);
1487
+				} elseif ($result['value'] == '22') {
1488
+					$error = self::update_from_22();
1489
+					if ($error != '') return $error;
1490
+					else return self::check_version(true);
1491
+				} elseif ($result['value'] == '23') {
1492
+					$error = self::update_from_23();
1493
+					if ($error != '') return $error;
1494
+					else return self::check_version(true);
1495
+				} elseif ($result['value'] == '24') {
1496
+					$error = self::update_from_24();
1497
+					if ($error != '') return $error;
1498
+					else return self::check_version(true);
1499
+				} elseif ($result['value'] == '25') {
1500
+					$error = self::update_from_25();
1501
+					if ($error != '') return $error;
1502
+					else return self::check_version(true);
1503
+				} elseif ($result['value'] == '26') {
1504
+					$error = self::update_from_26();
1505
+					if ($error != '') return $error;
1506
+					else return self::check_version(true);
1507
+				} elseif ($result['value'] == '27') {
1508
+					$error = self::update_from_27();
1509
+					if ($error != '') return $error;
1510
+					else return self::check_version(true);
1511
+				} elseif ($result['value'] == '28') {
1512
+					$error = self::update_from_28();
1513
+					if ($error != '') return $error;
1514
+					else return self::check_version(true);
1515
+				} elseif ($result['value'] == '29') {
1516
+					$error = self::update_from_29();
1517
+					if ($error != '') return $error;
1518
+					else return self::check_version(true);
1519
+				} elseif ($result['value'] == '30') {
1520
+					$error = self::update_from_30();
1521
+					if ($error != '') return $error;
1522
+					else return self::check_version(true);
1523
+				} elseif ($result['value'] == '31') {
1524
+					$error = self::update_from_31();
1525
+					if ($error != '') return $error;
1526
+					else return self::check_version(true);
1527
+				} elseif ($result['value'] == '32') {
1528
+					$error = self::update_from_32();
1529
+					if ($error != '') return $error;
1530
+					else return self::check_version(true);
1531
+				} elseif ($result['value'] == '33') {
1532
+					$error = self::update_from_33();
1533
+					if ($error != '') return $error;
1534
+					else return self::check_version(true);
1535
+				} else return '';
1536
+				}
1537
+				else return $result['value'];
1538 1538
 		}
1539 1539
 		
1540
-	    } else return $version;
1541
-    	}
1540
+		} else return $version;
1541
+		}
1542 1542
     	
1543 1543
 }
1544 1544
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 412
     		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 430
             		$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+    		    } catch (PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 443
             	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445 445
             	    }
446 446
                 } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 497
     		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+    		if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) {
499
+    			$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+	    		} catch (PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505 505
     			}
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 602
     			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 664
     			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 674
     			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
682
+		if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684 684
     			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 694
     			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 824
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,36 +922,36 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948
-			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
948
+			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
949 949
 				// Add unique key
950 950
 				$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
951 951
 				try {
952 952
 					$sth = $Connection->db->prepare($query);
953 953
 					$sth->execute();
954
-				} catch(PDOException $e) {
954
+				} catch (PDOException $e) {
955 955
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
956 956
 				}
957 957
 			} else {
@@ -964,18 +964,18 @@  discard block
 block discarded – undo
964 964
 				try {
965 965
 					$sth = $Connection->db->prepare($query);
966 966
 					$sth->execute();
967
-				} catch(PDOException $e) {
967
+				} catch (PDOException $e) {
968 968
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
969 969
 				}
970 970
 			}
971 971
 		}
972
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
972
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
973 973
 			// Add forsource to airlines
974 974
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
975 975
 			try {
976 976
 				$sth = $Connection->db->prepare($query);
977 977
 				$sth->execute();
978
-			} catch(PDOException $e) {
978
+			} catch (PDOException $e) {
979 979
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
980 980
 			}
981 981
 			// Add unique key
@@ -987,17 +987,17 @@  discard block
 block discarded – undo
987 987
 			try {
988 988
 				$sth = $Connection->db->prepare($query);
989 989
 				$sth->execute();
990
-			} catch(PDOException $e) {
990
+			} catch (PDOException $e) {
991 991
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
992 992
 			}
993 993
 		}
994
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
994
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
995 995
 			// Add forsource to airlines
996 996
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
997 997
 			try {
998 998
 				$sth = $Connection->db->prepare($query);
999 999
 				$sth->execute();
1000
-			} catch(PDOException $e) {
1000
+			} catch (PDOException $e) {
1001 1001
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1002 1002
 			}
1003 1003
 			// Add unique key
@@ -1009,17 +1009,17 @@  discard block
 block discarded – undo
1009 1009
 			try {
1010 1010
 				$sth = $Connection->db->prepare($query);
1011 1011
 				$sth->execute();
1012
-			} catch(PDOException $e) {
1012
+			} catch (PDOException $e) {
1013 1013
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1014 1014
 			}
1015 1015
 		}
1016
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1016
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1017 1017
 			// Add forsource to airlines
1018 1018
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1019 1019
 			try {
1020 1020
 				$sth = $Connection->db->prepare($query);
1021 1021
 				$sth->execute();
1022
-			} catch(PDOException $e) {
1022
+			} catch (PDOException $e) {
1023 1023
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1024 1024
 			}
1025 1025
 			// Add unique key
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 			try {
1032 1032
 				$sth = $Connection->db->prepare($query);
1033 1033
 				$sth->execute();
1034
-			} catch(PDOException $e) {
1034
+			} catch (PDOException $e) {
1035 1035
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1036 1036
 			}
1037 1037
 		}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 		try {
1041 1041
 			$sth = $Connection->db->prepare($query);
1042 1042
 			$sth->execute();
1043
-		} catch(PDOException $e) {
1043
+		} catch (PDOException $e) {
1044 1044
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1045 1045
 		}
1046 1046
 		return $error;
@@ -1050,13 +1050,13 @@  discard block
 block discarded – undo
1050 1050
 		global $globalDBdriver;
1051 1051
 		$Connection = new Connection();
1052 1052
 		$error = '';
1053
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1053
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1054 1054
 			// Add forsource to airlines
1055 1055
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1056 1056
 			try {
1057 1057
 				$sth = $Connection->db->prepare($query);
1058 1058
 				$sth->execute();
1059
-			} catch(PDOException $e) {
1059
+			} catch (PDOException $e) {
1060 1060
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1061 1061
 			}
1062 1062
 			// Add unique key
@@ -1068,17 +1068,17 @@  discard block
 block discarded – undo
1068 1068
 			try {
1069 1069
 				$sth = $Connection->db->prepare($query);
1070 1070
 				$sth->execute();
1071
-			} catch(PDOException $e) {
1071
+			} catch (PDOException $e) {
1072 1072
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1073 1073
 			}
1074 1074
 		}
1075
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1075
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1076 1076
 			// Add forsource to airlines
1077 1077
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1078 1078
 			try {
1079 1079
 				$sth = $Connection->db->prepare($query);
1080 1080
 				$sth->execute();
1081
-			} catch(PDOException $e) {
1081
+			} catch (PDOException $e) {
1082 1082
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1083 1083
 			}
1084 1084
 			// Add unique key
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			try {
1091 1091
 				$sth = $Connection->db->prepare($query);
1092 1092
 				$sth->execute();
1093
-			} catch(PDOException $e) {
1093
+			} catch (PDOException $e) {
1094 1094
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1095 1095
 			}
1096 1096
 		}
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 		try {
1099 1099
 			$sth = $Connection->db->prepare($query);
1100 1100
 			$sth->execute();
1101
-		} catch(PDOException $e) {
1101
+		} catch (PDOException $e) {
1102 1102
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1103 1103
 		}
1104 1104
 		return $error;
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 		global $globalDBdriver;
1109 1109
 		$Connection = new Connection();
1110 1110
 		$error = '';
1111
-		if (!$Connection->checkColumnName('atc','format_source')) {
1111
+		if (!$Connection->checkColumnName('atc', 'format_source')) {
1112 1112
 			$query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL";
1113 1113
 			try {
1114 1114
 				$sth = $Connection->db->prepare($query);
1115 1115
 				$sth->execute();
1116
-			} catch(PDOException $e) {
1116
+			} catch (PDOException $e) {
1117 1117
 				return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n";
1118 1118
 			}
1119 1119
 		}
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 		try {
1122 1122
 			$sth = $Connection->db->prepare($query);
1123 1123
 			$sth->execute();
1124
-		} catch(PDOException $e) {
1124
+		} catch (PDOException $e) {
1125 1125
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1126 1126
 		}
1127 1127
 		return $error;
@@ -1131,13 +1131,13 @@  discard block
 block discarded – undo
1131 1131
 		global $globalDBdriver;
1132 1132
 		$Connection = new Connection();
1133 1133
 		$error = '';
1134
-		if (!$Connection->checkColumnName('stats_pilot','format_source')) {
1134
+		if (!$Connection->checkColumnName('stats_pilot', 'format_source')) {
1135 1135
 			// Add forsource to airlines
1136 1136
 			$query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''";
1137 1137
 			try {
1138 1138
 				$sth = $Connection->db->prepare($query);
1139 1139
 				$sth->execute();
1140
-			} catch(PDOException $e) {
1140
+			} catch (PDOException $e) {
1141 1141
 				return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n";
1142 1142
 			}
1143 1143
 			// Add unique key
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			try {
1150 1150
 				$sth = $Connection->db->prepare($query);
1151 1151
 				$sth->execute();
1152
-			} catch(PDOException $e) {
1152
+			} catch (PDOException $e) {
1153 1153
 				return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n";
1154 1154
 			}
1155 1155
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		try {
1158 1158
 			$sth = $Connection->db->prepare($query);
1159 1159
 			$sth->execute();
1160
-		} catch(PDOException $e) {
1160
+		} catch (PDOException $e) {
1161 1161
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1162 1162
 		}
1163 1163
 		return $error;
@@ -1167,23 +1167,23 @@  discard block
 block discarded – undo
1167 1167
 		global $globalDBdriver;
1168 1168
 		$Connection = new Connection();
1169 1169
 		$error = '';
1170
-		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) {
1170
+		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) {
1171 1171
 			// Add unique key
1172 1172
 			$query = "alter table spotter_live add index(latitude,longitude)";
1173 1173
 			try {
1174 1174
 				$sth = $Connection->db->prepare($query);
1175 1175
 				$sth->execute();
1176
-			} catch(PDOException $e) {
1176
+			} catch (PDOException $e) {
1177 1177
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1178 1178
 			}
1179 1179
                 }
1180
-		if (!$Connection->checkColumnName('aircraft','mfr')) {
1180
+		if (!$Connection->checkColumnName('aircraft', 'mfr')) {
1181 1181
 			// Add mfr to aircraft
1182 1182
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
1183 1183
 			try {
1184 1184
 				$sth = $Connection->db->prepare($query);
1185 1185
 				$sth->execute();
1186
-			} catch(PDOException $e) {
1186
+			} catch (PDOException $e) {
1187 1187
 				return "error (add mfr column in aircraft) : ".$e->getMessage()."\n";
1188 1188
 			}
1189 1189
 		}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		try {
1200 1200
 			$sth = $Connection->db->prepare($query);
1201 1201
 			$sth->execute();
1202
-		} catch(PDOException $e) {
1202
+		} catch (PDOException $e) {
1203 1203
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1204 1204
 		}
1205 1205
 		return $error;
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 		global $globalDBdriver;
1210 1210
 		$Connection = new Connection();
1211 1211
 		$error = '';
1212
-		if ($Connection->checkColumnName('aircraft','mfr')) {
1212
+		if ($Connection->checkColumnName('aircraft', 'mfr')) {
1213 1213
 			// drop mfr to aircraft
1214 1214
 			$query = "ALTER TABLE aircraft DROP COLUMN mfr";
1215 1215
 			try {
1216 1216
 				$sth = $Connection->db->prepare($query);
1217 1217
 				$sth->execute();
1218
-			} catch(PDOException $e) {
1218
+			} catch (PDOException $e) {
1219 1219
 				return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n";
1220 1220
 			}
1221 1221
 		}
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		try {
1232 1232
 			$sth = $Connection->db->prepare($query);
1233 1233
 			$sth->execute();
1234
-		} catch(PDOException $e) {
1234
+		} catch (PDOException $e) {
1235 1235
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1236 1236
 		}
1237 1237
 		return $error;
@@ -1241,33 +1241,33 @@  discard block
 block discarded – undo
1241 1241
 		global $globalDBdriver;
1242 1242
 		$Connection = new Connection();
1243 1243
 		$error = '';
1244
-		if (!$Connection->indexExists('notam','ref_idx')) {
1244
+		if (!$Connection->indexExists('notam', 'ref_idx')) {
1245 1245
 			// Add index key
1246 1246
 			$query = "create index ref_idx on notam (ref)";
1247 1247
 			try {
1248 1248
 				$sth = $Connection->db->prepare($query);
1249 1249
 				$sth->execute();
1250
-			} catch(PDOException $e) {
1250
+			} catch (PDOException $e) {
1251 1251
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1252 1252
 			}
1253 1253
                 }
1254
-		if (!$Connection->indexExists('accidents','registration_idx')) {
1254
+		if (!$Connection->indexExists('accidents', 'registration_idx')) {
1255 1255
 			// Add index key
1256 1256
 			$query = "create index registration_idx on accidents (registration)";
1257 1257
 			try {
1258 1258
 				$sth = $Connection->db->prepare($query);
1259 1259
 				$sth->execute();
1260
-			} catch(PDOException $e) {
1260
+			} catch (PDOException $e) {
1261 1261
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1262 1262
 			}
1263 1263
                 }
1264
-		if (!$Connection->indexExists('accidents','rdts')) {
1264
+		if (!$Connection->indexExists('accidents', 'rdts')) {
1265 1265
 			// Add index key
1266 1266
 			$query = "create index rdts on accidents (registration,date,type,source)";
1267 1267
 			try {
1268 1268
 				$sth = $Connection->db->prepare($query);
1269 1269
 				$sth->execute();
1270
-			} catch(PDOException $e) {
1270
+			} catch (PDOException $e) {
1271 1271
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1272 1272
 			}
1273 1273
                 }
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 		try {
1277 1277
 			$sth = $Connection->db->prepare($query);
1278 1278
 			$sth->execute();
1279
-		} catch(PDOException $e) {
1279
+		} catch (PDOException $e) {
1280 1280
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1281 1281
 		}
1282 1282
 		return $error;
@@ -1286,23 +1286,23 @@  discard block
 block discarded – undo
1286 1286
 		global $globalDBdriver;
1287 1287
 		$Connection = new Connection();
1288 1288
 		$error = '';
1289
-		if (!$Connection->checkColumnName('accidents','airline_name')) {
1289
+		if (!$Connection->checkColumnName('accidents', 'airline_name')) {
1290 1290
 			// Add airline_name to accidents
1291 1291
 			$query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL";
1292 1292
 			try {
1293 1293
 				$sth = $Connection->db->prepare($query);
1294 1294
 				$sth->execute();
1295
-			} catch(PDOException $e) {
1295
+			} catch (PDOException $e) {
1296 1296
 				return "error (add airline_name column in accidents) : ".$e->getMessage()."\n";
1297 1297
 			}
1298 1298
 		}
1299
-		if (!$Connection->checkColumnName('accidents','airline_icao')) {
1299
+		if (!$Connection->checkColumnName('accidents', 'airline_icao')) {
1300 1300
 			// Add airline_icao to accidents
1301 1301
 			$query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL";
1302 1302
 			try {
1303 1303
 				$sth = $Connection->db->prepare($query);
1304 1304
 				$sth->execute();
1305
-			} catch(PDOException $e) {
1305
+			} catch (PDOException $e) {
1306 1306
 				return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n";
1307 1307
 			}
1308 1308
 		}
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 		try {
1311 1311
 			$sth = $Connection->db->prepare($query);
1312 1312
 			$sth->execute();
1313
-		} catch(PDOException $e) {
1313
+		} catch (PDOException $e) {
1314 1314
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1315 1315
 		}
1316 1316
 		return $error;
@@ -1320,13 +1320,13 @@  discard block
 block discarded – undo
1320 1320
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1321 1321
 		$Connection = new Connection();
1322 1322
 		$error = '';
1323
-		if (!$Connection->checkColumnName('airlines','alliance')) {
1323
+		if (!$Connection->checkColumnName('airlines', 'alliance')) {
1324 1324
 			// Add alliance to airlines
1325 1325
 			$query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL";
1326 1326
 			try {
1327 1327
 				$sth = $Connection->db->prepare($query);
1328 1328
 				$sth->execute();
1329
-			} catch(PDOException $e) {
1329
+			} catch (PDOException $e) {
1330 1330
 				return "error (add alliance column in airlines) : ".$e->getMessage()."\n";
1331 1331
 			}
1332 1332
 		}
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 		try {
1354 1354
 			$sth = $Connection->db->prepare($query);
1355 1355
 			$sth->execute();
1356
-		} catch(PDOException $e) {
1356
+		} catch (PDOException $e) {
1357 1357
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1358 1358
 		}
1359 1359
 		return $error;
@@ -1363,13 +1363,13 @@  discard block
 block discarded – undo
1363 1363
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1364 1364
 		$Connection = new Connection();
1365 1365
 		$error = '';
1366
-		if (!$Connection->checkColumnName('airlines','ban_eu')) {
1366
+		if (!$Connection->checkColumnName('airlines', 'ban_eu')) {
1367 1367
 			// Add ban_eu to airlines
1368 1368
 			$query = "ALTER TABLE airlines ADD ban_eu INTEGER NOT NULL DEFAULT '0'";
1369 1369
 			try {
1370 1370
 				$sth = $Connection->db->prepare($query);
1371 1371
 				$sth->execute();
1372
-			} catch(PDOException $e) {
1372
+			} catch (PDOException $e) {
1373 1373
 				return "error (add ban_eu column in airlines) : ".$e->getMessage()."\n";
1374 1374
 			}
1375 1375
 		}
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 		try {
1378 1378
 			$sth = $Connection->db->prepare($query);
1379 1379
 			$sth->execute();
1380
-		} catch(PDOException $e) {
1380
+		} catch (PDOException $e) {
1381 1381
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1382 1382
 		}
1383 1383
 		return $error;
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 		    try {
1400 1400
             		$sth = $Connection->db->prepare($query);
1401 1401
 		        $sth->execute();
1402
-		    } catch(PDOException $e) {
1402
+		    } catch (PDOException $e) {
1403 1403
 			return "error : ".$e->getMessage()."\n";
1404 1404
     		    }
1405 1405
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +272 added lines, -102 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1332,20 +1390,28 @@  discard block
 block discarded – undo
1332 1390
 		}
1333 1391
 		if ($globalDBdriver == 'mysql') {
1334 1392
 			$error .= create_db::import_file('../db/airlines.sql');
1335
-			if ($error != '') return $error;
1393
+			if ($error != '') {
1394
+				return $error;
1395
+			}
1336 1396
 		} else {
1337 1397
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1338
-			if ($error != '') return $error;
1398
+			if ($error != '') {
1399
+				return $error;
1400
+			}
1339 1401
 		}
1340 1402
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1341 1403
 			include_once(dirname(__FILE__).'/class.update_db.php');
1342 1404
 			if (isset($globalVATSIM) && $globalVATSIM) {
1343 1405
 				$error .= update_db::update_vatsim();
1344
-				if ($error != '') return $error;
1406
+				if ($error != '') {
1407
+					return $error;
1408
+				}
1345 1409
 			}
1346 1410
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1347 1411
 				$error .= update_db::update_IVAO();
1348
-				if ($error != '') return $error;
1412
+				if ($error != '') {
1413
+					return $error;
1414
+				}
1349 1415
 			}
1350 1416
 		}
1351 1417
 
@@ -1391,8 +1457,11 @@  discard block
 block discarded – undo
1391 1457
     	    if ($Connection->tableExists('aircraft')) {
1392 1458
     		if (!$Connection->tableExists('config')) {
1393 1459
     		    $version = '1';
1394
-    		    if ($update) return self::update_from_1();
1395
-    		    else return $version;
1460
+    		    if ($update) {
1461
+    		    	return self::update_from_1();
1462
+    		    } else {
1463
+    		    	return $version;
1464
+    		    }
1396 1465
 		} else {
1397 1466
     		    $Connection = new Connection();
1398 1467
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -1406,138 +1475,239 @@  discard block
 block discarded – undo
1406 1475
     		    if ($update) {
1407 1476
     			if ($result['value'] == '2') {
1408 1477
     			    $error = self::update_from_2();
1409
-    			    if ($error != '') return $error;
1410
-    			    else return self::check_version(true);
1478
+    			    if ($error != '') {
1479
+    			    	return $error;
1480
+    			    } else {
1481
+    			    	return self::check_version(true);
1482
+    			    }
1411 1483
     			} elseif ($result['value'] == '3') {
1412 1484
     			    $error = self::update_from_3();
1413
-    			    if ($error != '') return $error;
1414
-    			    else return self::check_version(true);
1485
+    			    if ($error != '') {
1486
+    			    	return $error;
1487
+    			    } else {
1488
+    			    	return self::check_version(true);
1489
+    			    }
1415 1490
     			} elseif ($result['value'] == '4') {
1416 1491
     			    $error = self::update_from_4();
1417
-    			    if ($error != '') return $error;
1418
-    			    else return self::check_version(true);
1492
+    			    if ($error != '') {
1493
+    			    	return $error;
1494
+    			    } else {
1495
+    			    	return self::check_version(true);
1496
+    			    }
1419 1497
     			} elseif ($result['value'] == '5') {
1420 1498
     			    $error = self::update_from_5();
1421
-    			    if ($error != '') return $error;
1422
-    			    else return self::check_version(true);
1499
+    			    if ($error != '') {
1500
+    			    	return $error;
1501
+    			    } else {
1502
+    			    	return self::check_version(true);
1503
+    			    }
1423 1504
     			} elseif ($result['value'] == '6') {
1424 1505
     			    $error = self::update_from_6();
1425
-    			    if ($error != '') return $error;
1426
-    			    else return self::check_version(true);
1506
+    			    if ($error != '') {
1507
+    			    	return $error;
1508
+    			    } else {
1509
+    			    	return self::check_version(true);
1510
+    			    }
1427 1511
     			} elseif ($result['value'] == '7') {
1428 1512
     			    $error = self::update_from_7();
1429
-    			    if ($error != '') return $error;
1430
-    			    else return self::check_version(true);
1513
+    			    if ($error != '') {
1514
+    			    	return $error;
1515
+    			    } else {
1516
+    			    	return self::check_version(true);
1517
+    			    }
1431 1518
     			} elseif ($result['value'] == '8') {
1432 1519
     			    $error = self::update_from_8();
1433
-    			    if ($error != '') return $error;
1434
-    			    else return self::check_version(true);
1520
+    			    if ($error != '') {
1521
+    			    	return $error;
1522
+    			    } else {
1523
+    			    	return self::check_version(true);
1524
+    			    }
1435 1525
     			} elseif ($result['value'] == '9') {
1436 1526
     			    $error = self::update_from_9();
1437
-    			    if ($error != '') return $error;
1438
-    			    else return self::check_version(true);
1527
+    			    if ($error != '') {
1528
+    			    	return $error;
1529
+    			    } else {
1530
+    			    	return self::check_version(true);
1531
+    			    }
1439 1532
     			} elseif ($result['value'] == '10') {
1440 1533
     			    $error = self::update_from_10();
1441
-    			    if ($error != '') return $error;
1442
-    			    else return self::check_version(true);
1534
+    			    if ($error != '') {
1535
+    			    	return $error;
1536
+    			    } else {
1537
+    			    	return self::check_version(true);
1538
+    			    }
1443 1539
     			} elseif ($result['value'] == '11') {
1444 1540
     			    $error = self::update_from_11();
1445
-    			    if ($error != '') return $error;
1446
-    			    else return self::check_version(true);
1541
+    			    if ($error != '') {
1542
+    			    	return $error;
1543
+    			    } else {
1544
+    			    	return self::check_version(true);
1545
+    			    }
1447 1546
     			} elseif ($result['value'] == '12') {
1448 1547
     			    $error = self::update_from_12();
1449
-    			    if ($error != '') return $error;
1450
-    			    else return self::check_version(true);
1548
+    			    if ($error != '') {
1549
+    			    	return $error;
1550
+    			    } else {
1551
+    			    	return self::check_version(true);
1552
+    			    }
1451 1553
     			} elseif ($result['value'] == '13') {
1452 1554
     			    $error = self::update_from_13();
1453
-    			    if ($error != '') return $error;
1454
-    			    else return self::check_version(true);
1555
+    			    if ($error != '') {
1556
+    			    	return $error;
1557
+    			    } else {
1558
+    			    	return self::check_version(true);
1559
+    			    }
1455 1560
     			} elseif ($result['value'] == '14') {
1456 1561
     			    $error = self::update_from_14();
1457
-    			    if ($error != '') return $error;
1458
-    			    else return self::check_version(true);
1562
+    			    if ($error != '') {
1563
+    			    	return $error;
1564
+    			    } else {
1565
+    			    	return self::check_version(true);
1566
+    			    }
1459 1567
     			} elseif ($result['value'] == '15') {
1460 1568
     			    $error = self::update_from_15();
1461
-    			    if ($error != '') return $error;
1462
-    			    else return self::check_version(true);
1569
+    			    if ($error != '') {
1570
+    			    	return $error;
1571
+    			    } else {
1572
+    			    	return self::check_version(true);
1573
+    			    }
1463 1574
     			} elseif ($result['value'] == '16') {
1464 1575
     			    $error = self::update_from_16();
1465
-    			    if ($error != '') return $error;
1466
-    			    else return self::check_version(true);
1576
+    			    if ($error != '') {
1577
+    			    	return $error;
1578
+    			    } else {
1579
+    			    	return self::check_version(true);
1580
+    			    }
1467 1581
     			} elseif ($result['value'] == '17') {
1468 1582
     			    $error = self::update_from_17();
1469
-    			    if ($error != '') return $error;
1470
-    			    else return self::check_version(true);
1583
+    			    if ($error != '') {
1584
+    			    	return $error;
1585
+    			    } else {
1586
+    			    	return self::check_version(true);
1587
+    			    }
1471 1588
     			} elseif ($result['value'] == '18') {
1472 1589
     			    $error = self::update_from_18();
1473
-    			    if ($error != '') return $error;
1474
-    			    else return self::check_version(true);
1590
+    			    if ($error != '') {
1591
+    			    	return $error;
1592
+    			    } else {
1593
+    			    	return self::check_version(true);
1594
+    			    }
1475 1595
     			} elseif ($result['value'] == '19') {
1476 1596
     			    $error = self::update_from_19();
1477
-    			    if ($error != '') return $error;
1478
-    			    else return self::check_version(true);
1597
+    			    if ($error != '') {
1598
+    			    	return $error;
1599
+    			    } else {
1600
+    			    	return self::check_version(true);
1601
+    			    }
1479 1602
     			} elseif ($result['value'] == '20') {
1480 1603
     			    $error = self::update_from_20();
1481
-    			    if ($error != '') return $error;
1482
-    			    else return self::check_version(true);
1604
+    			    if ($error != '') {
1605
+    			    	return $error;
1606
+    			    } else {
1607
+    			    	return self::check_version(true);
1608
+    			    }
1483 1609
     			} elseif ($result['value'] == '21') {
1484 1610
     			    $error = self::update_from_21();
1485
-    			    if ($error != '') return $error;
1486
-    			    else return self::check_version(true);
1611
+    			    if ($error != '') {
1612
+    			    	return $error;
1613
+    			    } else {
1614
+    			    	return self::check_version(true);
1615
+    			    }
1487 1616
     			} elseif ($result['value'] == '22') {
1488 1617
     			    $error = self::update_from_22();
1489
-    			    if ($error != '') return $error;
1490
-    			    else return self::check_version(true);
1618
+    			    if ($error != '') {
1619
+    			    	return $error;
1620
+    			    } else {
1621
+    			    	return self::check_version(true);
1622
+    			    }
1491 1623
     			} elseif ($result['value'] == '23') {
1492 1624
     			    $error = self::update_from_23();
1493
-    			    if ($error != '') return $error;
1494
-    			    else return self::check_version(true);
1625
+    			    if ($error != '') {
1626
+    			    	return $error;
1627
+    			    } else {
1628
+    			    	return self::check_version(true);
1629
+    			    }
1495 1630
     			} elseif ($result['value'] == '24') {
1496 1631
     			    $error = self::update_from_24();
1497
-    			    if ($error != '') return $error;
1498
-    			    else return self::check_version(true);
1632
+    			    if ($error != '') {
1633
+    			    	return $error;
1634
+    			    } else {
1635
+    			    	return self::check_version(true);
1636
+    			    }
1499 1637
     			} elseif ($result['value'] == '25') {
1500 1638
     			    $error = self::update_from_25();
1501
-    			    if ($error != '') return $error;
1502
-    			    else return self::check_version(true);
1639
+    			    if ($error != '') {
1640
+    			    	return $error;
1641
+    			    } else {
1642
+    			    	return self::check_version(true);
1643
+    			    }
1503 1644
     			} elseif ($result['value'] == '26') {
1504 1645
     			    $error = self::update_from_26();
1505
-    			    if ($error != '') return $error;
1506
-    			    else return self::check_version(true);
1646
+    			    if ($error != '') {
1647
+    			    	return $error;
1648
+    			    } else {
1649
+    			    	return self::check_version(true);
1650
+    			    }
1507 1651
     			} elseif ($result['value'] == '27') {
1508 1652
     			    $error = self::update_from_27();
1509
-    			    if ($error != '') return $error;
1510
-    			    else return self::check_version(true);
1653
+    			    if ($error != '') {
1654
+    			    	return $error;
1655
+    			    } else {
1656
+    			    	return self::check_version(true);
1657
+    			    }
1511 1658
     			} elseif ($result['value'] == '28') {
1512 1659
     			    $error = self::update_from_28();
1513
-    			    if ($error != '') return $error;
1514
-    			    else return self::check_version(true);
1660
+    			    if ($error != '') {
1661
+    			    	return $error;
1662
+    			    } else {
1663
+    			    	return self::check_version(true);
1664
+    			    }
1515 1665
     			} elseif ($result['value'] == '29') {
1516 1666
     			    $error = self::update_from_29();
1517
-    			    if ($error != '') return $error;
1518
-    			    else return self::check_version(true);
1667
+    			    if ($error != '') {
1668
+    			    	return $error;
1669
+    			    } else {
1670
+    			    	return self::check_version(true);
1671
+    			    }
1519 1672
     			} elseif ($result['value'] == '30') {
1520 1673
     			    $error = self::update_from_30();
1521
-    			    if ($error != '') return $error;
1522
-    			    else return self::check_version(true);
1674
+    			    if ($error != '') {
1675
+    			    	return $error;
1676
+    			    } else {
1677
+    			    	return self::check_version(true);
1678
+    			    }
1523 1679
     			} elseif ($result['value'] == '31') {
1524 1680
     			    $error = self::update_from_31();
1525
-    			    if ($error != '') return $error;
1526
-    			    else return self::check_version(true);
1681
+    			    if ($error != '') {
1682
+    			    	return $error;
1683
+    			    } else {
1684
+    			    	return self::check_version(true);
1685
+    			    }
1527 1686
     			} elseif ($result['value'] == '32') {
1528 1687
     			    $error = self::update_from_32();
1529
-    			    if ($error != '') return $error;
1530
-    			    else return self::check_version(true);
1688
+    			    if ($error != '') {
1689
+    			    	return $error;
1690
+    			    } else {
1691
+    			    	return self::check_version(true);
1692
+    			    }
1531 1693
     			} elseif ($result['value'] == '33') {
1532 1694
     			    $error = self::update_from_33();
1533
-    			    if ($error != '') return $error;
1534
-    			    else return self::check_version(true);
1535
-    			} else return '';
1695
+    			    if ($error != '') {
1696
+    			    	return $error;
1697
+    			    } else {
1698
+    			    	return self::check_version(true);
1699
+    			    }
1700
+    			} else {
1701
+    				return '';
1702
+    			}
1703
+    		    } else {
1704
+    		    	return $result['value'];
1536 1705
     		    }
1537
-    		    else return $result['value'];
1538 1706
 		}
1539 1707
 		
1540
-	    } else return $version;
1708
+	    } else {
1709
+	    	return $version;
1710
+	    }
1541 1711
     	}
1542 1712
     	
1543 1713
 }
Please login to merge, or discard this patch.
require/class.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   +1422 added lines, -1422 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
64 64
 		$filters = array();
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Executes the SQL statements to get the spotter information
133
-	*
134
-	* @param String $query the SQL query
135
-	* @param Array $params parameter of the query
136
-	* @param String $limitQuery the limit query
137
-	* @return Array the spotter information
138
-	*
139
-	*/
132
+	 * Executes the SQL statements to get the spotter information
133
+	 *
134
+	 * @param String $query the SQL query
135
+	 * @param Array $params parameter of the query
136
+	 * @param String $limitQuery the limit query
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 301
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302 302
 					} else $temp_array['aircraft_shadow'] = 'default.png';
303
-                                } else {
304
-                            		$temp_array['aircraft_shadow'] = 'default.png';
303
+								} else {
304
+									$temp_array['aircraft_shadow'] = 'default.png';
305 305
 					$temp_array['aircraft_name'] = 'N/A';
306 306
 					$temp_array['aircraft_manufacturer'] = 'N/A';
307
-                            	}
307
+								}
308 308
 			}
309 309
 			$fromsource = NULL;
310 310
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -500,11 +500,11 @@  discard block
 block discarded – undo
500 500
 	
501 501
 	
502 502
 	/**
503
-	* Gets all the spotter information
504
-	*
505
-	* @return Array the spotter information
506
-	*
507
-	*/
503
+	 * Gets all the spotter information
504
+	 *
505
+	 * @return Array the spotter information
506
+	 *
507
+	 */
508 508
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
509 509
 	{
510 510
 		global $globalTimezone, $globalDBdriver;
@@ -851,11 +851,11 @@  discard block
 block discarded – undo
851 851
 	
852 852
 	
853 853
 	/**
854
-	* Gets all the spotter information based on the latest data entry
855
-	*
856
-	* @return Array the spotter information
857
-	*
858
-	*/
854
+	 * Gets all the spotter information based on the latest data entry
855
+	 *
856
+	 * @return Array the spotter information
857
+	 *
858
+	 */
859 859
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
860 860
 	{
861 861
 		global $global_query;
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
 	}
895 895
     
896 896
     
897
-    /**
898
-	* Gets all the spotter information based on a user's latitude and longitude
899
-	*
900
-	* @return Array the spotter information
901
-	*
902
-	*/
897
+	/**
898
+	 * Gets all the spotter information based on a user's latitude and longitude
899
+	 *
900
+	 * @return Array the spotter information
901
+	 *
902
+	 */
903 903
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
904 904
 	{
905 905
 		date_default_timezone_set('UTC');
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 				return false;
928 928
 			}
929 929
 		}
930
-    		$additional_query = '';
930
+			$additional_query = '';
931 931
 		if ($interval != "")
932 932
 		{
933 933
 			if (!is_string($interval))
@@ -967,12 +967,12 @@  discard block
 block discarded – undo
967 967
 	}
968 968
     
969 969
     
970
-    /**
971
-	* Gets all the spotter information sorted by the newest aircraft type
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
970
+	/**
971
+	 * Gets all the spotter information sorted by the newest aircraft type
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1013,11 +1013,11 @@  discard block
 block discarded – undo
1013 1013
     
1014 1014
     
1015 1015
 	/**
1016
-	* Gets all the spotter information sorted by the newest aircraft registration
1017
-	*
1018
-	* @return Array the spotter information
1019
-	*
1020
-	*/
1016
+	 * Gets all the spotter information sorted by the newest aircraft registration
1017
+	 *
1018
+	 * @return Array the spotter information
1019
+	 *
1020
+	 */
1021 1021
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1022 1022
 	{
1023 1023
 		global $global_query;
@@ -1057,11 +1057,11 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 
1059 1059
 	/**
1060
-	* Gets all the spotter information sorted by the newest airline
1061
-	*
1062
-	* @return Array the spotter information
1063
-	*
1064
-	*/
1060
+	 * Gets all the spotter information sorted by the newest airline
1061
+	 *
1062
+	 * @return Array the spotter information
1063
+	 *
1064
+	 */
1065 1065
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
@@ -1100,12 +1100,12 @@  discard block
 block discarded – undo
1100 1100
 	}
1101 1101
     
1102 1102
     
1103
-    /**
1104
-	* Gets all the spotter information sorted by the newest departure airport
1105
-	*
1106
-	* @return Array the spotter information
1107
-	*
1108
-	*/
1103
+	/**
1104
+	 * Gets all the spotter information sorted by the newest departure airport
1105
+	 *
1106
+	 * @return Array the spotter information
1107
+	 *
1108
+	 */
1109 1109
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1110 1110
 	{
1111 1111
 		global $global_query;
@@ -1147,11 +1147,11 @@  discard block
 block discarded – undo
1147 1147
 
1148 1148
 
1149 1149
 	/**
1150
-	* Gets all the spotter information sorted by the newest arrival airport
1151
-	*
1152
-	* @return Array the spotter information
1153
-	*
1154
-	*/
1150
+	 * Gets all the spotter information sorted by the newest arrival airport
1151
+	 *
1152
+	 * @return Array the spotter information
1153
+	 *
1154
+	 */
1155 1155
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1156 1156
 	{
1157 1157
 		global $global_query;
@@ -1190,11 +1190,11 @@  discard block
 block discarded – undo
1190 1190
 	
1191 1191
 
1192 1192
 	/**
1193
-	* Gets all the spotter information based on the spotter id
1194
-	*
1195
-	* @return Array the spotter information
1196
-	*
1197
-	*/
1193
+	 * Gets all the spotter information based on the spotter id
1194
+	 *
1195
+	 * @return Array the spotter information
1196
+	 *
1197
+	 */
1198 1198
 	public function getSpotterDataByID($id = '')
1199 1199
 	{
1200 1200
 		global $global_query;
@@ -1216,11 +1216,11 @@  discard block
 block discarded – undo
1216 1216
 	
1217 1217
 	
1218 1218
 	/**
1219
-	* Gets all the spotter information based on the callsign
1220
-	*
1221
-	* @return Array the spotter information
1222
-	*
1223
-	*/
1219
+	 * Gets all the spotter information based on the callsign
1220
+	 *
1221
+	 * @return Array the spotter information
1222
+	 *
1223
+	 */
1224 1224
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1225 1225
 	{
1226 1226
 		global $global_query;
@@ -1271,11 +1271,11 @@  discard block
 block discarded – undo
1271 1271
 	}
1272 1272
 	
1273 1273
 	/**
1274
-	* Gets all the spotter information based on the owner
1275
-	*
1276
-	* @return Array the spotter information
1277
-	*
1278
-	*/
1274
+	 * Gets all the spotter information based on the owner
1275
+	 *
1276
+	 * @return Array the spotter information
1277
+	 *
1278
+	 */
1279 1279
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '')
1280 1280
 	{
1281 1281
 		global $global_query;
@@ -1326,11 +1326,11 @@  discard block
 block discarded – undo
1326 1326
 	}
1327 1327
 	
1328 1328
 	/**
1329
-	* Gets all the spotter information based on the pilot
1330
-	*
1331
-	* @return Array the spotter information
1332
-	*
1333
-	*/
1329
+	 * Gets all the spotter information based on the pilot
1330
+	 *
1331
+	 * @return Array the spotter information
1332
+	 *
1333
+	 */
1334 1334
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '')
1335 1335
 	{
1336 1336
 		global $global_query;
@@ -1378,11 +1378,11 @@  discard block
 block discarded – undo
1378 1378
 	
1379 1379
 	
1380 1380
 	/**
1381
-	* Gets all the spotter information based on the aircraft type
1382
-	*
1383
-	* @return Array the spotter information
1384
-	*
1385
-	*/
1381
+	 * Gets all the spotter information based on the aircraft type
1382
+	 *
1383
+	 * @return Array the spotter information
1384
+	 *
1385
+	 */
1386 1386
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1387 1387
 	{
1388 1388
 		global $global_query;
@@ -1436,11 +1436,11 @@  discard block
 block discarded – undo
1436 1436
 	
1437 1437
 	
1438 1438
 	/**
1439
-	* Gets all the spotter information based on the aircraft registration
1440
-	*
1441
-	* @return Array the spotter information
1442
-	*
1443
-	*/
1439
+	 * Gets all the spotter information based on the aircraft registration
1440
+	 *
1441
+	 * @return Array the spotter information
1442
+	 *
1443
+	 */
1444 1444
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1445 1445
 	{
1446 1446
 		global $global_query;
@@ -1497,11 +1497,11 @@  discard block
 block discarded – undo
1497 1497
 	
1498 1498
 	
1499 1499
 	/**
1500
-	* Gets all the spotter information based on the airline
1501
-	*
1502
-	* @return Array the spotter information
1503
-	*
1504
-	*/
1500
+	 * Gets all the spotter information based on the airline
1501
+	 *
1502
+	 * @return Array the spotter information
1503
+	 *
1504
+	 */
1505 1505
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1506 1506
 	{
1507 1507
 		global $global_query;
@@ -1554,11 +1554,11 @@  discard block
 block discarded – undo
1554 1554
 	
1555 1555
 	
1556 1556
 	/**
1557
-	* Gets all the spotter information based on the airport
1558
-	*
1559
-	* @return Array the spotter information
1560
-	*
1561
-	*/
1557
+	 * Gets all the spotter information based on the airport
1558
+	 *
1559
+	 * @return Array the spotter information
1560
+	 *
1561
+	 */
1562 1562
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1563 1563
 	{
1564 1564
 		global $global_query;
@@ -1612,11 +1612,11 @@  discard block
 block discarded – undo
1612 1612
 
1613 1613
 
1614 1614
 	/**
1615
-	* Gets all the spotter information based on the date
1616
-	*
1617
-	* @return Array the spotter information
1618
-	*
1619
-	*/
1615
+	 * Gets all the spotter information based on the date
1616
+	 *
1617
+	 * @return Array the spotter information
1618
+	 *
1619
+	 */
1620 1620
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1621 1621
 	{
1622 1622
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 
1681 1681
 
1682 1682
 	/**
1683
-	* Gets all the spotter information based on the country name
1684
-	*
1685
-	* @return Array the spotter information
1686
-	*
1687
-	*/
1683
+	 * Gets all the spotter information based on the country name
1684
+	 *
1685
+	 * @return Array the spotter information
1686
+	 *
1687
+	 */
1688 1688
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1689 1689
 	{
1690 1690
 		global $global_query;
@@ -1738,11 +1738,11 @@  discard block
 block discarded – undo
1738 1738
 	
1739 1739
 	
1740 1740
 	/**
1741
-	* Gets all the spotter information based on the manufacturer name
1742
-	*
1743
-	* @return Array the spotter information
1744
-	*
1745
-	*/
1741
+	 * Gets all the spotter information based on the manufacturer name
1742
+	 *
1743
+	 * @return Array the spotter information
1744
+	 *
1745
+	 */
1746 1746
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1747 1747
 	{
1748 1748
 		global $global_query;
@@ -1798,13 +1798,13 @@  discard block
 block discarded – undo
1798 1798
   
1799 1799
   
1800 1800
 	/**
1801
-	* Gets a list of all aircraft that take a route
1802
-	*
1803
-	* @param String $departure_airport_icao ICAO code of departure airport
1804
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1805
-	* @return Array the spotter information
1806
-	*
1807
-	*/
1801
+	 * Gets a list of all aircraft that take a route
1802
+	 *
1803
+	 * @param String $departure_airport_icao ICAO code of departure airport
1804
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1805
+	 * @return Array the spotter information
1806
+	 *
1807
+	 */
1808 1808
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1809 1809
 	{
1810 1810
 		global $global_query;
@@ -1873,11 +1873,11 @@  discard block
 block discarded – undo
1873 1873
 	
1874 1874
 	
1875 1875
 	/**
1876
-	* Gets all the spotter information based on the special column in the table
1877
-	*
1878
-	* @return Array the spotter information
1879
-	*
1880
-	*/
1876
+	 * Gets all the spotter information based on the special column in the table
1877
+	 *
1878
+	 * @return Array the spotter information
1879
+	 *
1880
+	 */
1881 1881
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1882 1882
 	{
1883 1883
 		global $global_query;
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
 	}
1917 1917
 
1918 1918
 	/**
1919
-	* Gets all the highlight based on a aircraft registration
1920
-	*
1921
-	* @return String the highlight text
1922
-	*
1923
-	*/
1919
+	 * Gets all the highlight based on a aircraft registration
1920
+	 *
1921
+	 * @return String the highlight text
1922
+	 *
1923
+	 */
1924 1924
 	public function getHighlightByRegistration($registration,$filter = array())
1925 1925
 	{
1926 1926
 		global $global_query;
@@ -1942,13 +1942,13 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 	
1944 1944
 	/**
1945
-	* Gets the squawk usage from squawk code
1946
-	*
1947
-	* @param String $squawk squawk code
1948
-	* @param String $country country
1949
-	* @return String usage
1950
-	*
1951
-	*/
1945
+	 * Gets the squawk usage from squawk code
1946
+	 *
1947
+	 * @param String $squawk squawk code
1948
+	 * @param String $country country
1949
+	 * @return String usage
1950
+	 *
1951
+	 */
1952 1952
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1953 1953
 	{
1954 1954
 		
@@ -1969,12 +1969,12 @@  discard block
 block discarded – undo
1969 1969
 	}
1970 1970
 
1971 1971
 	/**
1972
-	* Gets the airport icao from the iata
1973
-	*
1974
-	* @param String $airport_iata the iata code of the airport
1975
-	* @return String airport iata
1976
-	*
1977
-	*/
1972
+	 * Gets the airport icao from the iata
1973
+	 *
1974
+	 * @param String $airport_iata the iata code of the airport
1975
+	 * @return String airport iata
1976
+	 *
1977
+	 */
1978 1978
 	public function getAirportIcao($airport_iata = '')
1979 1979
 	{
1980 1980
 		
@@ -1994,14 +1994,14 @@  discard block
 block discarded – undo
1994 1994
 	}
1995 1995
 
1996 1996
 	/**
1997
-	* Gets the airport distance
1998
-	*
1999
-	* @param String $airport_icao the icao code of the airport
2000
-	* @param Float $latitude the latitude
2001
-	* @param Float $longitude the longitude
2002
-	* @return Float distance to the airport
2003
-	*
2004
-	*/
1997
+	 * Gets the airport distance
1998
+	 *
1999
+	 * @param String $airport_icao the icao code of the airport
2000
+	 * @param Float $latitude the latitude
2001
+	 * @param Float $longitude the longitude
2002
+	 * @return Float distance to the airport
2003
+	 *
2004
+	 */
2005 2005
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2006 2006
 	{
2007 2007
 		
@@ -2022,12 +2022,12 @@  discard block
 block discarded – undo
2022 2022
 	}
2023 2023
 	
2024 2024
 	/**
2025
-	* Gets the airport info based on the icao
2026
-	*
2027
-	* @param String $airport the icao code of the airport
2028
-	* @return Array airport information
2029
-	*
2030
-	*/
2025
+	 * Gets the airport info based on the icao
2026
+	 *
2027
+	 * @param String $airport the icao code of the airport
2028
+	 * @return Array airport information
2029
+	 *
2030
+	 */
2031 2031
 	public function getAllAirportInfo($airport = '')
2032 2032
 	{
2033 2033
 		
@@ -2073,12 +2073,12 @@  discard block
 block discarded – undo
2073 2073
 	}
2074 2074
 	
2075 2075
 	/**
2076
-	* Gets the airport info based on the country
2077
-	*
2078
-	* @param Array $countries Airports countries
2079
-	* @return Array airport information
2080
-	*
2081
-	*/
2076
+	 * Gets the airport info based on the country
2077
+	 *
2078
+	 * @param Array $countries Airports countries
2079
+	 * @return Array airport information
2080
+	 *
2081
+	 */
2082 2082
 	public function getAllAirportInfobyCountry($countries)
2083 2083
 	{
2084 2084
 		$lst_countries = '';
@@ -2116,12 +2116,12 @@  discard block
 block discarded – undo
2116 2116
 	}
2117 2117
 	
2118 2118
 	/**
2119
-	* Gets airports info based on the coord
2120
-	*
2121
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2122
-	* @return Array airport information
2123
-	*
2124
-	*/
2119
+	 * Gets airports info based on the coord
2120
+	 *
2121
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2122
+	 * @return Array airport information
2123
+	 *
2124
+	 */
2125 2125
 	public function getAllAirportInfobyCoord($coord)
2126 2126
 	{
2127 2127
 		global $globalDBdriver;
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	}
2153 2153
 
2154 2154
 	/**
2155
-	* Gets waypoints info based on the coord
2156
-	*
2157
-	* @param Array $coord waypoints coord
2158
-	* @return Array airport information
2159
-	*
2160
-	*/
2155
+	 * Gets waypoints info based on the coord
2156
+	 *
2157
+	 * @param Array $coord waypoints coord
2158
+	 * @return Array airport information
2159
+	 *
2160
+	 */
2161 2161
 	public function getAllWaypointsInfobyCoord($coord)
2162 2162
 	{
2163 2163
 		if (is_array($coord)) {
@@ -2191,12 +2191,12 @@  discard block
 block discarded – undo
2191 2191
 	
2192 2192
 	
2193 2193
 	/**
2194
-	* Gets the airline info based on the icao code or iata code
2195
-	*
2196
-	* @param String $airline_icao the iata code of the airport
2197
-	* @return Array airport information
2198
-	*
2199
-	*/
2194
+	 * Gets the airline info based on the icao code or iata code
2195
+	 *
2196
+	 * @param String $airline_icao the iata code of the airport
2197
+	 * @return Array airport information
2198
+	 *
2199
+	 */
2200 2200
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2201 2201
 	{
2202 2202
 		global $globalUseRealAirlines;
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
 			} else {
2228 2228
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2229 2229
 			}
2230
-                        /*
2230
+						/*
2231 2231
 			$airline_array = array();
2232 2232
 			$temp_array = array();
2233 2233
 		
@@ -2260,12 +2260,12 @@  discard block
 block discarded – undo
2260 2260
 	}
2261 2261
 	
2262 2262
 	/**
2263
-	* Gets the airline info based on the airline name
2264
-	*
2265
-	* @param String $airline_name the name of the airline
2266
-	* @return Array airline information
2267
-	*
2268
-	*/
2263
+	 * Gets the airline info based on the airline name
2264
+	 *
2265
+	 * @param String $airline_name the name of the airline
2266
+	 * @return Array airline information
2267
+	 *
2268
+	 */
2269 2269
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2270 2270
 	{
2271 2271
 		global $globalUseRealAirlines;
@@ -2293,12 +2293,12 @@  discard block
 block discarded – undo
2293 2293
 	
2294 2294
 	
2295 2295
 	/**
2296
-	* Gets the aircraft info based on the aircraft type
2297
-	*
2298
-	* @param String $aircraft_type the aircraft type
2299
-	* @return Array aircraft information
2300
-	*
2301
-	*/
2296
+	 * Gets the aircraft info based on the aircraft type
2297
+	 *
2298
+	 * @param String $aircraft_type the aircraft type
2299
+	 * @return Array aircraft information
2300
+	 *
2301
+	 */
2302 2302
 	public function getAllAircraftInfo($aircraft_type)
2303 2303
 	{
2304 2304
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2330,12 +2330,12 @@  discard block
 block discarded – undo
2330 2330
 	}
2331 2331
 
2332 2332
 	/**
2333
-	* Gets the aircraft icao based on the aircraft name/type
2334
-	*
2335
-	* @param String $aircraft_type the aircraft type
2336
-	* @return String aircraft information
2337
-	*
2338
-	*/
2333
+	 * Gets the aircraft icao based on the aircraft name/type
2334
+	 *
2335
+	 * @param String $aircraft_type the aircraft type
2336
+	 * @return String aircraft information
2337
+	 *
2338
+	 */
2339 2339
 	public function getAircraftIcao($aircraft_type)
2340 2340
 	{
2341 2341
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2360,12 +2360,12 @@  discard block
 block discarded – undo
2360 2360
 	}
2361 2361
 	
2362 2362
 	/**
2363
-	* Gets the aircraft info based on the aircraft modes
2364
-	*
2365
-	* @param String $aircraft_modes the aircraft ident (hex)
2366
-	* @return String aircraft type
2367
-	*
2368
-	*/
2363
+	 * Gets the aircraft info based on the aircraft modes
2364
+	 *
2365
+	 * @param String $aircraft_modes the aircraft ident (hex)
2366
+	 * @return String aircraft type
2367
+	 *
2368
+	 */
2369 2369
 	public function getAllAircraftType($aircraft_modes)
2370 2370
 	{
2371 2371
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2385,12 +2385,12 @@  discard block
 block discarded – undo
2385 2385
 	}
2386 2386
 
2387 2387
 	/**
2388
-	* Gets the aircraft info based on the aircraft registration
2389
-	*
2390
-	* @param String $registration the aircraft registration
2391
-	* @return String aircraft type
2392
-	*
2393
-	*/
2388
+	 * Gets the aircraft info based on the aircraft registration
2389
+	 *
2390
+	 * @param String $registration the aircraft registration
2391
+	 * @return String aircraft type
2392
+	 *
2393
+	 */
2394 2394
 	public function getAllAircraftTypeByRegistration($registration)
2395 2395
 	{
2396 2396
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2408,12 +2408,12 @@  discard block
 block discarded – undo
2408 2408
 	}
2409 2409
 
2410 2410
 	/**
2411
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2412
-	*
2413
-	* @param String $registration the aircraft registration
2414
-	* @return Array spotter_id and flightaware_id
2415
-	*
2416
-	*/
2411
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2412
+	 *
2413
+	 * @param String $registration the aircraft registration
2414
+	 * @return Array spotter_id and flightaware_id
2415
+	 *
2416
+	 */
2417 2417
 	public function getAllIDByRegistration($registration)
2418 2418
 	{
2419 2419
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2432,12 +2432,12 @@  discard block
 block discarded – undo
2432 2432
 	}
2433 2433
 
2434 2434
 	/**
2435
-	* Gets correct aircraft operator code
2436
-	*
2437
-	* @param String $operator the aircraft operator code (callsign)
2438
-	* @return String aircraft operator code
2439
-	*
2440
-	*/
2435
+	 * Gets correct aircraft operator code
2436
+	 *
2437
+	 * @param String $operator the aircraft operator code (callsign)
2438
+	 * @return String aircraft operator code
2439
+	 *
2440
+	 */
2441 2441
 	public function getOperator($operator)
2442 2442
 	{
2443 2443
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2454,16 +2454,16 @@  discard block
 block discarded – undo
2454 2454
 	}
2455 2455
 
2456 2456
 	/**
2457
-	* Gets the aircraft route based on the aircraft callsign
2458
-	*
2459
-	* @param String $callsign the aircraft callsign
2460
-	* @return Array aircraft type
2461
-	*
2462
-	*/
2457
+	 * Gets the aircraft route based on the aircraft callsign
2458
+	 *
2459
+	 * @param String $callsign the aircraft callsign
2460
+	 * @return Array aircraft type
2461
+	 *
2462
+	 */
2463 2463
 	public function getRouteInfo($callsign)
2464 2464
 	{
2465 2465
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2466
-                if ($callsign == '') return array();
2466
+				if ($callsign == '') return array();
2467 2467
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2468 2468
 		
2469 2469
 		$sth = $this->db->prepare($query);
@@ -2477,12 +2477,12 @@  discard block
 block discarded – undo
2477 2477
 	}
2478 2478
 	
2479 2479
 	/**
2480
-	* Gets the aircraft info based on the aircraft registration
2481
-	*
2482
-	* @param String $registration the aircraft registration
2483
-	* @return Array aircraft information
2484
-	*
2485
-	*/
2480
+	 * Gets the aircraft info based on the aircraft registration
2481
+	 *
2482
+	 * @param String $registration the aircraft registration
2483
+	 * @return Array aircraft information
2484
+	 *
2485
+	 */
2486 2486
 	public function getAircraftInfoByRegistration($registration)
2487 2487
 	{
2488 2488
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2509,12 +2509,12 @@  discard block
 block discarded – undo
2509 2509
 	}
2510 2510
 	
2511 2511
 	/**
2512
-	* Gets the aircraft owner & base based on the aircraft registration
2513
-	*
2514
-	* @param String $registration the aircraft registration
2515
-	* @return Array aircraft information
2516
-	*
2517
-	*/
2512
+	 * Gets the aircraft owner & base based on the aircraft registration
2513
+	 *
2514
+	 * @param String $registration the aircraft registration
2515
+	 * @return Array aircraft information
2516
+	 *
2517
+	 */
2518 2518
 	public function getAircraftOwnerByRegistration($registration)
2519 2519
 	{
2520 2520
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2531,11 +2531,11 @@  discard block
 block discarded – undo
2531 2531
 	
2532 2532
   
2533 2533
   /**
2534
-	* Gets all flights (but with only little info)
2535
-	*
2536
-	* @return Array basic flight information
2537
-	*
2538
-	*/
2534
+   * Gets all flights (but with only little info)
2535
+   *
2536
+   * @return Array basic flight information
2537
+   *
2538
+   */
2539 2539
 	public function getAllFlightsforSitemap()
2540 2540
 	{
2541 2541
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
 		
2544 2544
 		$sth = $this->db->prepare($query);
2545 2545
 		$sth->execute();
2546
-                  /*
2546
+				  /*
2547 2547
 		$flight_array = array();
2548 2548
 		$temp_array = array();
2549 2549
 		
@@ -2565,11 +2565,11 @@  discard block
 block discarded – undo
2565 2565
 	}
2566 2566
   
2567 2567
 	/**
2568
-	* Gets a list of all aircraft manufacturers
2569
-	*
2570
-	* @return Array list of aircraft types
2571
-	*
2572
-	*/
2568
+	 * Gets a list of all aircraft manufacturers
2569
+	 *
2570
+	 * @return Array list of aircraft types
2571
+	 *
2572
+	 */
2573 2573
 	public function getAllManufacturers()
2574 2574
 	{
2575 2575
 		/*
@@ -2598,11 +2598,11 @@  discard block
 block discarded – undo
2598 2598
   
2599 2599
   
2600 2600
   /**
2601
-	* Gets a list of all aircraft types
2602
-	*
2603
-	* @return Array list of aircraft types
2604
-	*
2605
-	*/
2601
+   * Gets a list of all aircraft types
2602
+   *
2603
+   * @return Array list of aircraft types
2604
+   *
2605
+   */
2606 2606
 	public function getAllAircraftTypes($filters = array())
2607 2607
 	{
2608 2608
 		/*
@@ -2637,11 +2637,11 @@  discard block
 block discarded – undo
2637 2637
 	
2638 2638
 	
2639 2639
 	/**
2640
-	* Gets a list of all aircraft registrations
2641
-	*
2642
-	* @return Array list of aircraft registrations
2643
-	*
2644
-	*/
2640
+	 * Gets a list of all aircraft registrations
2641
+	 *
2642
+	 * @return Array list of aircraft registrations
2643
+	 *
2644
+	 */
2645 2645
 	public function getAllAircraftRegistrations($filters = array())
2646 2646
 	{
2647 2647
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2666,12 +2666,12 @@  discard block
 block discarded – undo
2666 2666
 	}
2667 2667
 
2668 2668
 	/**
2669
-	* Gets all source name
2670
-	*
2671
-	* @param String type format of source
2672
-	* @return Array list of source name
2673
-	*
2674
-	*/
2669
+	 * Gets all source name
2670
+	 *
2671
+	 * @param String type format of source
2672
+	 * @return Array list of source name
2673
+	 *
2674
+	 */
2675 2675
 	public function getAllSourceName($type = '',$filters = array())
2676 2676
 	{
2677 2677
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 
2703 2703
 
2704 2704
 	/**
2705
-	* Gets a list of all airline names
2706
-	*
2707
-	* @return Array list of airline names
2708
-	*
2709
-	*/
2705
+	 * Gets a list of all airline names
2706
+	 *
2707
+	 * @return Array list of airline names
2708
+	 *
2709
+	 */
2710 2710
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2711 2711
 	{
2712 2712
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
 	}
2756 2756
 	
2757 2757
 	/**
2758
-	* Gets a list of all alliance names
2759
-	*
2760
-	* @return Array list of alliance names
2761
-	*
2762
-	*/
2758
+	 * Gets a list of all alliance names
2759
+	 *
2760
+	 * @return Array list of alliance names
2761
+	 *
2762
+	 */
2763 2763
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2764 2764
 	{
2765 2765
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2784,11 +2784,11 @@  discard block
 block discarded – undo
2784 2784
 	}
2785 2785
 	
2786 2786
 	/**
2787
-	* Gets a list of all airline countries
2788
-	*
2789
-	* @return Array list of airline countries
2790
-	*
2791
-	*/
2787
+	 * Gets a list of all airline countries
2788
+	 *
2789
+	 * @return Array list of airline countries
2790
+	 *
2791
+	 */
2792 2792
 	public function getAllAirlineCountries($filters = array())
2793 2793
 	{
2794 2794
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2816,11 +2816,11 @@  discard block
 block discarded – undo
2816 2816
 	
2817 2817
 	
2818 2818
 	/**
2819
-	* Gets a list of all departure & arrival names
2820
-	*
2821
-	* @return Array list of airport names
2822
-	*
2823
-	*/
2819
+	 * Gets a list of all departure & arrival names
2820
+	 *
2821
+	 * @return Array list of airport names
2822
+	 *
2823
+	 */
2824 2824
 	public function getAllAirportNames($filters = array())
2825 2825
 	{
2826 2826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2869,11 +2869,11 @@  discard block
 block discarded – undo
2869 2869
 	
2870 2870
 	
2871 2871
 	/**
2872
-	* Gets a list of all departure & arrival airport countries
2873
-	*
2874
-	* @return Array list of airport countries
2875
-	*
2876
-	*/
2872
+	 * Gets a list of all departure & arrival airport countries
2873
+	 *
2874
+	 * @return Array list of airport countries
2875
+	 *
2876
+	 */
2877 2877
 	public function getAllAirportCountries($filters = array())
2878 2878
 	{
2879 2879
 		$airport_array = array();
@@ -2921,11 +2921,11 @@  discard block
 block discarded – undo
2921 2921
 	
2922 2922
 	
2923 2923
 	/**
2924
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2925
-	*
2926
-	* @return Array list of countries
2927
-	*
2928
-	*/
2924
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2925
+	 *
2926
+	 * @return Array list of countries
2927
+	 *
2928
+	 */
2929 2929
 	public function getAllCountries($filters = array())
2930 2930
 	{
2931 2931
 		$Connection= new Connection($this->db);
@@ -3002,11 +3002,11 @@  discard block
 block discarded – undo
3002 3002
 	
3003 3003
 	
3004 3004
 	/**
3005
-	* Gets a list of all idents/callsigns
3006
-	*
3007
-	* @return Array list of ident/callsign names
3008
-	*
3009
-	*/
3005
+	 * Gets a list of all idents/callsigns
3006
+	 *
3007
+	 * @return Array list of ident/callsign names
3008
+	 *
3009
+	 */
3010 3010
 	public function getAllIdents($filters = array())
3011 3011
 	{
3012 3012
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3030,9 +3030,9 @@  discard block
 block discarded – undo
3030 3030
 	}
3031 3031
 
3032 3032
 	/**
3033
-	* Get a list of flights from airport since 7 days
3034
-	* @return Array number, icao, name and city of airports
3035
-	*/
3033
+	 * Get a list of flights from airport since 7 days
3034
+	 * @return Array number, icao, name and city of airports
3035
+	 */
3036 3036
 
3037 3037
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3038 3038
 		global $globalTimezone, $globalDBdriver;
@@ -3063,9 +3063,9 @@  discard block
 block discarded – undo
3063 3063
 	}
3064 3064
 
3065 3065
 	/**
3066
-	* Get a list of flights from airport since 7 days
3067
-	* @return Array number, icao, name and city of airports
3068
-	*/
3066
+	 * Get a list of flights from airport since 7 days
3067
+	 * @return Array number, icao, name and city of airports
3068
+	 */
3069 3069
 
3070 3070
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3071 3071
 		global $globalTimezone, $globalDBdriver;
@@ -3095,9 +3095,9 @@  discard block
 block discarded – undo
3095 3095
 	}
3096 3096
 
3097 3097
 	/**
3098
-	* Get a list of flights from detected airport since 7 days
3099
-	* @return Array number, icao, name and city of airports
3100
-	*/
3098
+	 * Get a list of flights from detected airport since 7 days
3099
+	 * @return Array number, icao, name and city of airports
3100
+	 */
3101 3101
 
3102 3102
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3103 3103
 		global $globalTimezone, $globalDBdriver;
@@ -3135,9 +3135,9 @@  discard block
 block discarded – undo
3135 3135
 	}
3136 3136
 
3137 3137
 	/**
3138
-	* Get a list of flights from detected airport since 7 days
3139
-	* @return Array number, icao, name and city of airports
3140
-	*/
3138
+	 * Get a list of flights from detected airport since 7 days
3139
+	 * @return Array number, icao, name and city of airports
3140
+	 */
3141 3141
 
3142 3142
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3143 3143
 		global $globalTimezone, $globalDBdriver;
@@ -3179,9 +3179,9 @@  discard block
 block discarded – undo
3179 3179
 
3180 3180
 
3181 3181
 	/**
3182
-	* Get a list of flights to airport since 7 days
3183
-	* @return Array number, icao, name and city of airports
3184
-	*/
3182
+	 * Get a list of flights to airport since 7 days
3183
+	 * @return Array number, icao, name and city of airports
3184
+	 */
3185 3185
 
3186 3186
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3187 3187
 		global $globalTimezone, $globalDBdriver;
@@ -3214,9 +3214,9 @@  discard block
 block discarded – undo
3214 3214
 
3215 3215
 
3216 3216
 	/**
3217
-	* Get a list of flights detected to airport since 7 days
3218
-	* @return Array number, icao, name and city of airports
3219
-	*/
3217
+	 * Get a list of flights detected to airport since 7 days
3218
+	 * @return Array number, icao, name and city of airports
3219
+	 */
3220 3220
 
3221 3221
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3222 3222
 		global $globalTimezone, $globalDBdriver;
@@ -3257,9 +3257,9 @@  discard block
 block discarded – undo
3257 3257
 
3258 3258
 
3259 3259
 	/**
3260
-	* Get a list of flights to airport since 7 days
3261
-	* @return Array number, icao, name and city of airports
3262
-	*/
3260
+	 * Get a list of flights to airport since 7 days
3261
+	 * @return Array number, icao, name and city of airports
3262
+	 */
3263 3263
 
3264 3264
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3265 3265
 		global $globalTimezone, $globalDBdriver;
@@ -3291,9 +3291,9 @@  discard block
 block discarded – undo
3291 3291
 
3292 3292
 
3293 3293
 	/**
3294
-	* Get a list of flights detected to airport since 7 days
3295
-	* @return Array number, icao, name and city of airports
3296
-	*/
3294
+	 * Get a list of flights detected to airport since 7 days
3295
+	 * @return Array number, icao, name and city of airports
3296
+	 */
3297 3297
 
3298 3298
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3299 3299
 		global $globalTimezone, $globalDBdriver;
@@ -3337,11 +3337,11 @@  discard block
 block discarded – undo
3337 3337
 
3338 3338
 
3339 3339
 	/**
3340
-	* Gets a list of all dates
3341
-	*
3342
-	* @return Array list of date names
3343
-	*
3344
-	*/
3340
+	 * Gets a list of all dates
3341
+	 *
3342
+	 * @return Array list of date names
3343
+	 *
3344
+	 */
3345 3345
 	public function getAllDates()
3346 3346
 	{
3347 3347
 		global $globalTimezone, $globalDBdriver;
@@ -3382,11 +3382,11 @@  discard block
 block discarded – undo
3382 3382
 	
3383 3383
 	
3384 3384
 	/**
3385
-	* Gets all route combinations
3386
-	*
3387
-	* @return Array the route list
3388
-	*
3389
-	*/
3385
+	 * Gets all route combinations
3386
+	 *
3387
+	 * @return Array the route list
3388
+	 *
3389
+	 */
3390 3390
 	public function getAllRoutes()
3391 3391
 	{
3392 3392
 		$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 
@@ -3412,13 +3412,13 @@  discard block
 block discarded – undo
3412 3412
 	}
3413 3413
 
3414 3414
 	/**
3415
-	* Update ident spotter data
3416
-	*
3417
-	* @param String $flightaware_id the ID from flightaware
3418
-	* @param String $ident the flight ident
3419
-	* @return String success or false
3420
-	*
3421
-	*/	
3415
+	 * Update ident spotter data
3416
+	 *
3417
+	 * @param String $flightaware_id the ID from flightaware
3418
+	 * @param String $ident the flight ident
3419
+	 * @return String success or false
3420
+	 *
3421
+	 */	
3422 3422
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3423 3423
 	{
3424 3424
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3439,14 +3439,14 @@  discard block
 block discarded – undo
3439 3439
 		} else {
3440 3440
 			$airline_array = $this->getAllAirlineInfo("NA");
3441 3441
 		}
3442
-                $airline_name = $airline_array[0]['name'];
3443
-                $airline_icao = $airline_array[0]['icao'];
3444
-                $airline_country = $airline_array[0]['country'];
3445
-                $airline_type = $airline_array[0]['type'];
3442
+				$airline_name = $airline_array[0]['name'];
3443
+				$airline_icao = $airline_array[0]['icao'];
3444
+				$airline_country = $airline_array[0]['country'];
3445
+				$airline_type = $airline_array[0]['type'];
3446 3446
 
3447 3447
 
3448 3448
 		$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';
3449
-                $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);
3449
+				$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);
3450 3450
 
3451 3451
 		try {
3452 3452
 			$sth = $this->db->prepare($query);
@@ -3459,19 +3459,19 @@  discard block
 block discarded – undo
3459 3459
 
3460 3460
 	}
3461 3461
 	/**
3462
-	* Update latest spotter data
3463
-	*
3464
-	* @param String $flightaware_id the ID from flightaware
3465
-	* @param String $ident the flight ident
3466
-	* @param String $arrival_airport_icao the arrival airport
3467
-	* @return String success or false
3468
-	*
3469
-	*/	
3462
+	 * Update latest spotter data
3463
+	 *
3464
+	 * @param String $flightaware_id the ID from flightaware
3465
+	 * @param String $ident the flight ident
3466
+	 * @param String $arrival_airport_icao the arrival airport
3467
+	 * @return String success or false
3468
+	 *
3469
+	 */	
3470 3470
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3471 3471
 	{
3472 3472
 		if ($groundspeed == '') $groundspeed = NULL;
3473 3473
 		$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';
3474
-                $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);
3474
+				$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);
3475 3475
 
3476 3476
 		try {
3477 3477
 			$sth = $this->db->prepare($query);
@@ -3485,32 +3485,32 @@  discard block
 block discarded – undo
3485 3485
 	}
3486 3486
 
3487 3487
 	/**
3488
-	* Adds a new spotter data
3489
-	*
3490
-	* @param String $flightaware_id the ID from flightaware
3491
-	* @param String $ident the flight ident
3492
-	* @param String $aircraft_icao the aircraft type
3493
-	* @param String $departure_airport_icao the departure airport
3494
-	* @param String $arrival_airport_icao the arrival airport
3495
-	* @param String $latitude latitude of flight
3496
-	* @param String $longitude latitude of flight
3497
-	* @param String $waypoints waypoints of flight
3498
-	* @param String $altitude altitude of flight
3499
-	* @param String $heading heading of flight
3500
-	* @param String $groundspeed speed of flight
3501
-	* @param String $date date of flight
3502
-	* @param String $departure_airport_time departure time of flight
3503
-	* @param String $arrival_airport_time arrival time of flight
3504
-	* @param String $squawk squawk code of flight
3505
-	* @param String $route_stop route stop of flight
3506
-	* @param String $highlight highlight or not
3507
-	* @param String $ModeS ModesS code of flight
3508
-	* @param String $registration registration code of flight
3509
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3510
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3511
-	* @param String $verticalrate vertival rate of flight
3512
-	* @return String success or false
3513
-	*/
3488
+	 * Adds a new spotter data
3489
+	 *
3490
+	 * @param String $flightaware_id the ID from flightaware
3491
+	 * @param String $ident the flight ident
3492
+	 * @param String $aircraft_icao the aircraft type
3493
+	 * @param String $departure_airport_icao the departure airport
3494
+	 * @param String $arrival_airport_icao the arrival airport
3495
+	 * @param String $latitude latitude of flight
3496
+	 * @param String $longitude latitude of flight
3497
+	 * @param String $waypoints waypoints of flight
3498
+	 * @param String $altitude altitude of flight
3499
+	 * @param String $heading heading of flight
3500
+	 * @param String $groundspeed speed of flight
3501
+	 * @param String $date date of flight
3502
+	 * @param String $departure_airport_time departure time of flight
3503
+	 * @param String $arrival_airport_time arrival time of flight
3504
+	 * @param String $squawk squawk code of flight
3505
+	 * @param String $route_stop route stop of flight
3506
+	 * @param String $highlight highlight or not
3507
+	 * @param String $ModeS ModesS code of flight
3508
+	 * @param String $registration registration code of flight
3509
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3510
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3511
+	 * @param String $verticalrate vertival rate of flight
3512
+	 * @return String success or false
3513
+	 */
3514 3514
 	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 = '')
3515 3515
 	{
3516 3516
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3725,8 +3725,8 @@  discard block
 block discarded – undo
3725 3725
     
3726 3726
 		if ($globalIVAO && $aircraft_icao != '')
3727 3727
 		{
3728
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3729
-            		else $airline_icao = '';
3728
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3729
+					else $airline_icao = '';
3730 3730
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3731 3731
 			if (!isset($image_array[0]['registration']))
3732 3732
 			{
@@ -3757,53 +3757,53 @@  discard block
 block discarded – undo
3757 3757
 	
3758 3758
 		if (count($airline_array) == 0) 
3759 3759
 		{
3760
-                        $airline_array = $this->getAllAirlineInfo('NA');
3761
-                }
3762
-                if (count($aircraft_array) == 0) 
3763
-                {
3764
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3765
-                }
3766
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3767
-                {
3768
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3769
-                }
3770
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3771
-                {
3772
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3773
-                }
3774
-                if ($registration == '') $registration = 'NA';
3775
-                if ($latitude == '' && $longitude == '') {
3776
-            		$latitude = 0;
3777
-            		$longitude = 0;
3778
-            	}
3779
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3780
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3781
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3782
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3783
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3784
-                $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) 
3760
+						$airline_array = $this->getAllAirlineInfo('NA');
3761
+				}
3762
+				if (count($aircraft_array) == 0) 
3763
+				{
3764
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3765
+				}
3766
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3767
+				{
3768
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3769
+				}
3770
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3771
+				{
3772
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3773
+				}
3774
+				if ($registration == '') $registration = 'NA';
3775
+				if ($latitude == '' && $longitude == '') {
3776
+					$latitude = 0;
3777
+					$longitude = 0;
3778
+				}
3779
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3780
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3781
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3782
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3783
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3784
+				$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) 
3785 3785
                 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)";
3786 3786
 
3787
-                $airline_name = $airline_array[0]['name'];
3788
-                $airline_icao = $airline_array[0]['icao'];
3789
-                $airline_country = $airline_array[0]['country'];
3790
-                $airline_type = $airline_array[0]['type'];
3787
+				$airline_name = $airline_array[0]['name'];
3788
+				$airline_icao = $airline_array[0]['icao'];
3789
+				$airline_country = $airline_array[0]['country'];
3790
+				$airline_type = $airline_array[0]['type'];
3791 3791
 		if ($airline_type == '') {
3792 3792
 			$timeelapsed = microtime(true);
3793 3793
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3794 3794
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3795 3795
 		}
3796 3796
 		if ($airline_type == null) $airline_type = '';
3797
-                $aircraft_type = $aircraft_array[0]['type'];
3798
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3799
-                $departure_airport_name = $departure_airport_array[0]['name'];
3800
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3801
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3797
+				$aircraft_type = $aircraft_array[0]['type'];
3798
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3799
+				$departure_airport_name = $departure_airport_array[0]['name'];
3800
+			$departure_airport_city = $departure_airport_array[0]['city'];
3801
+				$departure_airport_country = $departure_airport_array[0]['country'];
3802 3802
                 
3803
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3804
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3805
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3806
-                $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);
3803
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3804
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3805
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3806
+				$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);
3807 3807
 
3808 3808
 		try {
3809 3809
 		        
@@ -3811,7 +3811,7 @@  discard block
 block discarded – undo
3811 3811
 			$sth->execute($query_values);
3812 3812
 			$this->db = null;
3813 3813
 		} catch (PDOException $e) {
3814
-		    return "error : ".$e->getMessage();
3814
+			return "error : ".$e->getMessage();
3815 3815
 		}
3816 3816
 		
3817 3817
 		return "success";
@@ -3820,11 +3820,11 @@  discard block
 block discarded – undo
3820 3820
 	
3821 3821
   
3822 3822
 	/**
3823
-	* Gets the aircraft ident within the last hour
3824
-	*
3825
-	* @return String the ident
3826
-	*
3827
-	*/
3823
+	 * Gets the aircraft ident within the last hour
3824
+	 *
3825
+	 * @return String the ident
3826
+	 *
3827
+	 */
3828 3828
 	public function getIdentFromLastHour($ident)
3829 3829
 	{
3830 3830
 		global $globalDBdriver, $globalTimezone;
@@ -3840,11 +3840,11 @@  discard block
 block discarded – undo
3840 3840
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3841 3841
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3842 3842
 			$query_data = array(':ident' => $ident);
3843
-    		}
3843
+			}
3844 3844
 		
3845 3845
 		$sth = $this->db->prepare($query);
3846 3846
 		$sth->execute($query_data);
3847
-    		$ident_result='';
3847
+			$ident_result='';
3848 3848
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3849 3849
 		{
3850 3850
 			$ident_result = $row['ident'];
@@ -3855,11 +3855,11 @@  discard block
 block discarded – undo
3855 3855
 	
3856 3856
 	
3857 3857
 	/**
3858
-	* Gets the aircraft data from the last 20 seconds
3859
-	*
3860
-	* @return Array the spotter data
3861
-	*
3862
-	*/
3858
+	 * Gets the aircraft data from the last 20 seconds
3859
+	 *
3860
+	 * @return Array the spotter data
3861
+	 *
3862
+	 */
3863 3863
 	public function getRealTimeData($q = '')
3864 3864
 	{
3865 3865
 		global $globalDBdriver;
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 	
3904 3904
 	
3905 3905
 	 /**
3906
-	* Gets all airlines that have flown over
3907
-	*
3908
-	* @return Array the airline list
3909
-	*
3910
-	*/
3906
+	  * Gets all airlines that have flown over
3907
+	  *
3908
+	  * @return Array the airline list
3909
+	  *
3910
+	  */
3911 3911
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3912 3912
 	{
3913 3913
 		global $globalDBdriver;
@@ -3921,7 +3921,7 @@  discard block
 block discarded – undo
3921 3921
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3922 3922
 			}
3923 3923
 		}
3924
-                if ($sincedate != '') {
3924
+				if ($sincedate != '') {
3925 3925
 			if ($globalDBdriver == 'mysql') {
3926 3926
 				$query .= " AND spotter_output.date > '".$sincedate."'";
3927 3927
 			} else {
@@ -3975,26 +3975,26 @@  discard block
 block discarded – undo
3975 3975
 	}
3976 3976
 
3977 3977
 	 /**
3978
-	* Gets all pilots that have flown over
3979
-	*
3980
-	* @return Array the pilots list
3981
-	*
3982
-	*/
3978
+	  * Gets all pilots that have flown over
3979
+	  *
3980
+	  * @return Array the pilots list
3981
+	  *
3982
+	  */
3983 3983
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
3984 3984
 	{
3985 3985
 		global $globalDBdriver;
3986 3986
 		$filter_query = $this->getFilter($filters,true,true);
3987 3987
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3988 3988
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3989
-                if ($olderthanmonths > 0) {
3990
-            		if ($globalDBdriver == 'mysql') {
3989
+				if ($olderthanmonths > 0) {
3990
+					if ($globalDBdriver == 'mysql') {
3991 3991
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3992 3992
 			} else {
3993 3993
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3994 3994
 			}
3995 3995
 		}
3996
-                if ($sincedate != '') {
3997
-            		if ($globalDBdriver == 'mysql') {
3996
+				if ($sincedate != '') {
3997
+					if ($globalDBdriver == 'mysql') {
3998 3998
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3999 3999
 			} else {
4000 4000
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4049,25 +4049,25 @@  discard block
 block discarded – undo
4049 4049
 	}
4050 4050
 	
4051 4051
 	/**
4052
-	* Gets all pilots that have flown over
4053
-	*
4054
-	* @return Array the pilots list
4055
-	*
4056
-	*/
4052
+	 * Gets all pilots that have flown over
4053
+	 *
4054
+	 * @return Array the pilots list
4055
+	 *
4056
+	 */
4057 4057
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4058 4058
 	{
4059 4059
 		global $globalDBdriver;
4060 4060
 		$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
4061 4061
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4062
-                if ($olderthanmonths > 0) {
4063
-            		if ($globalDBdriver == 'mysql') {
4062
+				if ($olderthanmonths > 0) {
4063
+					if ($globalDBdriver == 'mysql') {
4064 4064
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4065 4065
 			} else {
4066 4066
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4067 4067
 			}
4068 4068
 		}
4069
-                if ($sincedate != '') {
4070
-            		if ($globalDBdriver == 'mysql') {
4069
+				if ($sincedate != '') {
4070
+					if ($globalDBdriver == 'mysql') {
4071 4071
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4072 4072
 			} else {
4073 4073
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4096,26 +4096,26 @@  discard block
 block discarded – undo
4096 4096
 	}
4097 4097
 	
4098 4098
 	 /**
4099
-	* Gets all owner that have flown over
4100
-	*
4101
-	* @return Array the pilots list
4102
-	*
4103
-	*/
4099
+	  * Gets all owner that have flown over
4100
+	  *
4101
+	  * @return Array the pilots list
4102
+	  *
4103
+	  */
4104 4104
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4105 4105
 	{
4106 4106
 		global $globalDBdriver;
4107 4107
 		$filter_query = $this->getFilter($filters,true,true);
4108 4108
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4109 4109
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4110
-                if ($olderthanmonths > 0) {
4111
-            		if ($globalDBdriver == 'mysql') {
4110
+				if ($olderthanmonths > 0) {
4111
+					if ($globalDBdriver == 'mysql') {
4112 4112
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4113 4113
 			} else {
4114 4114
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4115 4115
 			}
4116 4116
 		}
4117
-                if ($sincedate != '') {
4118
-            		if ($globalDBdriver == 'mysql') {
4117
+				if ($sincedate != '') {
4118
+					if ($globalDBdriver == 'mysql') {
4119 4119
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4120 4120
 			} else {
4121 4121
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4166,26 +4166,26 @@  discard block
 block discarded – undo
4166 4166
 	}
4167 4167
 	
4168 4168
 	 /**
4169
-	* Gets all owner that have flown over
4170
-	*
4171
-	* @return Array the pilots list
4172
-	*
4173
-	*/
4169
+	  * Gets all owner that have flown over
4170
+	  *
4171
+	  * @return Array the pilots list
4172
+	  *
4173
+	  */
4174 4174
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4175 4175
 	{
4176 4176
 		global $globalDBdriver;
4177 4177
 		$filter_query = $this->getFilter($filters,true,true);
4178 4178
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4179 4179
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4180
-                if ($olderthanmonths > 0) {
4181
-            		if ($globalDBdriver == 'mysql') {
4180
+				if ($olderthanmonths > 0) {
4181
+					if ($globalDBdriver == 'mysql') {
4182 4182
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4183 4183
 			} else {
4184 4184
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4185 4185
 			}
4186 4186
 		}
4187
-                if ($sincedate != '') {
4188
-            		if ($globalDBdriver == 'mysql') {
4187
+				if ($sincedate != '') {
4188
+					if ($globalDBdriver == 'mysql') {
4189 4189
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4190 4190
 			} else {
4191 4191
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4212,11 +4212,11 @@  discard block
 block discarded – undo
4212 4212
 	}
4213 4213
 
4214 4214
 	/**
4215
-	* Gets all airlines that have flown over by aircraft
4216
-	*
4217
-	* @return Array the airline list
4218
-	*
4219
-	*/
4215
+	 * Gets all airlines that have flown over by aircraft
4216
+	 *
4217
+	 * @return Array the airline list
4218
+	 *
4219
+	 */
4220 4220
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4221 4221
 	{
4222 4222
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4248,11 +4248,11 @@  discard block
 block discarded – undo
4248 4248
 
4249 4249
 
4250 4250
 	/**
4251
-	* Gets all airline countries that have flown over by aircraft
4252
-	*
4253
-	* @return Array the airline country list
4254
-	*
4255
-	*/
4251
+	 * Gets all airline countries that have flown over by aircraft
4252
+	 *
4253
+	 * @return Array the airline country list
4254
+	 *
4255
+	 */
4256 4256
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4257 4257
 	{
4258 4258
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4284,11 +4284,11 @@  discard block
 block discarded – undo
4284 4284
 	
4285 4285
 	
4286 4286
 	/**
4287
-	* Gets all airlines that have flown over by airport
4288
-	*
4289
-	* @return Array the airline list
4290
-	*
4291
-	*/
4287
+	 * Gets all airlines that have flown over by airport
4288
+	 *
4289
+	 * @return Array the airline list
4290
+	 *
4291
+	 */
4292 4292
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4293 4293
 	{
4294 4294
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4319,11 +4319,11 @@  discard block
 block discarded – undo
4319 4319
 
4320 4320
 
4321 4321
 	/**
4322
-	* Gets all airline countries that have flown over by airport icao
4323
-	*
4324
-	* @return Array the airline country list
4325
-	*
4326
-	*/
4322
+	 * Gets all airline countries that have flown over by airport icao
4323
+	 *
4324
+	 * @return Array the airline country list
4325
+	 *
4326
+	 */
4327 4327
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4328 4328
 	{
4329 4329
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4353,11 +4353,11 @@  discard block
 block discarded – undo
4353 4353
 
4354 4354
 
4355 4355
 	/**
4356
-	* Gets all airlines that have flown over by aircraft manufacturer
4357
-	*
4358
-	* @return Array the airline list
4359
-	*
4360
-	*/
4356
+	 * Gets all airlines that have flown over by aircraft manufacturer
4357
+	 *
4358
+	 * @return Array the airline list
4359
+	 *
4360
+	 */
4361 4361
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4362 4362
 	{
4363 4363
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4388,11 +4388,11 @@  discard block
 block discarded – undo
4388 4388
 
4389 4389
 
4390 4390
 	/**
4391
-	* Gets all airline countries that have flown over by aircraft manufacturer
4392
-	*
4393
-	* @return Array the airline country list
4394
-	*
4395
-	*/
4391
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4392
+	 *
4393
+	 * @return Array the airline country list
4394
+	 *
4395
+	 */
4396 4396
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4397 4397
 	{
4398 4398
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4421,11 +4421,11 @@  discard block
 block discarded – undo
4421 4421
 
4422 4422
 
4423 4423
 	/**
4424
-	* Gets all airlines that have flown over by date
4425
-	*
4426
-	* @return Array the airline list
4427
-	*
4428
-	*/
4424
+	 * Gets all airlines that have flown over by date
4425
+	 *
4426
+	 * @return Array the airline list
4427
+	 *
4428
+	 */
4429 4429
 	public function countAllAirlinesByDate($date,$filters = array())
4430 4430
 	{
4431 4431
 		global $globalTimezone, $globalDBdriver;
@@ -4469,11 +4469,11 @@  discard block
 block discarded – undo
4469 4469
 	
4470 4470
 	
4471 4471
 	/**
4472
-	* Gets all airline countries that have flown over by date
4473
-	*
4474
-	* @return Array the airline country list
4475
-	*
4476
-	*/
4472
+	 * Gets all airline countries that have flown over by date
4473
+	 *
4474
+	 * @return Array the airline country list
4475
+	 *
4476
+	 */
4477 4477
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4478 4478
 	{
4479 4479
 		global $globalTimezone, $globalDBdriver;
@@ -4516,11 +4516,11 @@  discard block
 block discarded – undo
4516 4516
 
4517 4517
 
4518 4518
 	/**
4519
-	* Gets all airlines that have flown over by ident/callsign
4520
-	*
4521
-	* @return Array the airline list
4522
-	*
4523
-	*/
4519
+	 * Gets all airlines that have flown over by ident/callsign
4520
+	 *
4521
+	 * @return Array the airline list
4522
+	 *
4523
+	 */
4524 4524
 	public function countAllAirlinesByIdent($ident,$filters = array())
4525 4525
 	{
4526 4526
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4537,11 +4537,11 @@  discard block
 block discarded – undo
4537 4537
 	}
4538 4538
 
4539 4539
 	/**
4540
-	* Gets all airlines by owner
4541
-	*
4542
-	* @return Array the airline list
4543
-	*
4544
-	*/
4540
+	 * Gets all airlines by owner
4541
+	 *
4542
+	 * @return Array the airline list
4543
+	 *
4544
+	 */
4545 4545
 	public function countAllAirlinesByOwner($owner,$filters = array())
4546 4546
 	{
4547 4547
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4558,11 +4558,11 @@  discard block
 block discarded – undo
4558 4558
 	}
4559 4559
 
4560 4560
 	/**
4561
-	* Gets all airlines used by pilot
4562
-	*
4563
-	* @return Array the airline list
4564
-	*
4565
-	*/
4561
+	 * Gets all airlines used by pilot
4562
+	 *
4563
+	 * @return Array the airline list
4564
+	 *
4565
+	 */
4566 4566
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4567 4567
 	{
4568 4568
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4579,11 +4579,11 @@  discard block
 block discarded – undo
4579 4579
 	}
4580 4580
 
4581 4581
 	/**
4582
-	* Gets all airlines that have flown over by route
4583
-	*
4584
-	* @return Array the airline list
4585
-	*
4586
-	*/
4582
+	 * Gets all airlines that have flown over by route
4583
+	 *
4584
+	 * @return Array the airline list
4585
+	 *
4586
+	 */
4587 4587
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4588 4588
 	{
4589 4589
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4615,11 +4615,11 @@  discard block
 block discarded – undo
4615 4615
 	}
4616 4616
 
4617 4617
 	/**
4618
-	* Gets all airline countries that have flown over by route
4619
-	*
4620
-	* @return Array the airline country list
4621
-	*
4622
-	*/
4618
+	 * Gets all airline countries that have flown over by route
4619
+	 *
4620
+	 * @return Array the airline country list
4621
+	 *
4622
+	 */
4623 4623
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4624 4624
 	{
4625 4625
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4651,11 +4651,11 @@  discard block
 block discarded – undo
4651 4651
 
4652 4652
 
4653 4653
 	/**
4654
-	* Gets all airlines that have flown over by country
4655
-	*
4656
-	* @return Array the airline list
4657
-	*
4658
-	*/
4654
+	 * Gets all airlines that have flown over by country
4655
+	 *
4656
+	 * @return Array the airline list
4657
+	 *
4658
+	 */
4659 4659
 	public function countAllAirlinesByCountry($country,$filters = array())
4660 4660
 	{
4661 4661
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4685,11 +4685,11 @@  discard block
 block discarded – undo
4685 4685
 
4686 4686
 
4687 4687
 	/**
4688
-	* Gets all airline countries that have flown over by country
4689
-	*
4690
-	* @return Array the airline country list
4691
-	*
4692
-	*/
4688
+	 * Gets all airline countries that have flown over by country
4689
+	 *
4690
+	 * @return Array the airline country list
4691
+	 *
4692
+	 */
4693 4693
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4694 4694
 	{
4695 4695
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4718,11 +4718,11 @@  discard block
 block discarded – undo
4718 4718
 
4719 4719
 
4720 4720
 	/**
4721
-	* Gets all airlines countries
4722
-	*
4723
-	* @return Array the airline country list
4724
-	*
4725
-	*/
4721
+	 * Gets all airlines countries
4722
+	 *
4723
+	 * @return Array the airline country list
4724
+	 *
4725
+	 */
4726 4726
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4727 4727
 	{
4728 4728
 		global $globalDBdriver;
@@ -4777,11 +4777,11 @@  discard block
 block discarded – undo
4777 4777
 	}
4778 4778
 
4779 4779
 	/**
4780
-	* Gets all number of flight over countries
4781
-	*
4782
-	* @return Array the airline country list
4783
-	*
4784
-	*/
4780
+	 * Gets all number of flight over countries
4781
+	 *
4782
+	 * @return Array the airline country list
4783
+	 *
4784
+	 */
4785 4785
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4786 4786
 	{
4787 4787
 		global $globalDBdriver;
@@ -4803,15 +4803,15 @@  discard block
 block discarded – undo
4803 4803
 		$SpotterLive = new SpotterLive();
4804 4804
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4805 4805
 		$filter_query .= ' over_country IS NOT NULL';
4806
-                if ($olderthanmonths > 0) {
4806
+				if ($olderthanmonths > 0) {
4807 4807
 			if ($globalDBdriver == 'mysql') {
4808 4808
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4809 4809
 			} else {
4810 4810
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4811 4811
 			}
4812 4812
 		}
4813
-                if ($sincedate != '') {
4814
-            		if ($globalDBdriver == 'mysql') {
4813
+				if ($sincedate != '') {
4814
+					if ($globalDBdriver == 'mysql') {
4815 4815
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4816 4816
 			} else {
4817 4817
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4841,11 +4841,11 @@  discard block
 block discarded – undo
4841 4841
 	
4842 4842
 	
4843 4843
 	/**
4844
-	* Gets all aircraft types that have flown over
4845
-	*
4846
-	* @return Array the aircraft list
4847
-	*
4848
-	*/
4844
+	 * Gets all aircraft types that have flown over
4845
+	 *
4846
+	 * @return Array the aircraft list
4847
+	 *
4848
+	 */
4849 4849
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4850 4850
 	{
4851 4851
 		global $globalDBdriver;
@@ -4915,11 +4915,11 @@  discard block
 block discarded – undo
4915 4915
 	}
4916 4916
 
4917 4917
 	/**
4918
-	* Gets all aircraft types that have flown over by airline
4919
-	*
4920
-	* @return Array the aircraft list
4921
-	*
4922
-	*/
4918
+	 * Gets all aircraft types that have flown over by airline
4919
+	 *
4920
+	 * @return Array the aircraft list
4921
+	 *
4922
+	 */
4923 4923
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4924 4924
 	{
4925 4925
 		global $globalDBdriver;
@@ -4990,11 +4990,11 @@  discard block
 block discarded – undo
4990 4990
 	}
4991 4991
 
4992 4992
 	/**
4993
-	* Gets all aircraft types that have flown over by months
4994
-	*
4995
-	* @return Array the aircraft list
4996
-	*
4997
-	*/
4993
+	 * Gets all aircraft types that have flown over by months
4994
+	 *
4995
+	 * @return Array the aircraft list
4996
+	 *
4997
+	 */
4998 4998
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4999 4999
 	{
5000 5000
 		global $globalDBdriver;
@@ -5038,11 +5038,11 @@  discard block
 block discarded – undo
5038 5038
 
5039 5039
 
5040 5040
 	/**
5041
-	* Gets all aircraft registration that have flown over by aircaft icao
5042
-	*
5043
-	* @return Array the aircraft list
5044
-	*
5045
-	*/
5041
+	 * Gets all aircraft registration that have flown over by aircaft icao
5042
+	 *
5043
+	 * @return Array the aircraft list
5044
+	 *
5045
+	 */
5046 5046
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5047 5047
 	{
5048 5048
 		$Image = new Image($this->db);
@@ -5081,11 +5081,11 @@  discard block
 block discarded – undo
5081 5081
 
5082 5082
 
5083 5083
 	/**
5084
-	* Gets all aircraft types that have flown over by airline icao
5085
-	*
5086
-	* @return Array the aircraft list
5087
-	*
5088
-	*/
5084
+	 * Gets all aircraft types that have flown over by airline icao
5085
+	 *
5086
+	 * @return Array the aircraft list
5087
+	 *
5088
+	 */
5089 5089
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5090 5090
 	{
5091 5091
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5114,11 +5114,11 @@  discard block
 block discarded – undo
5114 5114
 
5115 5115
 
5116 5116
 	/**
5117
-	* Gets all aircraft registration that have flown over by airline icao
5118
-	*
5119
-	* @return Array the aircraft list
5120
-	*
5121
-	*/
5117
+	 * Gets all aircraft registration that have flown over by airline icao
5118
+	 *
5119
+	 * @return Array the aircraft list
5120
+	 *
5121
+	 */
5122 5122
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5123 5123
 	{
5124 5124
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5156,11 +5156,11 @@  discard block
 block discarded – undo
5156 5156
 
5157 5157
 
5158 5158
 	/**
5159
-	* Gets all aircraft manufacturer that have flown over by airline icao
5160
-	*
5161
-	* @return Array the aircraft list
5162
-	*
5163
-	*/
5159
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5160
+	 *
5161
+	 * @return Array the aircraft list
5162
+	 *
5163
+	 */
5164 5164
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5165 5165
 	{
5166 5166
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5188,11 +5188,11 @@  discard block
 block discarded – undo
5188 5188
 
5189 5189
 
5190 5190
 	/**
5191
-	* Gets all aircraft types that have flown over by airline icao
5192
-	*
5193
-	* @return Array the aircraft list
5194
-	*
5195
-	*/
5191
+	 * Gets all aircraft types that have flown over by airline icao
5192
+	 *
5193
+	 * @return Array the aircraft list
5194
+	 *
5195
+	 */
5196 5196
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5197 5197
 	{
5198 5198
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5221,11 +5221,11 @@  discard block
 block discarded – undo
5221 5221
 
5222 5222
 
5223 5223
 	/**
5224
-	* Gets all aircraft registration that have flown over by airport icao
5225
-	*
5226
-	* @return Array the aircraft list
5227
-	*
5228
-	*/
5224
+	 * Gets all aircraft registration that have flown over by airport icao
5225
+	 *
5226
+	 * @return Array the aircraft list
5227
+	 *
5228
+	 */
5229 5229
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5230 5230
 	{
5231 5231
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5262,11 +5262,11 @@  discard block
 block discarded – undo
5262 5262
 	
5263 5263
 	
5264 5264
 	/**
5265
-	* Gets all aircraft manufacturer that have flown over by airport icao
5266
-	*
5267
-	* @return Array the aircraft list
5268
-	*
5269
-	*/
5265
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5266
+	 *
5267
+	 * @return Array the aircraft list
5268
+	 *
5269
+	 */
5270 5270
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5271 5271
 	{
5272 5272
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5292,11 +5292,11 @@  discard block
 block discarded – undo
5292 5292
 	}
5293 5293
 
5294 5294
 	/**
5295
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5296
-	*
5297
-	* @return Array the aircraft list
5298
-	*
5299
-	*/
5295
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5296
+	 *
5297
+	 * @return Array the aircraft list
5298
+	 *
5299
+	 */
5300 5300
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5301 5301
 	{
5302 5302
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5323,11 +5323,11 @@  discard block
 block discarded – undo
5323 5323
 
5324 5324
 
5325 5325
 	/**
5326
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5327
-	*
5328
-	* @return Array the aircraft list
5329
-	*
5330
-	*/
5326
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5327
+	 *
5328
+	 * @return Array the aircraft list
5329
+	 *
5330
+	 */
5331 5331
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5332 5332
 	{
5333 5333
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5363,11 +5363,11 @@  discard block
 block discarded – undo
5363 5363
 	}
5364 5364
 
5365 5365
 	/**
5366
-	* Gets all aircraft types that have flown over by date
5367
-	*
5368
-	* @return Array the aircraft list
5369
-	*
5370
-	*/
5366
+	 * Gets all aircraft types that have flown over by date
5367
+	 *
5368
+	 * @return Array the aircraft list
5369
+	 *
5370
+	 */
5371 5371
 	public function countAllAircraftTypesByDate($date,$filters = array())
5372 5372
 	{
5373 5373
 		global $globalTimezone, $globalDBdriver;
@@ -5409,11 +5409,11 @@  discard block
 block discarded – undo
5409 5409
 
5410 5410
 
5411 5411
 	/**
5412
-	* Gets all aircraft registration that have flown over by date
5413
-	*
5414
-	* @return Array the aircraft list
5415
-	*
5416
-	*/
5412
+	 * Gets all aircraft registration that have flown over by date
5413
+	 *
5414
+	 * @return Array the aircraft list
5415
+	 *
5416
+	 */
5417 5417
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5418 5418
 	{
5419 5419
 		global $globalTimezone, $globalDBdriver;
@@ -5464,11 +5464,11 @@  discard block
 block discarded – undo
5464 5464
 
5465 5465
 
5466 5466
 	/**
5467
-	* Gets all aircraft manufacturer that have flown over by date
5468
-	*
5469
-	* @return Array the aircraft manufacturer list
5470
-	*
5471
-	*/
5467
+	 * Gets all aircraft manufacturer that have flown over by date
5468
+	 *
5469
+	 * @return Array the aircraft manufacturer list
5470
+	 *
5471
+	 */
5472 5472
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5473 5473
 	{
5474 5474
 		global $globalTimezone, $globalDBdriver;
@@ -5510,11 +5510,11 @@  discard block
 block discarded – undo
5510 5510
 
5511 5511
 
5512 5512
 	/**
5513
-	* Gets all aircraft types that have flown over by ident/callsign
5514
-	*
5515
-	* @return Array the aircraft list
5516
-	*
5517
-	*/
5513
+	 * Gets all aircraft types that have flown over by ident/callsign
5514
+	 *
5515
+	 * @return Array the aircraft list
5516
+	 *
5517
+	 */
5518 5518
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5519 5519
 	{
5520 5520
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5542,11 +5542,11 @@  discard block
 block discarded – undo
5542 5542
 	}
5543 5543
 
5544 5544
 	/**
5545
-	* Gets all aircraft types that have flown over by pilot
5546
-	*
5547
-	* @return Array the aircraft list
5548
-	*
5549
-	*/
5545
+	 * Gets all aircraft types that have flown over by pilot
5546
+	 *
5547
+	 * @return Array the aircraft list
5548
+	 *
5549
+	 */
5550 5550
 	public function countAllAircraftTypesByPilot($pilot,$filters = array())
5551 5551
 	{
5552 5552
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5562,11 +5562,11 @@  discard block
 block discarded – undo
5562 5562
 	}
5563 5563
 
5564 5564
 	/**
5565
-	* Gets all aircraft types that have flown over by owner
5566
-	*
5567
-	* @return Array the aircraft list
5568
-	*
5569
-	*/
5565
+	 * Gets all aircraft types that have flown over by owner
5566
+	 *
5567
+	 * @return Array the aircraft list
5568
+	 *
5569
+	 */
5570 5570
 	public function countAllAircraftTypesByOwner($owner,$filters = array())
5571 5571
 	{
5572 5572
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5583,11 +5583,11 @@  discard block
 block discarded – undo
5583 5583
 
5584 5584
 
5585 5585
 	/**
5586
-	* Gets all aircraft registration that have flown over by ident/callsign
5587
-	*
5588
-	* @return Array the aircraft list
5589
-	*
5590
-	*/
5586
+	 * Gets all aircraft registration that have flown over by ident/callsign
5587
+	 *
5588
+	 * @return Array the aircraft list
5589
+	 *
5590
+	 */
5591 5591
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5592 5592
 	{
5593 5593
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5626,11 +5626,11 @@  discard block
 block discarded – undo
5626 5626
 	}
5627 5627
 
5628 5628
 	/**
5629
-	* Gets all aircraft registration that have flown over by owner
5630
-	*
5631
-	* @return Array the aircraft list
5632
-	*
5633
-	*/
5629
+	 * Gets all aircraft registration that have flown over by owner
5630
+	 *
5631
+	 * @return Array the aircraft list
5632
+	 *
5633
+	 */
5634 5634
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
5635 5635
 	{
5636 5636
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5670,11 +5670,11 @@  discard block
 block discarded – undo
5670 5670
 	}
5671 5671
 
5672 5672
 	/**
5673
-	* Gets all aircraft registration that have flown over by pilot
5674
-	*
5675
-	* @return Array the aircraft list
5676
-	*
5677
-	*/
5673
+	 * Gets all aircraft registration that have flown over by pilot
5674
+	 *
5675
+	 * @return Array the aircraft list
5676
+	 *
5677
+	 */
5678 5678
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array())
5679 5679
 	{
5680 5680
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5715,11 +5715,11 @@  discard block
 block discarded – undo
5715 5715
 
5716 5716
 
5717 5717
 	/**
5718
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5719
-	*
5720
-	* @return Array the aircraft manufacturer list
5721
-	*
5722
-	*/
5718
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5719
+	 *
5720
+	 * @return Array the aircraft manufacturer list
5721
+	 *
5722
+	 */
5723 5723
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5724 5724
 	{
5725 5725
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5744,11 +5744,11 @@  discard block
 block discarded – undo
5744 5744
 	}
5745 5745
 
5746 5746
 	/**
5747
-	* Gets all aircraft manufacturer that have flown over by owner
5748
-	*
5749
-	* @return Array the aircraft manufacturer list
5750
-	*
5751
-	*/
5747
+	 * Gets all aircraft manufacturer that have flown over by owner
5748
+	 *
5749
+	 * @return Array the aircraft manufacturer list
5750
+	 *
5751
+	 */
5752 5752
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
5753 5753
 	{
5754 5754
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5765,11 +5765,11 @@  discard block
 block discarded – undo
5765 5765
 	}
5766 5766
 
5767 5767
 	/**
5768
-	* Gets all aircraft manufacturer that have flown over by pilot
5769
-	*
5770
-	* @return Array the aircraft manufacturer list
5771
-	*
5772
-	*/
5768
+	 * Gets all aircraft manufacturer that have flown over by pilot
5769
+	 *
5770
+	 * @return Array the aircraft manufacturer list
5771
+	 *
5772
+	 */
5773 5773
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array())
5774 5774
 	{
5775 5775
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5787,11 +5787,11 @@  discard block
 block discarded – undo
5787 5787
 
5788 5788
 
5789 5789
 	/**
5790
-	* Gets all aircraft types that have flown over by route
5791
-	*
5792
-	* @return Array the aircraft list
5793
-	*
5794
-	*/
5790
+	 * Gets all aircraft types that have flown over by route
5791
+	 *
5792
+	 * @return Array the aircraft list
5793
+	 *
5794
+	 */
5795 5795
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5796 5796
 	{
5797 5797
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5820,11 +5820,11 @@  discard block
 block discarded – undo
5820 5820
 	}
5821 5821
 
5822 5822
 	/**
5823
-	* Gets all aircraft registration that have flown over by route
5824
-	*
5825
-	* @return Array the aircraft list
5826
-	*
5827
-	*/
5823
+	 * Gets all aircraft registration that have flown over by route
5824
+	 *
5825
+	 * @return Array the aircraft list
5826
+	 *
5827
+	 */
5828 5828
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5829 5829
 	{
5830 5830
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5866,11 +5866,11 @@  discard block
 block discarded – undo
5866 5866
 	
5867 5867
 	
5868 5868
 	/**
5869
-	* Gets all aircraft manufacturer that have flown over by route
5870
-	*
5871
-	* @return Array the aircraft manufacturer list
5872
-	*
5873
-	*/
5869
+	 * Gets all aircraft manufacturer that have flown over by route
5870
+	 *
5871
+	 * @return Array the aircraft manufacturer list
5872
+	 *
5873
+	 */
5874 5874
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5875 5875
 	{
5876 5876
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5904,11 +5904,11 @@  discard block
 block discarded – undo
5904 5904
 	
5905 5905
 	
5906 5906
 	/**
5907
-	* Gets all aircraft types that have flown over by country
5908
-	*
5909
-	* @return Array the aircraft list
5910
-	*
5911
-	*/
5907
+	 * Gets all aircraft types that have flown over by country
5908
+	 *
5909
+	 * @return Array the aircraft list
5910
+	 *
5911
+	 */
5912 5912
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5913 5913
 	{
5914 5914
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5939,11 +5939,11 @@  discard block
 block discarded – undo
5939 5939
 
5940 5940
 
5941 5941
 	/**
5942
-	* Gets all aircraft registration that have flown over by country
5943
-	*
5944
-	* @return Array the aircraft list
5945
-	*
5946
-	*/
5942
+	 * Gets all aircraft registration that have flown over by country
5943
+	 *
5944
+	 * @return Array the aircraft list
5945
+	 *
5946
+	 */
5947 5947
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5948 5948
 	{
5949 5949
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5983,11 +5983,11 @@  discard block
 block discarded – undo
5983 5983
 	
5984 5984
 	
5985 5985
 	/**
5986
-	* Gets all aircraft manufacturer that have flown over by country
5987
-	*
5988
-	* @return Array the aircraft manufacturer list
5989
-	*
5990
-	*/
5986
+	 * Gets all aircraft manufacturer that have flown over by country
5987
+	 *
5988
+	 * @return Array the aircraft manufacturer list
5989
+	 *
5990
+	 */
5991 5991
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5992 5992
 	{
5993 5993
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6018,18 +6018,18 @@  discard block
 block discarded – undo
6018 6018
 	
6019 6019
 	
6020 6020
 	/**
6021
-	* Gets all aircraft manufacturers that have flown over
6022
-	*
6023
-	* @return Array the aircraft list
6024
-	*
6025
-	*/
6021
+	 * Gets all aircraft manufacturers that have flown over
6022
+	 *
6023
+	 * @return Array the aircraft list
6024
+	 *
6025
+	 */
6026 6026
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6027 6027
 	{
6028 6028
 		global $globalDBdriver;
6029 6029
 		$filter_query = $this->getFilter($filters,true,true);
6030 6030
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6031 6031
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6032
-                $query_values = array();
6032
+				$query_values = array();
6033 6033
 		if ($year != '') {
6034 6034
 			if ($globalDBdriver == 'mysql') {
6035 6035
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6082,11 +6082,11 @@  discard block
 block discarded – undo
6082 6082
 	
6083 6083
 	
6084 6084
 	/**
6085
-	* Gets all aircraft registrations that have flown over
6086
-	*
6087
-	* @return Array the aircraft list
6088
-	*
6089
-	*/
6085
+	 * Gets all aircraft registrations that have flown over
6086
+	 *
6087
+	 * @return Array the aircraft list
6088
+	 *
6089
+	 */
6090 6090
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6091 6091
 	{
6092 6092
 		global $globalDBdriver;
@@ -6094,15 +6094,15 @@  discard block
 block discarded – undo
6094 6094
 		$filter_query = $this->getFilter($filters,true,true);
6095 6095
 		$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    
6096 6096
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6097
-                if ($olderthanmonths > 0) {
6098
-            		if ($globalDBdriver == 'mysql') {
6097
+				if ($olderthanmonths > 0) {
6098
+					if ($globalDBdriver == 'mysql') {
6099 6099
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6100 6100
 			} else {
6101 6101
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6102 6102
 			}
6103 6103
 		}
6104
-                if ($sincedate != '') {
6105
-            		if ($globalDBdriver == 'mysql') {
6104
+				if ($sincedate != '') {
6105
+					if ($globalDBdriver == 'mysql') {
6106 6106
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6107 6107
 			} else {
6108 6108
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6167,11 +6167,11 @@  discard block
 block discarded – undo
6167 6167
 
6168 6168
 
6169 6169
 	/**
6170
-	* Gets all aircraft registrations that have flown over
6171
-	*
6172
-	* @return Array the aircraft list
6173
-	*
6174
-	*/
6170
+	 * Gets all aircraft registrations that have flown over
6171
+	 *
6172
+	 * @return Array the aircraft list
6173
+	 *
6174
+	 */
6175 6175
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6176 6176
 	{
6177 6177
 		global $globalDBdriver;
@@ -6179,15 +6179,15 @@  discard block
 block discarded – undo
6179 6179
 		$Image = new Image($this->db);
6180 6180
 		$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    
6181 6181
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6182
-                if ($olderthanmonths > 0) {
6183
-            		if ($globalDBdriver == 'mysql') {
6182
+				if ($olderthanmonths > 0) {
6183
+					if ($globalDBdriver == 'mysql') {
6184 6184
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6185 6185
 			} else {
6186 6186
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6187 6187
 			}
6188 6188
 		}
6189
-                if ($sincedate != '') {
6190
-            		if ($globalDBdriver == 'mysql') {
6189
+				if ($sincedate != '') {
6190
+					if ($globalDBdriver == 'mysql') {
6191 6191
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6192 6192
 			} else {
6193 6193
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6196,7 +6196,7 @@  discard block
 block discarded – undo
6196 6196
 
6197 6197
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6198 6198
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6199
-                $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";
6199
+				$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";
6200 6200
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6201 6201
 		
6202 6202
 		$sth = $this->db->prepare($query);
@@ -6228,26 +6228,26 @@  discard block
 block discarded – undo
6228 6228
 	
6229 6229
 	
6230 6230
 	/**
6231
-	* Gets all departure airports of the airplanes that have flown over
6232
-	*
6233
-	* @return Array the airport list
6234
-	*
6235
-	*/
6231
+	 * Gets all departure airports of the airplanes that have flown over
6232
+	 *
6233
+	 * @return Array the airport list
6234
+	 *
6235
+	 */
6236 6236
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6237 6237
 	{
6238 6238
 		global $globalDBdriver;
6239 6239
 		$filter_query = $this->getFilter($filters,true,true);
6240 6240
 		$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 
6241 6241
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6242
-                if ($olderthanmonths > 0) {
6243
-            		if ($globalDBdriver == 'mysql') {
6242
+				if ($olderthanmonths > 0) {
6243
+					if ($globalDBdriver == 'mysql') {
6244 6244
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6245 6245
 			} else {
6246 6246
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6247 6247
 			}
6248
-                }
6249
-                if ($sincedate != '') {
6250
-            		if ($globalDBdriver == 'mysql') {
6248
+				}
6249
+				if ($sincedate != '') {
6250
+					if ($globalDBdriver == 'mysql') {
6251 6251
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6252 6252
 			} else {
6253 6253
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6281,7 +6281,7 @@  discard block
 block discarded – undo
6281 6281
 				$query_values = array_merge($query_values,array(':day' => $day));
6282 6282
 			}
6283 6283
 		}
6284
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6284
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6285 6285
 				ORDER BY airport_departure_icao_count DESC";
6286 6286
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6287 6287
 
@@ -6304,35 +6304,35 @@  discard block
 block discarded – undo
6304 6304
 	}
6305 6305
 
6306 6306
 	/**
6307
-	* Gets all departure airports of the airplanes that have flown over
6308
-	*
6309
-	* @return Array the airport list
6310
-	*
6311
-	*/
6307
+	 * Gets all departure airports of the airplanes that have flown over
6308
+	 *
6309
+	 * @return Array the airport list
6310
+	 *
6311
+	 */
6312 6312
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6313 6313
 	{
6314 6314
 		global $globalDBdriver;
6315 6315
 		$filter_query = $this->getFilter($filters,true,true);
6316 6316
 		$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 
6317 6317
 			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 <> '' ";
6318
-                if ($olderthanmonths > 0) {
6319
-            		if ($globalDBdriver == 'mysql') {
6318
+				if ($olderthanmonths > 0) {
6319
+					if ($globalDBdriver == 'mysql') {
6320 6320
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6321 6321
 			} else {
6322 6322
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6323 6323
 			}
6324
-                }
6325
-                if ($sincedate != '') {
6326
-            		if ($globalDBdriver == 'mysql') {
6324
+				}
6325
+				if ($sincedate != '') {
6326
+					if ($globalDBdriver == 'mysql') {
6327 6327
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6328 6328
 			} else {
6329 6329
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6330 6330
 			}
6331 6331
 		}
6332 6332
 
6333
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6334
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6335
-                $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
6333
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6334
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6335
+				$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
6336 6336
 				ORDER BY airport_departure_icao_count DESC";
6337 6337
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6338 6338
       
@@ -6357,26 +6357,26 @@  discard block
 block discarded – undo
6357 6357
 	}
6358 6358
 
6359 6359
 	/**
6360
-	* Gets all detected departure airports of the airplanes that have flown over
6361
-	*
6362
-	* @return Array the airport list
6363
-	*
6364
-	*/
6360
+	 * Gets all detected departure airports of the airplanes that have flown over
6361
+	 *
6362
+	 * @return Array the airport list
6363
+	 *
6364
+	 */
6365 6365
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6366 6366
 	{
6367 6367
 		global $globalDBdriver;
6368 6368
 		$filter_query = $this->getFilter($filters,true,true);
6369 6369
 		$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
6370 6370
 				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";
6371
-                if ($olderthanmonths > 0) {
6372
-            		if ($globalDBdriver == 'mysql') {
6371
+				if ($olderthanmonths > 0) {
6372
+					if ($globalDBdriver == 'mysql') {
6373 6373
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6374 6374
 			} else {
6375 6375
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6376 6376
 			}
6377
-                }
6378
-                if ($sincedate != '') {
6379
-            		if ($globalDBdriver == 'mysql') {
6377
+				}
6378
+				if ($sincedate != '') {
6379
+					if ($globalDBdriver == 'mysql') {
6380 6380
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6381 6381
 			} else {
6382 6382
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6410,10 +6410,10 @@  discard block
 block discarded – undo
6410 6410
 				$query_values = array_merge($query_values,array(':day' => $day));
6411 6411
 			}
6412 6412
 		}
6413
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6413
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6414 6414
 				ORDER BY airport_departure_icao_count DESC";
6415 6415
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6416
-    		//echo $query;
6416
+			//echo $query;
6417 6417
 		$sth = $this->db->prepare($query);
6418 6418
 		$sth->execute($query_values);
6419 6419
       
@@ -6434,35 +6434,35 @@  discard block
 block discarded – undo
6434 6434
 	}
6435 6435
 	
6436 6436
 	/**
6437
-	* Gets all detected departure airports of the airplanes that have flown over
6438
-	*
6439
-	* @return Array the airport list
6440
-	*
6441
-	*/
6437
+	 * Gets all detected departure airports of the airplanes that have flown over
6438
+	 *
6439
+	 * @return Array the airport list
6440
+	 *
6441
+	 */
6442 6442
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6443 6443
 	{
6444 6444
 		global $globalDBdriver;
6445 6445
 		$filter_query = $this->getFilter($filters,true,true);
6446 6446
 		$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
6447 6447
 				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 ";
6448
-                if ($olderthanmonths > 0) {
6449
-            		if ($globalDBdriver == 'mysql') {
6448
+				if ($olderthanmonths > 0) {
6449
+					if ($globalDBdriver == 'mysql') {
6450 6450
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6451 6451
 			} else {
6452 6452
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6453 6453
 			}
6454
-                }
6455
-                if ($sincedate != '') {
6456
-            		if ($globalDBdriver == 'mysql') {
6454
+				}
6455
+				if ($sincedate != '') {
6456
+					if ($globalDBdriver == 'mysql') {
6457 6457
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6458 6458
 			} else {
6459 6459
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6460 6460
 			}
6461 6461
 		}
6462 6462
 
6463
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6464
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6465
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6463
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6464
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6465
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6466 6466
 				ORDER BY airport_departure_icao_count DESC";
6467 6467
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6468 6468
       
@@ -6487,11 +6487,11 @@  discard block
 block discarded – undo
6487 6487
 	}	
6488 6488
 	
6489 6489
 	/**
6490
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6491
-	*
6492
-	* @return Array the airport list
6493
-	*
6494
-	*/
6490
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6491
+	 *
6492
+	 * @return Array the airport list
6493
+	 *
6494
+	 */
6495 6495
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6496 6496
 	{
6497 6497
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6525,11 +6525,11 @@  discard block
 block discarded – undo
6525 6525
 	
6526 6526
 	
6527 6527
 	/**
6528
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6529
-	*
6530
-	* @return Array the airport list
6531
-	*
6532
-	*/
6528
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6529
+	 *
6530
+	 * @return Array the airport list
6531
+	 *
6532
+	 */
6533 6533
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6534 6534
 	{
6535 6535
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6560,11 +6560,11 @@  discard block
 block discarded – undo
6560 6560
 	
6561 6561
 	
6562 6562
 	/**
6563
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6564
-	*
6565
-	* @return Array the airport list
6566
-	*
6567
-	*/
6563
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6564
+	 *
6565
+	 * @return Array the airport list
6566
+	 *
6567
+	 */
6568 6568
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6569 6569
 	{
6570 6570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6597,11 +6597,11 @@  discard block
 block discarded – undo
6597 6597
 	
6598 6598
 	
6599 6599
 	/**
6600
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6601
-	*
6602
-	* @return Array the airport list
6603
-	*
6604
-	*/
6600
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6601
+	 *
6602
+	 * @return Array the airport list
6603
+	 *
6604
+	 */
6605 6605
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6606 6606
 	{
6607 6607
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6631,11 +6631,11 @@  discard block
 block discarded – undo
6631 6631
 	
6632 6632
 	
6633 6633
 	/**
6634
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6635
-	*
6636
-	* @return Array the airport list
6637
-	*
6638
-	*/
6634
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6635
+	 *
6636
+	 * @return Array the airport list
6637
+	 *
6638
+	 */
6639 6639
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6640 6640
 	{
6641 6641
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6668,11 +6668,11 @@  discard block
 block discarded – undo
6668 6668
 	
6669 6669
 	
6670 6670
 	/**
6671
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6672
-	*
6673
-	* @return Array the airport list
6674
-	*
6675
-	*/
6671
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6672
+	 *
6673
+	 * @return Array the airport list
6674
+	 *
6675
+	 */
6676 6676
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6677 6677
 	{
6678 6678
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6702,11 +6702,11 @@  discard block
 block discarded – undo
6702 6702
 	
6703 6703
 	
6704 6704
 	/**
6705
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6706
-	*
6707
-	* @return Array the airport list
6708
-	*
6709
-	*/
6705
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6706
+	 *
6707
+	 * @return Array the airport list
6708
+	 *
6709
+	 */
6710 6710
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6711 6711
 	{
6712 6712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6739,11 +6739,11 @@  discard block
 block discarded – undo
6739 6739
 	
6740 6740
 	
6741 6741
 	/**
6742
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6743
-	*
6744
-	* @return Array the airport list
6745
-	*
6746
-	*/
6742
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6743
+	 *
6744
+	 * @return Array the airport list
6745
+	 *
6746
+	 */
6747 6747
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6748 6748
 	{
6749 6749
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6774,11 +6774,11 @@  discard block
 block discarded – undo
6774 6774
 	
6775 6775
 	
6776 6776
 	/**
6777
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6778
-	*
6779
-	* @return Array the airport list
6780
-	*
6781
-	*/
6777
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6778
+	 *
6779
+	 * @return Array the airport list
6780
+	 *
6781
+	 */
6782 6782
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6783 6783
 	{
6784 6784
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6811,11 +6811,11 @@  discard block
 block discarded – undo
6811 6811
 	
6812 6812
 	
6813 6813
 	/**
6814
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6815
-	*
6816
-	* @return Array the airport list
6817
-	*
6818
-	*/
6814
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6815
+	 *
6816
+	 * @return Array the airport list
6817
+	 *
6818
+	 */
6819 6819
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6820 6820
 	{
6821 6821
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6845,11 +6845,11 @@  discard block
 block discarded – undo
6845 6845
 	
6846 6846
 	
6847 6847
 	/**
6848
-	* Gets all departure airports of the airplanes that have flown over based on a date
6849
-	*
6850
-	* @return Array the airport list
6851
-	*
6852
-	*/
6848
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6849
+	 *
6850
+	 * @return Array the airport list
6851
+	 *
6852
+	 */
6853 6853
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6854 6854
 	{
6855 6855
 		global $globalTimezone, $globalDBdriver;
@@ -6895,11 +6895,11 @@  discard block
 block discarded – undo
6895 6895
 	
6896 6896
 	
6897 6897
 	/**
6898
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6899
-	*
6900
-	* @return Array the airport list
6901
-	*
6902
-	*/
6898
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6899
+	 *
6900
+	 * @return Array the airport list
6901
+	 *
6902
+	 */
6903 6903
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6904 6904
 	{
6905 6905
 		global $globalTimezone, $globalDBdriver;
@@ -6942,11 +6942,11 @@  discard block
 block discarded – undo
6942 6942
 	
6943 6943
 	
6944 6944
 	/**
6945
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6946
-	*
6947
-	* @return Array the airport list
6948
-	*
6949
-	*/
6945
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6946
+	 *
6947
+	 * @return Array the airport list
6948
+	 *
6949
+	 */
6950 6950
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6951 6951
 	{
6952 6952
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6978,11 +6978,11 @@  discard block
 block discarded – undo
6978 6978
 	}
6979 6979
 	
6980 6980
 	/**
6981
-	* Gets all departure airports of the airplanes that have flown over based on a owner
6982
-	*
6983
-	* @return Array the airport list
6984
-	*
6985
-	*/
6981
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
6982
+	 *
6983
+	 * @return Array the airport list
6984
+	 *
6985
+	 */
6986 6986
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
6987 6987
 	{
6988 6988
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7014,11 +7014,11 @@  discard block
 block discarded – undo
7014 7014
 	}
7015 7015
 	
7016 7016
 	/**
7017
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7018
-	*
7019
-	* @return Array the airport list
7020
-	*
7021
-	*/
7017
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7018
+	 *
7019
+	 * @return Array the airport list
7020
+	 *
7021
+	 */
7022 7022
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7023 7023
 	{
7024 7024
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7051,11 +7051,11 @@  discard block
 block discarded – undo
7051 7051
 	
7052 7052
 	
7053 7053
 	/**
7054
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7055
-	*
7056
-	* @return Array the airport list
7057
-	*
7058
-	*/
7054
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7055
+	 *
7056
+	 * @return Array the airport list
7057
+	 *
7058
+	 */
7059 7059
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7060 7060
 	{
7061 7061
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7084,11 +7084,11 @@  discard block
 block discarded – undo
7084 7084
 	}
7085 7085
 	
7086 7086
 	/**
7087
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7088
-	*
7089
-	* @return Array the airport list
7090
-	*
7091
-	*/
7087
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7088
+	 *
7089
+	 * @return Array the airport list
7090
+	 *
7091
+	 */
7092 7092
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7093 7093
 	{
7094 7094
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7104,11 +7104,11 @@  discard block
 block discarded – undo
7104 7104
 	}
7105 7105
 	
7106 7106
 	/**
7107
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7108
-	*
7109
-	* @return Array the airport list
7110
-	*
7111
-	*/
7107
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7108
+	 *
7109
+	 * @return Array the airport list
7110
+	 *
7111
+	 */
7112 7112
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7113 7113
 	{
7114 7114
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7126,11 +7126,11 @@  discard block
 block discarded – undo
7126 7126
 	
7127 7127
 	
7128 7128
 	/**
7129
-	* Gets all departure airports of the airplanes that have flown over based on a country
7130
-	*
7131
-	* @return Array the airport list
7132
-	*
7133
-	*/
7129
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7130
+	 *
7131
+	 * @return Array the airport list
7132
+	 *
7133
+	 */
7134 7134
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7135 7135
 	{
7136 7136
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7164,11 +7164,11 @@  discard block
 block discarded – undo
7164 7164
 
7165 7165
 
7166 7166
 	/**
7167
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7168
-	*
7169
-	* @return Array the airport list
7170
-	*
7171
-	*/
7167
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7168
+	 *
7169
+	 * @return Array the airport list
7170
+	 *
7171
+	 */
7172 7172
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7173 7173
 	{
7174 7174
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7198,31 +7198,31 @@  discard block
 block discarded – undo
7198 7198
 	
7199 7199
 
7200 7200
 	/**
7201
-	* Gets all arrival airports of the airplanes that have flown over
7202
-	*
7203
-	* @param Boolean $limit Limit result to 10 or not
7204
-	* @param Integer $olderthanmonths Only show result older than x months
7205
-	* @param String $sincedate Only show result since x date
7206
-	* @param Boolean $icaoaskey Show result by ICAO
7207
-	* @param Array $filters Filter used here
7208
-	* @return Array the airport list
7209
-	*
7210
-	*/
7201
+	 * Gets all arrival airports of the airplanes that have flown over
7202
+	 *
7203
+	 * @param Boolean $limit Limit result to 10 or not
7204
+	 * @param Integer $olderthanmonths Only show result older than x months
7205
+	 * @param String $sincedate Only show result since x date
7206
+	 * @param Boolean $icaoaskey Show result by ICAO
7207
+	 * @param Array $filters Filter used here
7208
+	 * @return Array the airport list
7209
+	 *
7210
+	 */
7211 7211
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7212 7212
 	{
7213 7213
 		global $globalDBdriver;
7214 7214
 		$filter_query = $this->getFilter($filters,true,true);
7215 7215
 		$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 
7216 7216
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7217
-                if ($olderthanmonths > 0) {
7218
-            		if ($globalDBdriver == 'mysql') {
7217
+				if ($olderthanmonths > 0) {
7218
+					if ($globalDBdriver == 'mysql') {
7219 7219
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7220 7220
 			} else {
7221 7221
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7222 7222
 			}
7223 7223
 		}
7224
-                if ($sincedate != '') {
7225
-            		if ($globalDBdriver == 'mysql') {
7224
+				if ($sincedate != '') {
7225
+					if ($globalDBdriver == 'mysql') {
7226 7226
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7227 7227
 			} else {
7228 7228
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7256,7 +7256,7 @@  discard block
 block discarded – undo
7256 7256
 				$query_values = array_merge($query_values,array(':day' => $day));
7257 7257
 			}
7258 7258
 		}
7259
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7259
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7260 7260
 					ORDER BY airport_arrival_icao_count DESC";
7261 7261
 		if ($limit) $query .= " LIMIT 10";
7262 7262
       
@@ -7285,35 +7285,35 @@  discard block
 block discarded – undo
7285 7285
 	}
7286 7286
 
7287 7287
 	/**
7288
-	* Gets all arrival airports of the airplanes that have flown over
7289
-	*
7290
-	* @return Array the airport list
7291
-	*
7292
-	*/
7288
+	 * Gets all arrival airports of the airplanes that have flown over
7289
+	 *
7290
+	 * @return Array the airport list
7291
+	 *
7292
+	 */
7293 7293
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7294 7294
 	{
7295 7295
 		global $globalDBdriver;
7296 7296
 		$filter_query = $this->getFilter($filters,true,true);
7297 7297
 		$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 
7298 7298
 			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 <> '' ";
7299
-                if ($olderthanmonths > 0) {
7300
-            		if ($globalDBdriver == 'mysql') {
7299
+				if ($olderthanmonths > 0) {
7300
+					if ($globalDBdriver == 'mysql') {
7301 7301
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7302 7302
 			} else {
7303 7303
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7304 7304
 			}
7305 7305
 		}
7306
-                if ($sincedate != '') {
7307
-            		if ($globalDBdriver == 'mysql') {
7306
+				if ($sincedate != '') {
7307
+					if ($globalDBdriver == 'mysql') {
7308 7308
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7309 7309
 			} else {
7310 7310
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7311 7311
 			}
7312 7312
 		}
7313 7313
 
7314
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7315
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7316
-                $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
7314
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7315
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7316
+				$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
7317 7317
 					ORDER BY airport_arrival_icao_count DESC";
7318 7318
 		if ($limit) $query .= " LIMIT 10";
7319 7319
       
@@ -7344,26 +7344,26 @@  discard block
 block discarded – undo
7344 7344
 
7345 7345
 
7346 7346
 	/**
7347
-	* Gets all detected arrival airports of the airplanes that have flown over
7348
-	*
7349
-	* @return Array the airport list
7350
-	*
7351
-	*/
7347
+	 * Gets all detected arrival airports of the airplanes that have flown over
7348
+	 *
7349
+	 * @return Array the airport list
7350
+	 *
7351
+	 */
7352 7352
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7353 7353
 	{
7354 7354
 		global $globalDBdriver;
7355 7355
 		$filter_query = $this->getFilter($filters,true,true);
7356 7356
 		$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 
7357 7357
 			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";
7358
-                if ($olderthanmonths > 0) {
7359
-            		if ($globalDBdriver == 'mysql') {
7358
+				if ($olderthanmonths > 0) {
7359
+					if ($globalDBdriver == 'mysql') {
7360 7360
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7361 7361
 			} else {
7362 7362
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7363 7363
 			}
7364 7364
 		}
7365
-                if ($sincedate != '') {
7366
-            		if ($globalDBdriver == 'mysql') {
7365
+				if ($sincedate != '') {
7366
+					if ($globalDBdriver == 'mysql') {
7367 7367
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7368 7368
 			} else {
7369 7369
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7397,7 +7397,7 @@  discard block
 block discarded – undo
7397 7397
 				$query_values = array_merge($query_values,array(':day' => $day));
7398 7398
 			}
7399 7399
 		}
7400
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7400
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7401 7401
 					ORDER BY airport_arrival_icao_count DESC";
7402 7402
 		if ($limit) $query .= " LIMIT 10";
7403 7403
       
@@ -7425,35 +7425,35 @@  discard block
 block discarded – undo
7425 7425
 	}
7426 7426
 	
7427 7427
 	/**
7428
-	* Gets all detected arrival airports of the airplanes that have flown over
7429
-	*
7430
-	* @return Array the airport list
7431
-	*
7432
-	*/
7428
+	 * Gets all detected arrival airports of the airplanes that have flown over
7429
+	 *
7430
+	 * @return Array the airport list
7431
+	 *
7432
+	 */
7433 7433
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7434 7434
 	{
7435 7435
 		global $globalDBdriver;
7436 7436
 		$filter_query = $this->getFilter($filters,true,true);
7437 7437
 		$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 
7438 7438
 			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 ";
7439
-                if ($olderthanmonths > 0) {
7440
-            		if ($globalDBdriver == 'mysql') {
7439
+				if ($olderthanmonths > 0) {
7440
+					if ($globalDBdriver == 'mysql') {
7441 7441
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7442 7442
 			} else {
7443 7443
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7444 7444
 			}
7445 7445
 		}
7446
-                if ($sincedate != '') {
7447
-            		if ($globalDBdriver == 'mysql') {
7446
+				if ($sincedate != '') {
7447
+					if ($globalDBdriver == 'mysql') {
7448 7448
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7449 7449
 			} else {
7450 7450
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7451 7451
 			}
7452 7452
 		}
7453 7453
 
7454
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7455
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7456
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7454
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7455
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7456
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7457 7457
 					ORDER BY airport_arrival_icao_count DESC";
7458 7458
 		if ($limit) $query .= " LIMIT 10";
7459 7459
       
@@ -7483,11 +7483,11 @@  discard block
 block discarded – undo
7483 7483
 	}	
7484 7484
 	
7485 7485
 	/**
7486
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7487
-	*
7488
-	* @return Array the airport list
7489
-	*
7490
-	*/
7486
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7487
+	 *
7488
+	 * @return Array the airport list
7489
+	 *
7490
+	 */
7491 7491
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7492 7492
 	{
7493 7493
 		$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 arrival airports by country of the airplanes that have flown over based on an airline icao
7523
-	*
7524
-	* @return Array the airport list
7525
-	*
7526
-	*/
7522
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7523
+	 *
7524
+	 * @return Array the airport list
7525
+	 *
7526
+	 */
7527 7527
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7528 7528
 	{
7529 7529
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7554,11 +7554,11 @@  discard block
 block discarded – undo
7554 7554
 	
7555 7555
 	
7556 7556
 	/**
7557
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7558
-	*
7559
-	* @return Array the airport list
7560
-	*
7561
-	*/
7557
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7558
+	 *
7559
+	 * @return Array the airport list
7560
+	 *
7561
+	 */
7562 7562
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7563 7563
 	{
7564 7564
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7592,11 +7592,11 @@  discard block
 block discarded – undo
7592 7592
 	
7593 7593
 	
7594 7594
 	/**
7595
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7596
-	*
7597
-	* @return Array the airport list
7598
-	*
7599
-	*/
7595
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7596
+	 *
7597
+	 * @return Array the airport list
7598
+	 *
7599
+	 */
7600 7600
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7601 7601
 	{
7602 7602
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7626,11 +7626,11 @@  discard block
 block discarded – undo
7626 7626
 	
7627 7627
 	
7628 7628
 	/**
7629
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7630
-	*
7631
-	* @return Array the airport list
7632
-	*
7633
-	*/
7629
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
7630
+	 *
7631
+	 * @return Array the airport list
7632
+	 *
7633
+	 */
7634 7634
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7635 7635
 	{
7636 7636
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7664,11 +7664,11 @@  discard block
 block discarded – undo
7664 7664
 	
7665 7665
 	
7666 7666
 	/**
7667
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7668
-	*
7669
-	* @return Array the airport list
7670
-	*
7671
-	*/
7667
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
7668
+	 *
7669
+	 * @return Array the airport list
7670
+	 *
7671
+	 */
7672 7672
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7673 7673
 	{
7674 7674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7699,11 +7699,11 @@  discard block
 block discarded – undo
7699 7699
 	
7700 7700
 	
7701 7701
 	/**
7702
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
7703
-	*
7704
-	* @return Array the airport list
7705
-	*
7706
-	*/
7702
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
7703
+	 *
7704
+	 * @return Array the airport list
7705
+	 *
7706
+	 */
7707 7707
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7708 7708
 	{
7709 7709
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7736,11 +7736,11 @@  discard block
 block discarded – undo
7736 7736
 	
7737 7737
 	
7738 7738
 	/**
7739
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7740
-	*
7741
-	* @return Array the airport list
7742
-	*
7743
-	*/
7739
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7740
+	 *
7741
+	 * @return Array the airport list
7742
+	 *
7743
+	 */
7744 7744
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7745 7745
 	{
7746 7746
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7770,11 +7770,11 @@  discard block
 block discarded – undo
7770 7770
 	
7771 7771
 	
7772 7772
 	/**
7773
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7774
-	*
7775
-	* @return Array the airport list
7776
-	*
7777
-	*/
7773
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7774
+	 *
7775
+	 * @return Array the airport list
7776
+	 *
7777
+	 */
7778 7778
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7779 7779
 	{
7780 7780
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7808,11 +7808,11 @@  discard block
 block discarded – undo
7808 7808
 	
7809 7809
 	
7810 7810
 	/**
7811
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7812
-	*
7813
-	* @return Array the airport list
7814
-	*
7815
-	*/
7811
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7812
+	 *
7813
+	 * @return Array the airport list
7814
+	 *
7815
+	 */
7816 7816
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7817 7817
 	{
7818 7818
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7843,11 +7843,11 @@  discard block
 block discarded – undo
7843 7843
 	
7844 7844
 	
7845 7845
 	/**
7846
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7847
-	*
7848
-	* @return Array the airport list
7849
-	*
7850
-	*/
7846
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7847
+	 *
7848
+	 * @return Array the airport list
7849
+	 *
7850
+	 */
7851 7851
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7852 7852
 	{
7853 7853
 		global $globalTimezone, $globalDBdriver;
@@ -7893,11 +7893,11 @@  discard block
 block discarded – undo
7893 7893
 	
7894 7894
 	
7895 7895
 	/**
7896
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7897
-	*
7898
-	* @return Array the airport list
7899
-	*
7900
-	*/
7896
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7897
+	 *
7898
+	 * @return Array the airport list
7899
+	 *
7900
+	 */
7901 7901
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7902 7902
 	{
7903 7903
 		global $globalTimezone, $globalDBdriver;
@@ -7940,11 +7940,11 @@  discard block
 block discarded – undo
7940 7940
 	
7941 7941
 	
7942 7942
 	/**
7943
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7944
-	*
7945
-	* @return Array the airport list
7946
-	*
7947
-	*/
7943
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7944
+	 *
7945
+	 * @return Array the airport list
7946
+	 *
7947
+	 */
7948 7948
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7949 7949
 	{
7950 7950
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7976,11 +7976,11 @@  discard block
 block discarded – undo
7976 7976
 	}
7977 7977
 	
7978 7978
 	/**
7979
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
7980
-	*
7981
-	* @return Array the airport list
7982
-	*
7983
-	*/
7979
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
7980
+	 *
7981
+	 * @return Array the airport list
7982
+	 *
7983
+	 */
7984 7984
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
7985 7985
 	{
7986 7986
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8011,11 +8011,11 @@  discard block
 block discarded – undo
8011 8011
 	}
8012 8012
 
8013 8013
 	/**
8014
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8015
-	*
8016
-	* @return Array the airport list
8017
-	*
8018
-	*/
8014
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8015
+	 *
8016
+	 * @return Array the airport list
8017
+	 *
8018
+	 */
8019 8019
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8020 8020
 	{
8021 8021
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8046,11 +8046,11 @@  discard block
 block discarded – undo
8046 8046
 	}
8047 8047
 	
8048 8048
 	/**
8049
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8050
-	*
8051
-	* @return Array the airport list
8052
-	*
8053
-	*/
8049
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8050
+	 *
8051
+	 * @return Array the airport list
8052
+	 *
8053
+	 */
8054 8054
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8055 8055
 	{
8056 8056
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8079,11 +8079,11 @@  discard block
 block discarded – undo
8079 8079
 	}
8080 8080
 	
8081 8081
 	/**
8082
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8083
-	*
8084
-	* @return Array the airport list
8085
-	*
8086
-	*/
8082
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8083
+	 *
8084
+	 * @return Array the airport list
8085
+	 *
8086
+	 */
8087 8087
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8088 8088
 	{
8089 8089
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8101,11 +8101,11 @@  discard block
 block discarded – undo
8101 8101
 	
8102 8102
 	
8103 8103
 	/**
8104
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8105
-	*
8106
-	* @return Array the airport list
8107
-	*
8108
-	*/
8104
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8105
+	 *
8106
+	 * @return Array the airport list
8107
+	 *
8108
+	 */
8109 8109
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8110 8110
 	{
8111 8111
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8138,11 +8138,11 @@  discard block
 block discarded – undo
8138 8138
 	
8139 8139
 	
8140 8140
 	/**
8141
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8142
-	*
8143
-	* @return Array the airport list
8144
-	*
8145
-	*/
8141
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8142
+	 *
8143
+	 * @return Array the airport list
8144
+	 *
8145
+	 */
8146 8146
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8147 8147
 	{
8148 8148
 		global $globalDBdriver;
@@ -8174,11 +8174,11 @@  discard block
 block discarded – undo
8174 8174
 
8175 8175
 
8176 8176
 	/**
8177
-	* Counts all airport departure countries
8178
-	*
8179
-	* @return Array the airport departure list
8180
-	*
8181
-	*/
8177
+	 * Counts all airport departure countries
8178
+	 *
8179
+	 * @return Array the airport departure list
8180
+	 *
8181
+	 */
8182 8182
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8183 8183
 	{
8184 8184
 		global $globalDBdriver;
@@ -8237,11 +8237,11 @@  discard block
 block discarded – undo
8237 8237
 	
8238 8238
 	
8239 8239
 	/**
8240
-	* Counts all airport arrival countries
8241
-	*
8242
-	* @return Array the airport arrival list
8243
-	*
8244
-	*/
8240
+	 * Counts all airport arrival countries
8241
+	 *
8242
+	 * @return Array the airport arrival list
8243
+	 *
8244
+	 */
8245 8245
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8246 8246
 	{
8247 8247
 		global $globalDBdriver;
@@ -8303,11 +8303,11 @@  discard block
 block discarded – undo
8303 8303
 
8304 8304
 
8305 8305
 	/**
8306
-	* Gets all route combinations
8307
-	*
8308
-	* @return Array the route list
8309
-	*
8310
-	*/
8306
+	 * Gets all route combinations
8307
+	 *
8308
+	 * @return Array the route list
8309
+	 *
8310
+	 */
8311 8311
 	public function countAllRoutes($filters = array())
8312 8312
 	{
8313 8313
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8346,11 +8346,11 @@  discard block
 block discarded – undo
8346 8346
 	
8347 8347
 	
8348 8348
 	/**
8349
-	* Gets all route combinations based on an aircraft
8350
-	*
8351
-	* @return Array the route list
8352
-	*
8353
-	*/
8349
+	 * Gets all route combinations based on an aircraft
8350
+	 *
8351
+	 * @return Array the route list
8352
+	 *
8353
+	 */
8354 8354
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8355 8355
 	{
8356 8356
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8386,11 +8386,11 @@  discard block
 block discarded – undo
8386 8386
 	
8387 8387
 	
8388 8388
 	/**
8389
-	* Gets all route combinations based on an aircraft registration
8390
-	*
8391
-	* @return Array the route list
8392
-	*
8393
-	*/
8389
+	 * Gets all route combinations based on an aircraft registration
8390
+	 *
8391
+	 * @return Array the route list
8392
+	 *
8393
+	 */
8394 8394
 	public function countAllRoutesByRegistration($registration, $filters = array())
8395 8395
 	{
8396 8396
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8428,11 +8428,11 @@  discard block
 block discarded – undo
8428 8428
 	
8429 8429
 	
8430 8430
 	/**
8431
-	* Gets all route combinations based on an airline
8432
-	*
8433
-	* @return Array the route list
8434
-	*
8435
-	*/
8431
+	 * Gets all route combinations based on an airline
8432
+	 *
8433
+	 * @return Array the route list
8434
+	 *
8435
+	 */
8436 8436
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8437 8437
 	{
8438 8438
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8470,11 +8470,11 @@  discard block
 block discarded – undo
8470 8470
 	
8471 8471
 	
8472 8472
 	/**
8473
-	* Gets all route combinations based on an airport
8474
-	*
8475
-	* @return Array the route list
8476
-	*
8477
-	*/
8473
+	 * Gets all route combinations based on an airport
8474
+	 *
8475
+	 * @return Array the route list
8476
+	 *
8477
+	 */
8478 8478
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8479 8479
 	{
8480 8480
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8511,11 +8511,11 @@  discard block
 block discarded – undo
8511 8511
 	
8512 8512
 	
8513 8513
 	/**
8514
-	* Gets all route combinations based on an country
8515
-	*
8516
-	* @return Array the route list
8517
-	*
8518
-	*/
8514
+	 * Gets all route combinations based on an country
8515
+	 *
8516
+	 * @return Array the route list
8517
+	 *
8518
+	 */
8519 8519
 	public function countAllRoutesByCountry($country, $filters = array())
8520 8520
 	{
8521 8521
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8551,11 +8551,11 @@  discard block
 block discarded – undo
8551 8551
 
8552 8552
 
8553 8553
 	/**
8554
-	* Gets all route combinations based on an date
8555
-	*
8556
-	* @return Array the route list
8557
-	*
8558
-	*/
8554
+	 * Gets all route combinations based on an date
8555
+	 *
8556
+	 * @return Array the route list
8557
+	 *
8558
+	 */
8559 8559
 	public function countAllRoutesByDate($date, $filters = array())
8560 8560
 	{
8561 8561
 		global $globalTimezone, $globalDBdriver;
@@ -8605,11 +8605,11 @@  discard block
 block discarded – undo
8605 8605
 	
8606 8606
 	
8607 8607
 	/**
8608
-	* Gets all route combinations based on an ident/callsign
8609
-	*
8610
-	* @return Array the route list
8611
-	*
8612
-	*/
8608
+	 * Gets all route combinations based on an ident/callsign
8609
+	 *
8610
+	 * @return Array the route list
8611
+	 *
8612
+	 */
8613 8613
 	public function countAllRoutesByIdent($ident, $filters = array())
8614 8614
 	{
8615 8615
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8645,11 +8645,11 @@  discard block
 block discarded – undo
8645 8645
 	}
8646 8646
 	
8647 8647
 	/**
8648
-	* Gets all route combinations based on an owner
8649
-	*
8650
-	* @return Array the route list
8651
-	*
8652
-	*/
8648
+	 * Gets all route combinations based on an owner
8649
+	 *
8650
+	 * @return Array the route list
8651
+	 *
8652
+	 */
8653 8653
 	public function countAllRoutesByOwner($owner,$filters = array())
8654 8654
 	{
8655 8655
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8685,11 +8685,11 @@  discard block
 block discarded – undo
8685 8685
 	}
8686 8686
 	
8687 8687
 	/**
8688
-	* Gets all route combinations based on a pilot
8689
-	*
8690
-	* @return Array the route list
8691
-	*
8692
-	*/
8688
+	 * Gets all route combinations based on a pilot
8689
+	 *
8690
+	 * @return Array the route list
8691
+	 *
8692
+	 */
8693 8693
 	public function countAllRoutesByPilot($pilot,$filters = array())
8694 8694
 	{
8695 8695
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8726,11 +8726,11 @@  discard block
 block discarded – undo
8726 8726
 	
8727 8727
 	
8728 8728
 	/**
8729
-	* Gets all route combinations based on an manufacturer
8730
-	*
8731
-	* @return Array the route list
8732
-	*
8733
-	*/
8729
+	 * Gets all route combinations based on an manufacturer
8730
+	 *
8731
+	 * @return Array the route list
8732
+	 *
8733
+	 */
8734 8734
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8735 8735
 	{
8736 8736
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8768,11 +8768,11 @@  discard block
 block discarded – undo
8768 8768
 	
8769 8769
 	
8770 8770
 	/**
8771
-	* Gets all route combinations with waypoints
8772
-	*
8773
-	* @return Array the route list
8774
-	*
8775
-	*/
8771
+	 * Gets all route combinations with waypoints
8772
+	 *
8773
+	 * @return Array the route list
8774
+	 *
8775
+	 */
8776 8776
 	public function countAllRoutesWithWaypoints($filters = array())
8777 8777
 	{
8778 8778
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8809,11 +8809,11 @@  discard block
 block discarded – undo
8809 8809
 	}
8810 8810
 	
8811 8811
 	/**
8812
-	* Gets all callsigns that have flown over
8813
-	*
8814
-	* @return Array the callsign list
8815
-	*
8816
-	*/
8812
+	 * Gets all callsigns that have flown over
8813
+	 *
8814
+	 * @return Array the callsign list
8815
+	 *
8816
+	 */
8817 8817
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8818 8818
 	{
8819 8819
 		global $globalDBdriver;
@@ -8879,11 +8879,11 @@  discard block
 block discarded – undo
8879 8879
 	}
8880 8880
 
8881 8881
 	/**
8882
-	* Gets all callsigns that have flown over
8883
-	*
8884
-	* @return Array the callsign list
8885
-	*
8886
-	*/
8882
+	 * Gets all callsigns that have flown over
8883
+	 *
8884
+	 * @return Array the callsign list
8885
+	 *
8886
+	 */
8887 8887
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8888 8888
 	{
8889 8889
 		global $globalDBdriver;
@@ -8924,11 +8924,11 @@  discard block
 block discarded – undo
8924 8924
 
8925 8925
 
8926 8926
 	/**
8927
-	* Counts all dates
8928
-	*
8929
-	* @return Array the date list
8930
-	*
8931
-	*/
8927
+	 * Counts all dates
8928
+	 *
8929
+	 * @return Array the date list
8930
+	 *
8931
+	 */
8932 8932
 	public function countAllDates($filters = array())
8933 8933
 	{
8934 8934
 		global $globalTimezone, $globalDBdriver;
@@ -8973,11 +8973,11 @@  discard block
 block discarded – undo
8973 8973
 	}
8974 8974
 	
8975 8975
 	/**
8976
-	* Counts all dates
8977
-	*
8978
-	* @return Array the date list
8979
-	*
8980
-	*/
8976
+	 * Counts all dates
8977
+	 *
8978
+	 * @return Array the date list
8979
+	 *
8980
+	 */
8981 8981
 	public function countAllDatesByAirlines($filters = array())
8982 8982
 	{
8983 8983
 		global $globalTimezone, $globalDBdriver;
@@ -9022,11 +9022,11 @@  discard block
 block discarded – undo
9022 9022
 	}	
9023 9023
 	
9024 9024
 	/**
9025
-	* Counts all dates during the last 7 days
9026
-	*
9027
-	* @return Array the date list
9028
-	*
9029
-	*/
9025
+	 * Counts all dates during the last 7 days
9026
+	 *
9027
+	 * @return Array the date list
9028
+	 *
9029
+	 */
9030 9030
 	public function countAllDatesLast7Days($filters = array())
9031 9031
 	{
9032 9032
 		global $globalTimezone, $globalDBdriver;
@@ -9048,7 +9048,7 @@  discard block
 block discarded – undo
9048 9048
 			$query .= " GROUP BY date_name 
9049 9049
 								ORDER BY date_name ASC";
9050 9050
 			$query_data = array(':offset' => $offset);
9051
-    		}
9051
+			}
9052 9052
 		
9053 9053
 		$sth = $this->db->prepare($query);
9054 9054
 		$sth->execute($query_data);
@@ -9068,11 +9068,11 @@  discard block
 block discarded – undo
9068 9068
 	}
9069 9069
 
9070 9070
 	/**
9071
-	* Counts all dates during the last month
9072
-	*
9073
-	* @return Array the date list
9074
-	*
9075
-	*/
9071
+	 * Counts all dates during the last month
9072
+	 *
9073
+	 * @return Array the date list
9074
+	 *
9075
+	 */
9076 9076
 	public function countAllDatesLastMonth($filters = array())
9077 9077
 	{
9078 9078
 		global $globalTimezone, $globalDBdriver;
@@ -9094,7 +9094,7 @@  discard block
 block discarded – undo
9094 9094
 			$query .= " GROUP BY date_name 
9095 9095
 								ORDER BY date_name ASC";
9096 9096
 			$query_data = array(':offset' => $offset);
9097
-    		}
9097
+			}
9098 9098
 		
9099 9099
 		$sth = $this->db->prepare($query);
9100 9100
 		$sth->execute($query_data);
@@ -9115,11 +9115,11 @@  discard block
 block discarded – undo
9115 9115
 
9116 9116
 
9117 9117
 	/**
9118
-	* Counts all dates during the last month
9119
-	*
9120
-	* @return Array the date list
9121
-	*
9122
-	*/
9118
+	 * Counts all dates during the last month
9119
+	 *
9120
+	 * @return Array the date list
9121
+	 *
9122
+	 */
9123 9123
 	public function countAllDatesLastMonthByAirlines($filters = array())
9124 9124
 	{
9125 9125
 		global $globalTimezone, $globalDBdriver;
@@ -9142,7 +9142,7 @@  discard block
 block discarded – undo
9142 9142
 								GROUP BY spotter_output.airline_icao, date_name 
9143 9143
 								ORDER BY date_name ASC";
9144 9144
 			$query_data = array(':offset' => $offset);
9145
-    		}
9145
+			}
9146 9146
 		
9147 9147
 		$sth = $this->db->prepare($query);
9148 9148
 		$sth->execute($query_data);
@@ -9164,11 +9164,11 @@  discard block
 block discarded – undo
9164 9164
 	
9165 9165
 
9166 9166
 	/**
9167
-	* Counts all month
9168
-	*
9169
-	* @return Array the month list
9170
-	*
9171
-	*/
9167
+	 * Counts all month
9168
+	 *
9169
+	 * @return Array the month list
9170
+	 *
9171
+	 */
9172 9172
 	public function countAllMonths($filters = array())
9173 9173
 	{
9174 9174
 		global $globalTimezone, $globalDBdriver;
@@ -9210,11 +9210,11 @@  discard block
 block discarded – undo
9210 9210
 	}
9211 9211
 
9212 9212
 	/**
9213
-	* Counts all month
9214
-	*
9215
-	* @return Array the month list
9216
-	*
9217
-	*/
9213
+	 * Counts all month
9214
+	 *
9215
+	 * @return Array the month list
9216
+	 *
9217
+	 */
9218 9218
 	public function countAllMonthsByAirlines($filters = array())
9219 9219
 	{
9220 9220
 		global $globalTimezone, $globalDBdriver;
@@ -9259,11 +9259,11 @@  discard block
 block discarded – undo
9259 9259
 	}
9260 9260
 
9261 9261
 	/**
9262
-	* Counts all military month
9263
-	*
9264
-	* @return Array the month list
9265
-	*
9266
-	*/
9262
+	 * Counts all military month
9263
+	 *
9264
+	 * @return Array the month list
9265
+	 *
9266
+	 */
9267 9267
 	public function countAllMilitaryMonths($filters = array())
9268 9268
 	{
9269 9269
 		global $globalTimezone, $globalDBdriver;
@@ -9304,11 +9304,11 @@  discard block
 block discarded – undo
9304 9304
 	}
9305 9305
 	
9306 9306
 	/**
9307
-	* Counts all month owners
9308
-	*
9309
-	* @return Array the month list
9310
-	*
9311
-	*/
9307
+	 * Counts all month owners
9308
+	 *
9309
+	 * @return Array the month list
9310
+	 *
9311
+	 */
9312 9312
 	public function countAllMonthsOwners($filters = array())
9313 9313
 	{
9314 9314
 		global $globalTimezone, $globalDBdriver;
@@ -9350,11 +9350,11 @@  discard block
 block discarded – undo
9350 9350
 	}
9351 9351
 	
9352 9352
 	/**
9353
-	* Counts all month owners
9354
-	*
9355
-	* @return Array the month list
9356
-	*
9357
-	*/
9353
+	 * Counts all month owners
9354
+	 *
9355
+	 * @return Array the month list
9356
+	 *
9357
+	 */
9358 9358
 	public function countAllMonthsOwnersByAirlines($filters = array())
9359 9359
 	{
9360 9360
 		global $globalTimezone, $globalDBdriver;
@@ -9397,11 +9397,11 @@  discard block
 block discarded – undo
9397 9397
 	}
9398 9398
 
9399 9399
 	/**
9400
-	* Counts all month pilot
9401
-	*
9402
-	* @return Array the month list
9403
-	*
9404
-	*/
9400
+	 * Counts all month pilot
9401
+	 *
9402
+	 * @return Array the month list
9403
+	 *
9404
+	 */
9405 9405
 	public function countAllMonthsPilots($filters = array())
9406 9406
 	{
9407 9407
 		global $globalTimezone, $globalDBdriver;
@@ -9443,11 +9443,11 @@  discard block
 block discarded – undo
9443 9443
 	}
9444 9444
 	
9445 9445
 	/**
9446
-	* Counts all month pilot
9447
-	*
9448
-	* @return Array the month list
9449
-	*
9450
-	*/
9446
+	 * Counts all month pilot
9447
+	 *
9448
+	 * @return Array the month list
9449
+	 *
9450
+	 */
9451 9451
 	public function countAllMonthsPilotsByAirlines($filters = array())
9452 9452
 	{
9453 9453
 		global $globalTimezone, $globalDBdriver;
@@ -9490,11 +9490,11 @@  discard block
 block discarded – undo
9490 9490
 	}
9491 9491
 
9492 9492
 	/**
9493
-	* Counts all month airline
9494
-	*
9495
-	* @return Array the month list
9496
-	*
9497
-	*/
9493
+	 * Counts all month airline
9494
+	 *
9495
+	 * @return Array the month list
9496
+	 *
9497
+	 */
9498 9498
 	public function countAllMonthsAirlines($filters = array())
9499 9499
 	{
9500 9500
 		global $globalTimezone, $globalDBdriver;
@@ -9536,11 +9536,11 @@  discard block
 block discarded – undo
9536 9536
 	}
9537 9537
 	
9538 9538
 	/**
9539
-	* Counts all month aircraft
9540
-	*
9541
-	* @return Array the month list
9542
-	*
9543
-	*/
9539
+	 * Counts all month aircraft
9540
+	 *
9541
+	 * @return Array the month list
9542
+	 *
9543
+	 */
9544 9544
 	public function countAllMonthsAircrafts($filters = array())
9545 9545
 	{
9546 9546
 		global $globalTimezone, $globalDBdriver;
@@ -9583,11 +9583,11 @@  discard block
 block discarded – undo
9583 9583
 	
9584 9584
 
9585 9585
 	/**
9586
-	* Counts all month aircraft
9587
-	*
9588
-	* @return Array the month list
9589
-	*
9590
-	*/
9586
+	 * Counts all month aircraft
9587
+	 *
9588
+	 * @return Array the month list
9589
+	 *
9590
+	 */
9591 9591
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9592 9592
 	{
9593 9593
 		global $globalTimezone, $globalDBdriver;
@@ -9630,11 +9630,11 @@  discard block
 block discarded – undo
9630 9630
 	}
9631 9631
 
9632 9632
 	/**
9633
-	* Counts all month real arrival
9634
-	*
9635
-	* @return Array the month list
9636
-	*
9637
-	*/
9633
+	 * Counts all month real arrival
9634
+	 *
9635
+	 * @return Array the month list
9636
+	 *
9637
+	 */
9638 9638
 	public function countAllMonthsRealArrivals($filters = array())
9639 9639
 	{
9640 9640
 		global $globalTimezone, $globalDBdriver;
@@ -9677,11 +9677,11 @@  discard block
 block discarded – undo
9677 9677
 	
9678 9678
 
9679 9679
 	/**
9680
-	* Counts all month real arrival
9681
-	*
9682
-	* @return Array the month list
9683
-	*
9684
-	*/
9680
+	 * Counts all month real arrival
9681
+	 *
9682
+	 * @return Array the month list
9683
+	 *
9684
+	 */
9685 9685
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9686 9686
 	{
9687 9687
 		global $globalTimezone, $globalDBdriver;
@@ -9725,11 +9725,11 @@  discard block
 block discarded – undo
9725 9725
 	
9726 9726
 
9727 9727
 	/**
9728
-	* Counts all dates during the last year
9729
-	*
9730
-	* @return Array the date list
9731
-	*
9732
-	*/
9728
+	 * Counts all dates during the last year
9729
+	 *
9730
+	 * @return Array the date list
9731
+	 *
9732
+	 */
9733 9733
 	public function countAllMonthsLastYear($filters)
9734 9734
 	{
9735 9735
 		global $globalTimezone, $globalDBdriver;
@@ -9751,7 +9751,7 @@  discard block
 block discarded – undo
9751 9751
 			$query .= " GROUP BY year_name, month_name
9752 9752
 								ORDER BY year_name, month_name ASC";
9753 9753
 			$query_data = array(':offset' => $offset);
9754
-    		}
9754
+			}
9755 9755
 		
9756 9756
 		$sth = $this->db->prepare($query);
9757 9757
 		$sth->execute($query_data);
@@ -9774,11 +9774,11 @@  discard block
 block discarded – undo
9774 9774
 	
9775 9775
 	
9776 9776
 	/**
9777
-	* Counts all hours
9778
-	*
9779
-	* @return Array the hour list
9780
-	*
9781
-	*/
9777
+	 * Counts all hours
9778
+	 *
9779
+	 * @return Array the hour list
9780
+	 *
9781
+	 */
9782 9782
 	public function countAllHours($orderby,$filters = array())
9783 9783
 	{
9784 9784
 		global $globalTimezone, $globalDBdriver;
@@ -9839,11 +9839,11 @@  discard block
 block discarded – undo
9839 9839
 	}
9840 9840
 	
9841 9841
 	/**
9842
-	* Counts all hours
9843
-	*
9844
-	* @return Array the hour list
9845
-	*
9846
-	*/
9842
+	 * Counts all hours
9843
+	 *
9844
+	 * @return Array the hour list
9845
+	 *
9846
+	 */
9847 9847
 	public function countAllHoursByAirlines($orderby, $filters = array())
9848 9848
 	{
9849 9849
 		global $globalTimezone, $globalDBdriver;
@@ -9906,11 +9906,11 @@  discard block
 block discarded – undo
9906 9906
 
9907 9907
 
9908 9908
 	/**
9909
-	* Counts all hours by airline
9910
-	*
9911
-	* @return Array the hour list
9912
-	*
9913
-	*/
9909
+	 * Counts all hours by airline
9910
+	 *
9911
+	 * @return Array the hour list
9912
+	 *
9913
+	 */
9914 9914
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9915 9915
 	{
9916 9916
 		global $globalTimezone, $globalDBdriver;
@@ -9956,11 +9956,11 @@  discard block
 block discarded – undo
9956 9956
 	
9957 9957
 	
9958 9958
 	/**
9959
-	* Counts all hours by aircraft
9960
-	*
9961
-	* @return Array the hour list
9962
-	*
9963
-	*/
9959
+	 * Counts all hours by aircraft
9960
+	 *
9961
+	 * @return Array the hour list
9962
+	 *
9963
+	 */
9964 9964
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
9965 9965
 	{
9966 9966
 		global $globalTimezone, $globalDBdriver;
@@ -10003,11 +10003,11 @@  discard block
 block discarded – undo
10003 10003
 	
10004 10004
 	
10005 10005
 	/**
10006
-	* Counts all hours by aircraft registration
10007
-	*
10008
-	* @return Array the hour list
10009
-	*
10010
-	*/
10006
+	 * Counts all hours by aircraft registration
10007
+	 *
10008
+	 * @return Array the hour list
10009
+	 *
10010
+	 */
10011 10011
 	public function countAllHoursByRegistration($registration, $filters = array())
10012 10012
 	{
10013 10013
 		global $globalTimezone, $globalDBdriver;
@@ -10050,11 +10050,11 @@  discard block
 block discarded – undo
10050 10050
 	
10051 10051
 	
10052 10052
 	/**
10053
-	* Counts all hours by airport
10054
-	*
10055
-	* @return Array the hour list
10056
-	*
10057
-	*/
10053
+	 * Counts all hours by airport
10054
+	 *
10055
+	 * @return Array the hour list
10056
+	 *
10057
+	 */
10058 10058
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10059 10059
 	{
10060 10060
 		global $globalTimezone, $globalDBdriver;
@@ -10098,11 +10098,11 @@  discard block
 block discarded – undo
10098 10098
 	
10099 10099
 	
10100 10100
 	/**
10101
-	* Counts all hours by manufacturer
10102
-	*
10103
-	* @return Array the hour list
10104
-	*
10105
-	*/
10101
+	 * Counts all hours by manufacturer
10102
+	 *
10103
+	 * @return Array the hour list
10104
+	 *
10105
+	 */
10106 10106
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10107 10107
 	{
10108 10108
 		global $globalTimezone, $globalDBdriver;
@@ -10146,11 +10146,11 @@  discard block
 block discarded – undo
10146 10146
 	
10147 10147
 	
10148 10148
 	/**
10149
-	* Counts all hours by date
10150
-	*
10151
-	* @return Array the hour list
10152
-	*
10153
-	*/
10149
+	 * Counts all hours by date
10150
+	 *
10151
+	 * @return Array the hour list
10152
+	 *
10153
+	 */
10154 10154
 	public function countAllHoursByDate($date, $filters = array())
10155 10155
 	{
10156 10156
 		global $globalTimezone, $globalDBdriver;
@@ -10194,11 +10194,11 @@  discard block
 block discarded – undo
10194 10194
 	
10195 10195
 	
10196 10196
 	/**
10197
-	* Counts all hours by a ident/callsign
10198
-	*
10199
-	* @return Array the hour list
10200
-	*
10201
-	*/
10197
+	 * Counts all hours by a ident/callsign
10198
+	 *
10199
+	 * @return Array the hour list
10200
+	 *
10201
+	 */
10202 10202
 	public function countAllHoursByIdent($ident, $filters = array())
10203 10203
 	{
10204 10204
 		global $globalTimezone, $globalDBdriver;
@@ -10241,11 +10241,11 @@  discard block
 block discarded – undo
10241 10241
 	}
10242 10242
 	
10243 10243
 	/**
10244
-	* Counts all hours by a owner
10245
-	*
10246
-	* @return Array the hour list
10247
-	*
10248
-	*/
10244
+	 * Counts all hours by a owner
10245
+	 *
10246
+	 * @return Array the hour list
10247
+	 *
10248
+	 */
10249 10249
 	public function countAllHoursByOwner($owner, $filters = array())
10250 10250
 	{
10251 10251
 		global $globalTimezone, $globalDBdriver;
@@ -10288,11 +10288,11 @@  discard block
 block discarded – undo
10288 10288
 	}
10289 10289
 	
10290 10290
 	/**
10291
-	* Counts all hours by a pilot
10292
-	*
10293
-	* @return Array the hour list
10294
-	*
10295
-	*/
10291
+	 * Counts all hours by a pilot
10292
+	 *
10293
+	 * @return Array the hour list
10294
+	 *
10295
+	 */
10296 10296
 	public function countAllHoursByPilot($pilot, $filters = array())
10297 10297
 	{
10298 10298
 		global $globalTimezone, $globalDBdriver;
@@ -10337,11 +10337,11 @@  discard block
 block discarded – undo
10337 10337
 	
10338 10338
 	
10339 10339
 	/**
10340
-	* Counts all hours by route
10341
-	*
10342
-	* @return Array the hour list
10343
-	*
10344
-	*/
10340
+	 * Counts all hours by route
10341
+	 *
10342
+	 * @return Array the hour list
10343
+	 *
10344
+	 */
10345 10345
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10346 10346
 	{
10347 10347
 		global $globalTimezone, $globalDBdriver;
@@ -10385,11 +10385,11 @@  discard block
 block discarded – undo
10385 10385
 	
10386 10386
 	
10387 10387
 	/**
10388
-	* Counts all hours by country
10389
-	*
10390
-	* @return Array the hour list
10391
-	*
10392
-	*/
10388
+	 * Counts all hours by country
10389
+	 *
10390
+	 * @return Array the hour list
10391
+	 *
10392
+	 */
10393 10393
 	public function countAllHoursByCountry($country, $filters = array())
10394 10394
 	{
10395 10395
 		global $globalTimezone, $globalDBdriver;
@@ -10434,11 +10434,11 @@  discard block
 block discarded – undo
10434 10434
 
10435 10435
 
10436 10436
 	/**
10437
-	* Counts all aircraft that have flown over
10438
-	*
10439
-	* @return Integer the number of aircrafts
10440
-	*
10441
-	*/
10437
+	 * Counts all aircraft that have flown over
10438
+	 *
10439
+	 * @return Integer the number of aircrafts
10440
+	 *
10441
+	 */
10442 10442
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10443 10443
 	{
10444 10444
 		global $globalDBdriver;
@@ -10471,11 +10471,11 @@  discard block
 block discarded – undo
10471 10471
 	}
10472 10472
 
10473 10473
 	/**
10474
-	* Counts all flight that really arrival
10475
-	*
10476
-	* @return Integer the number of aircrafts
10477
-	*
10478
-	*/
10474
+	 * Counts all flight that really arrival
10475
+	 *
10476
+	 * @return Integer the number of aircrafts
10477
+	 *
10478
+	 */
10479 10479
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10480 10480
 	{
10481 10481
 		global $globalDBdriver;
@@ -10508,11 +10508,11 @@  discard block
 block discarded – undo
10508 10508
 	}
10509 10509
 
10510 10510
 	/**
10511
-	* Counts all pilots that have flown over
10512
-	*
10513
-	* @return Integer the number of pilots
10514
-	*
10515
-	*/
10511
+	 * Counts all pilots that have flown over
10512
+	 *
10513
+	 * @return Integer the number of pilots
10514
+	 *
10515
+	 */
10516 10516
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10517 10517
 	{
10518 10518
 		global $globalDBdriver;
@@ -10544,11 +10544,11 @@  discard block
 block discarded – undo
10544 10544
 	}
10545 10545
 
10546 10546
 	/**
10547
-	* Counts all owners that have flown over
10548
-	*
10549
-	* @return Integer the number of owners
10550
-	*
10551
-	*/
10547
+	 * Counts all owners that have flown over
10548
+	 *
10549
+	 * @return Integer the number of owners
10550
+	 *
10551
+	 */
10552 10552
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10553 10553
 	{
10554 10554
 		global $globalDBdriver;
@@ -10581,11 +10581,11 @@  discard block
 block discarded – undo
10581 10581
 	
10582 10582
 	
10583 10583
 	/**
10584
-	* Counts all flights that have flown over
10585
-	*
10586
-	* @return Integer the number of flights
10587
-	*
10588
-	*/
10584
+	 * Counts all flights that have flown over
10585
+	 *
10586
+	 * @return Integer the number of flights
10587
+	 *
10588
+	 */
10589 10589
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
10590 10590
 	{
10591 10591
 		global $globalDBdriver;
@@ -10620,11 +10620,11 @@  discard block
 block discarded – undo
10620 10620
 	}
10621 10621
 	
10622 10622
 	/**
10623
-	* Counts all military flights that have flown over
10624
-	*
10625
-	* @return Integer the number of flights
10626
-	*
10627
-	*/
10623
+	 * Counts all military flights that have flown over
10624
+	 *
10625
+	 * @return Integer the number of flights
10626
+	 *
10627
+	 */
10628 10628
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10629 10629
 	{
10630 10630
 		global $globalDBdriver;
@@ -10659,11 +10659,11 @@  discard block
 block discarded – undo
10659 10659
 	
10660 10660
 	
10661 10661
 	/**
10662
-	* Counts all airlines that have flown over
10663
-	*
10664
-	* @return Integer the number of airlines
10665
-	*
10666
-	*/
10662
+	 * Counts all airlines that have flown over
10663
+	 *
10664
+	 * @return Integer the number of airlines
10665
+	 *
10666
+	 */
10667 10667
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10668 10668
 	{
10669 10669
 		global $globalDBdriver;
@@ -10690,8 +10690,8 @@  discard block
 block discarded – undo
10690 10690
 				$query_values = array_merge($query_values,array(':month' => $month));
10691 10691
 			}
10692 10692
 		}
10693
-                if ($query == '') $queryi .= $this->getFilter($filters);
10694
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10693
+				if ($query == '') $queryi .= $this->getFilter($filters);
10694
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10695 10695
 
10696 10696
 
10697 10697
 		$sth = $this->db->prepare($queryi);
@@ -10701,11 +10701,11 @@  discard block
 block discarded – undo
10701 10701
 
10702 10702
   
10703 10703
 	/**
10704
-	* Counts all hours of today
10705
-	*
10706
-	* @return Array the hour list
10707
-	*
10708
-	*/
10704
+	 * Counts all hours of today
10705
+	 *
10706
+	 * @return Array the hour list
10707
+	 *
10708
+	 */
10709 10709
 	public function countAllHoursFromToday($filters = array())
10710 10710
 	{
10711 10711
 		global $globalTimezone, $globalDBdriver;
@@ -10745,11 +10745,11 @@  discard block
 block discarded – undo
10745 10745
 	}
10746 10746
     
10747 10747
 	/**
10748
-	* Gets all the spotter information based on calculated upcoming flights
10749
-	*
10750
-	* @return Array the spotter information
10751
-	*
10752
-	*/
10748
+	 * Gets all the spotter information based on calculated upcoming flights
10749
+	 *
10750
+	 * @return Array the spotter information
10751
+	 *
10752
+	 */
10753 10753
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10754 10754
 	{
10755 10755
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -10824,12 +10824,12 @@  discard block
 block discarded – undo
10824 10824
 	}
10825 10825
     
10826 10826
     
10827
-     /**
10828
-	* Gets the Barrie Spotter ID based on the FlightAware ID
10829
-	*
10830
-	* @return Integer the Barrie Spotter ID
10827
+	 /**
10828
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
10829
+	  *
10830
+	  * @return Integer the Barrie Spotter ID
10831 10831
 q	*
10832
-	*/
10832
+	  */
10833 10833
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10834 10834
 	{
10835 10835
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -10850,13 +10850,13 @@  discard block
 block discarded – undo
10850 10850
   
10851 10851
  
10852 10852
 	/**
10853
-	* Parses a date string
10854
-	*
10855
-	* @param String $dateString the date string
10856
-	* @param String $timezone the timezone of a user
10857
-	* @return Array the time information
10858
-	*
10859
-	*/
10853
+	 * Parses a date string
10854
+	 *
10855
+	 * @param String $dateString the date string
10856
+	 * @param String $timezone the timezone of a user
10857
+	 * @return Array the time information
10858
+	 *
10859
+	 */
10860 10860
 	public function parseDateString($dateString, $timezone = '')
10861 10861
 	{
10862 10862
 		$time_array = array();
@@ -10892,12 +10892,12 @@  discard block
 block discarded – undo
10892 10892
 	
10893 10893
 	
10894 10894
 	/**
10895
-	* Parses the direction degrees to working
10896
-	*
10897
-	* @param Float $direction the direction in degrees
10898
-	* @return Array the direction information
10899
-	*
10900
-	*/
10895
+	 * Parses the direction degrees to working
10896
+	 *
10897
+	 * @param Float $direction the direction in degrees
10898
+	 * @return Array the direction information
10899
+	 *
10900
+	 */
10901 10901
 	public function parseDirection($direction = 0)
10902 10902
 	{
10903 10903
 		if ($direction == '') $direction = 0;
@@ -10976,12 +10976,12 @@  discard block
 block discarded – undo
10976 10976
 	
10977 10977
 	
10978 10978
 	/**
10979
-	* Gets the aircraft registration
10980
-	*
10981
-	* @param String $flightaware_id the flight aware id
10982
-	* @return String the aircraft registration
10983
-	*
10984
-	*/
10979
+	 * Gets the aircraft registration
10980
+	 *
10981
+	 * @param String $flightaware_id the flight aware id
10982
+	 * @return String the aircraft registration
10983
+	 *
10984
+	 */
10985 10985
 	
10986 10986
 	public function getAircraftRegistration($flightaware_id)
10987 10987
 	{
@@ -11010,12 +11010,12 @@  discard block
 block discarded – undo
11010 11010
 
11011 11011
 
11012 11012
 	/**
11013
-	* Gets the aircraft registration from ModeS
11014
-	*
11015
-	* @param String $aircraft_modes the flight ModeS in hex
11016
-	* @return String the aircraft registration
11017
-	*
11018
-	*/
11013
+	 * Gets the aircraft registration from ModeS
11014
+	 *
11015
+	 * @param String $aircraft_modes the flight ModeS in hex
11016
+	 * @return String the aircraft registration
11017
+	 *
11018
+	 */
11019 11019
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11020 11020
 	{
11021 11021
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11028,19 +11028,19 @@  discard block
 block discarded – undo
11028 11028
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11029 11029
 		$sth->closeCursor();
11030 11030
 		if (count($row) > 0) {
11031
-		    //return $row['Registration'];
11032
-		    return $row['registration'];
11031
+			//return $row['Registration'];
11032
+			return $row['registration'];
11033 11033
 		} else return '';
11034 11034
 	
11035 11035
 	}
11036 11036
 
11037 11037
 	/**
11038
-	* Gets the aircraft type from ModeS
11039
-	*
11040
-	* @param String $aircraft_modes the flight ModeS in hex
11041
-	* @return String the aircraft type
11042
-	*
11043
-	*/
11038
+	 * Gets the aircraft type from ModeS
11039
+	 *
11040
+	 * @param String $aircraft_modes the flight ModeS in hex
11041
+	 * @return String the aircraft type
11042
+	 *
11043
+	 */
11044 11044
 	public function getAircraftTypeBymodeS($aircraft_modes)
11045 11045
 	{
11046 11046
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11053,19 +11053,19 @@  discard block
 block discarded – undo
11053 11053
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11054 11054
 		$sth->closeCursor();
11055 11055
 		if (count($row) > 0) {
11056
-		    if ($row['type_flight'] == null) return '';
11057
-		    else return $row['type_flight'];
11056
+			if ($row['type_flight'] == null) return '';
11057
+			else return $row['type_flight'];
11058 11058
 		} else return '';
11059 11059
 	
11060 11060
 	}
11061 11061
 
11062 11062
 	/**
11063
-	* Gets Country from latitude/longitude
11064
-	*
11065
-	* @param Float $latitude latitute of the flight
11066
-	* @param Float $longitude longitute of the flight
11067
-	* @return String the countrie
11068
-	*/
11063
+	 * Gets Country from latitude/longitude
11064
+	 *
11065
+	 * @param Float $latitude latitute of the flight
11066
+	 * @param Float $longitude longitute of the flight
11067
+	 * @return String the countrie
11068
+	 */
11069 11069
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11070 11070
 	{
11071 11071
 		global $globalDBdriver, $globalDebug;
@@ -11102,11 +11102,11 @@  discard block
 block discarded – undo
11102 11102
 	}
11103 11103
 
11104 11104
 	/**
11105
-	* Gets Country from iso2
11106
-	*
11107
-	* @param String $iso2 ISO2 country code
11108
-	* @return String the countrie
11109
-	*/
11105
+	 * Gets Country from iso2
11106
+	 *
11107
+	 * @param String $iso2 ISO2 country code
11108
+	 * @return String the countrie
11109
+	 */
11110 11110
 	public function getCountryFromISO2($iso2)
11111 11111
 	{
11112 11112
 		global $globalDBdriver, $globalDebug;
@@ -11134,12 +11134,12 @@  discard block
 block discarded – undo
11134 11134
 	}
11135 11135
 
11136 11136
 	/**
11137
-	* converts the registration code using the country prefix
11138
-	*
11139
-	* @param String $registration the aircraft registration
11140
-	* @return String the aircraft registration
11141
-	*
11142
-	*/
11137
+	 * converts the registration code using the country prefix
11138
+	 *
11139
+	 * @param String $registration the aircraft registration
11140
+	 * @return String the aircraft registration
11141
+	 *
11142
+	 */
11143 11143
 	public function convertAircraftRegistration($registration)
11144 11144
 	{
11145 11145
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11191,12 +11191,12 @@  discard block
 block discarded – undo
11191 11191
 	}
11192 11192
 
11193 11193
 	/**
11194
-	* Country from the registration code
11195
-	*
11196
-	* @param String $registration the aircraft registration
11197
-	* @return String the country
11198
-	*
11199
-	*/
11194
+	 * Country from the registration code
11195
+	 *
11196
+	 * @param String $registration the aircraft registration
11197
+	 * @return String the country
11198
+	 *
11199
+	 */
11200 11200
 	public function countryFromAircraftRegistration($registration)
11201 11201
 	{
11202 11202
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11215,8 +11215,8 @@  discard block
 block discarded – undo
11215 11215
 				$country = $row['country'];
11216 11216
 			}
11217 11217
 		} else {
11218
-    			$registration_1 = substr($registration, 0, 1);
11219
-		        $registration_2 = substr($registration, 0, 2);
11218
+				$registration_1 = substr($registration, 0, 1);
11219
+				$registration_2 = substr($registration, 0, 2);
11220 11220
 
11221 11221
 			$country = '';
11222 11222
 			//first get the prefix based on two characters
@@ -11252,12 +11252,12 @@  discard block
 block discarded – undo
11252 11252
 	}
11253 11253
 
11254 11254
 	/**
11255
-	* Registration prefix from the registration code
11256
-	*
11257
-	* @param String $registration the aircraft registration
11258
-	* @return String the registration prefix
11259
-	*
11260
-	*/
11255
+	 * Registration prefix from the registration code
11256
+	 *
11257
+	 * @param String $registration the aircraft registration
11258
+	 * @return String the registration prefix
11259
+	 *
11260
+	 */
11261 11261
 	public function registrationPrefixFromAircraftRegistration($registration)
11262 11262
 	{
11263 11263
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11276,8 +11276,8 @@  discard block
 block discarded – undo
11276 11276
 				//$country = $row['country'];
11277 11277
 			}
11278 11278
 		} else {
11279
-    			$registration_1 = substr($registration, 0, 1);
11280
-		        $registration_2 = substr($registration, 0, 2);
11279
+				$registration_1 = substr($registration, 0, 1);
11280
+				$registration_2 = substr($registration, 0, 2);
11281 11281
 
11282 11282
 			//first get the prefix based on two characters
11283 11283
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11313,12 +11313,12 @@  discard block
 block discarded – undo
11313 11313
 
11314 11314
 
11315 11315
 	/**
11316
-	* Country from the registration code
11317
-	*
11318
-	* @param String $registration the aircraft registration
11319
-	* @return String the country
11320
-	*
11321
-	*/
11316
+	 * Country from the registration code
11317
+	 *
11318
+	 * @param String $registration the aircraft registration
11319
+	 * @return String the country
11320
+	 *
11321
+	 */
11322 11322
 	public function countryFromAircraftRegistrationCode($registration)
11323 11323
 	{
11324 11324
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11335,11 +11335,11 @@  discard block
 block discarded – undo
11335 11335
 	}
11336 11336
 	
11337 11337
 	/**
11338
-	* Set a new highlight value for a flight
11339
-	*
11340
-	* @param String $flightaware_id flightaware_id from spotter_output table
11341
-	* @param String $highlight New highlight value
11342
-	*/
11338
+	 * Set a new highlight value for a flight
11339
+	 *
11340
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11341
+	 * @param String $highlight New highlight value
11342
+	 */
11343 11343
 	public function setHighlightFlight($flightaware_id,$highlight) {
11344 11344
 		
11345 11345
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11348,12 +11348,12 @@  discard block
 block discarded – undo
11348 11348
 	}
11349 11349
 
11350 11350
 	/**
11351
-	* Set a new highlight value for a flight by Registration
11352
-	*
11353
-	* @param String $registration Registration of the aircraft
11354
-	* @param String $date Date of spotted aircraft
11355
-	* @param String $highlight New highlight value
11356
-	*/
11351
+	 * Set a new highlight value for a flight by Registration
11352
+	 *
11353
+	 * @param String $registration Registration of the aircraft
11354
+	 * @param String $date Date of spotted aircraft
11355
+	 * @param String $highlight New highlight value
11356
+	 */
11357 11357
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11358 11358
 		if ($date == '') {
11359 11359
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11367,12 +11367,12 @@  discard block
 block discarded – undo
11367 11367
 	}
11368 11368
 	
11369 11369
 	/**
11370
-	* Gets the short url from bit.ly
11371
-	*
11372
-	* @param String $url the full url
11373
-	* @return String the bit.ly url
11374
-	*
11375
-	*/
11370
+	 * Gets the short url from bit.ly
11371
+	 *
11372
+	 * @param String $url the full url
11373
+	 * @return String the bit.ly url
11374
+	 *
11375
+	 */
11376 11376
 	public function getBitlyURL($url)
11377 11377
 	{
11378 11378
 		global $globalBitlyAccessToken;
@@ -11661,11 +11661,11 @@  discard block
 block discarded – undo
11661 11661
 			$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 
11662 11662
 	                      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)) 
11663 11663
 	                      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;";
11664
-                } else {
11664
+				} else {
11665 11665
 			$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 
11666 11666
 	                      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)) 
11667 11667
 	                      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;";
11668
-    		}
11668
+			}
11669 11669
 		$sth = $this->db->prepare($query);
11670 11670
 		$sth->execute();
11671 11671
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1254 added lines, -1254 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $aircraft_correct_icaotype = array('CL64' => 'CL60',
9 9
 					'F9LX' => 'F900',
10 10
 					'K35T' => 'K35R',
@@ -59,45 +59,45 @@  discard block
 block discarded – undo
59 59
 	* @param Array $filter the filter
60 60
 	* @return Array the SQL part
61 61
 	*/
62
-	public function getFilter($filter = array(),$where = false,$and = false) {
62
+	public function getFilter($filter = array(), $where = false, $and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
64 64
 		$filters = array();
65 65
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
66 66
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
67 67
 				$filters = $globalStatsFilters[$globalFilterName];
68 68
 			} else {
69
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
69
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
73 73
 		$filter_query_join = '';
74 74
 		$filter_query_where = '';
75
-		foreach($filters as $flt) {
75
+		foreach ($filters as $flt) {
76 76
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
77 77
 				if ($flt['airlines'][0] != '') {
78 78
 					if (isset($flt['source'])) {
79
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
79
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
80 80
 					} else {
81
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
81
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
82 82
 					}
83 83
 				}
84 84
 			}
85 85
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
86 86
 				if (isset($flt['source'])) {
87
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
87
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
88 88
 				} else {
89
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
89
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
90 90
 				}
91 91
 			}
92 92
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
93 93
 				if (isset($flt['source'])) {
94
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
94
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
95 95
 				}
96 96
 			}
97 97
 		}
98 98
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
99 99
 			if ($filter['airlines'][0] != '') {
100
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
100
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
101 101
 			}
102 102
 		}
103 103
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
108 108
 		}
109 109
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
110
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
110
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
111 111
 			}
112 112
 		if (isset($filter['source']) && !empty($filter['source'])) {
113
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
113
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
114 114
 		}
115 115
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
116 116
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119 119
 			if ($filter_query_where == '') {
120
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
120
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
121 121
 			} else {
122
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
122
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
123 123
 			}
124 124
 		}
125 125
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	* @return Array the spotter information
138 138
 	*
139 139
 	*/
140
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
140
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
143 143
 		$Image = new Image($this->db);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			$sth = $this->db->prepare($query.$limitQuery);
168 168
 			$sth->execute($params);
169 169
 		} catch (PDOException $e) {
170
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
170
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
171 171
 			exit();
172 172
 		}
173 173
 		
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$spotter_array = array();
178 178
 		
179 179
 
180
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
180
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
181 181
 		{
182 182
 			$num_rows++;
183 183
 			$temp_array = array();
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			if (isset($row['route_stop'])) {
223 223
 				$temp_array['route_stop'] = $row['route_stop'];
224 224
 				if ($row['route_stop'] != '') {
225
-					$allroute = explode(' ',$row['route_stop']);
225
+					$allroute = explode(' ', $row['route_stop']);
226 226
 			
227 227
 					foreach ($allroute as $route) {
228 228
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 				{
278 278
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
279 279
 				} else {
280
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
280
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
281 281
 				}
282 282
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
283
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
284
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
283
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
284
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
285 285
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
286 286
 			}
287 287
 			
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
316 316
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
317 317
 					if (is_numeric(substr($row['ident'], 2, 1))) {
318
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
318
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
319 319
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
320
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
320
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
321 321
 					} else {
322 322
 						$airline_array = $this->getAllAirlineInfo('NA');
323 323
 					}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				}
355 355
 			}
356 356
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
357
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
357
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
358 358
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
359 359
 				if (count($acars_array) > 0) {
360 360
 					$temp_array['acars'] = $acars_array;
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
372 372
 			}
373 373
 
374
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
374
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
375 375
 			{
376 376
 				if ($globalIVAO) {
377
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
378
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
377
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
378
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
379 379
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
380 380
 				if (count($image_array) > 0) {
381 381
 					$temp_array['image'] = $image_array[0]['image'];
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
400 400
 			}
401 401
 			
402
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
402
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
403 403
 				if ($schedules === true) {
404 404
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
405 405
 					//print_r($schedule_array);
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
 			if (isset($row['squawk'])) {
482 482
 				$temp_array['squawk'] = $row['squawk'];
483 483
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
484
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
485
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
484
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
485
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
486 486
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
487
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
488
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
489
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
487
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
488
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
489
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
490 490
 			}
491 491
     			
492 492
 			$temp_array['query_number_rows'] = $num_rows;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	* @return Array the spotter information
506 506
 	*
507 507
 	*/
508
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
508
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
509 509
 	{
510 510
 		global $globalTimezone, $globalDBdriver;
511 511
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
 		$query_values = array();
517 517
 		$additional_query = '';
518
-		$filter_query = $this->getFilter($filters,true,true);
518
+		$filter_query = $this->getFilter($filters, true, true);
519 519
 		if ($q != "")
520 520
 		{
521 521
 			if (!is_string($q))
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 				return false;
524 524
 			} else {
525 525
 				$q_array = explode(" ", $q);
526
-				foreach ($q_array as $q_item){
527
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
526
+				foreach ($q_array as $q_item) {
527
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
528 528
 					$additional_query .= " AND (";
529 529
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
530 530
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -556,37 +556,37 @@  discard block
 block discarded – undo
556 556
 
557 557
 		if ($registration != "")
558 558
 		{
559
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
559
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
560 560
 			if (!is_string($registration))
561 561
 			{
562 562
 				return false;
563 563
 			} else {
564 564
 				$additional_query .= " AND spotter_output.registration = :registration";
565
-				$query_values = array_merge($query_values,array(':registration' => $registration));
565
+				$query_values = array_merge($query_values, array(':registration' => $registration));
566 566
 			}
567 567
 		}
568 568
 
569 569
 		if ($aircraft_icao != "")
570 570
 		{
571
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
571
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
572 572
 			if (!is_string($aircraft_icao))
573 573
 			{
574 574
 				return false;
575 575
 			} else {
576 576
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
577
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
577
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
578 578
 			}
579 579
 		}
580 580
 
581 581
 		if ($aircraft_manufacturer != "")
582 582
 		{
583
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
583
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
584 584
 			if (!is_string($aircraft_manufacturer))
585 585
 			{
586 586
 				return false;
587 587
 			} else {
588 588
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
589
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
589
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
590 590
 			}
591 591
 		}
592 592
 
@@ -602,25 +602,25 @@  discard block
 block discarded – undo
602 602
 
603 603
 		if ($airline_icao != "")
604 604
 		{
605
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
605
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
606 606
 			if (!is_string($airline_icao))
607 607
 			{
608 608
 				return false;
609 609
 			} else {
610 610
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
611
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
611
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
612 612
 			}
613 613
 		}
614 614
 
615 615
 		if ($airline_country != "")
616 616
 		{
617
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
617
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
618 618
 			if (!is_string($airline_country))
619 619
 			{
620 620
 				return false;
621 621
 			} else {
622 622
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
623
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
623
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
624 624
 			}
625 625
 		}
626 626
 
@@ -647,31 +647,31 @@  discard block
 block discarded – undo
647 647
 
648 648
 		if ($airport != "")
649 649
 		{
650
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
650
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
651 651
 			if (!is_string($airport))
652 652
 			{
653 653
 				return false;
654 654
 			} else {
655 655
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
656
-				$query_values = array_merge($query_values,array(':airport' => $airport));
656
+				$query_values = array_merge($query_values, array(':airport' => $airport));
657 657
 			}
658 658
 		}
659 659
 
660 660
 		if ($airport_country != "")
661 661
 		{
662
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
662
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
663 663
 			if (!is_string($airport_country))
664 664
 			{
665 665
 				return false;
666 666
 			} else {
667 667
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
668
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
668
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
669 669
 			}
670 670
 		}
671 671
     
672 672
 		if ($callsign != "")
673 673
 		{
674
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
674
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
675 675
 			if (!is_string($callsign))
676 676
 			{
677 677
 				return false;
@@ -679,79 +679,79 @@  discard block
 block discarded – undo
679 679
 				$translate = $Translation->ident2icao($callsign);
680 680
 				if ($translate != $callsign) {
681 681
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
682
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
682
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
683 683
 				} else {
684 684
 					$additional_query .= " AND spotter_output.ident = :callsign";
685
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
685
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
686 686
 				}
687 687
 			}
688 688
 		}
689 689
 
690 690
 		if ($owner != "")
691 691
 		{
692
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
692
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
693 693
 			if (!is_string($owner))
694 694
 			{
695 695
 				return false;
696 696
 			} else {
697 697
 				$additional_query .= " AND spotter_output.owner_name = :owner";
698
-				$query_values = array_merge($query_values,array(':owner' => $owner));
698
+				$query_values = array_merge($query_values, array(':owner' => $owner));
699 699
 			}
700 700
 		}
701 701
 
702 702
 		if ($pilot_name != "")
703 703
 		{
704
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
704
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
705 705
 			if (!is_string($pilot_name))
706 706
 			{
707 707
 				return false;
708 708
 			} else {
709 709
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
710
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
710
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
711 711
 			}
712 712
 		}
713 713
 
714 714
 		if ($pilot_id != "")
715 715
 		{
716
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
716
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
717 717
 			if (!is_string($pilot_id))
718 718
 			{
719 719
 				return false;
720 720
 			} else {
721 721
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
722
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
722
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
723 723
 			}
724 724
 		}
725 725
 
726 726
 		if ($departure_airport_route != "")
727 727
 		{
728
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
728
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
729 729
 			if (!is_string($departure_airport_route))
730 730
 			{
731 731
 				return false;
732 732
 			} else {
733 733
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
734
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
734
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
735 735
 			}
736 736
 		}
737 737
 
738 738
 		if ($arrival_airport_route != "")
739 739
 		{
740
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
740
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
741 741
 			if (!is_string($arrival_airport_route))
742 742
 			{
743 743
 				return false;
744 744
 			} else {
745 745
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
746
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
746
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
747 747
 			}
748 748
 		}
749 749
 
750 750
 		if ($altitude != "")
751 751
 		{
752 752
 			$altitude_array = explode(",", $altitude);
753
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
754
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
753
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
754
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
755 755
 
756 756
 			if ($altitude_array[1] != "")
757 757
 			{                
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 		if ($date_posted != "")
768 768
 		{
769 769
 			$date_array = explode(",", $date_posted);
770
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
771
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
770
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
771
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
772 772
 
773 773
 			if ($globalTimezone != '') {
774 774
 				date_default_timezone_set($globalTimezone);
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 		{
800 800
 			$limit_array = explode(",", $limit);
801 801
 			
802
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
803
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
802
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
803
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
804 804
 			
805 805
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
806 806
 			{
@@ -829,23 +829,23 @@  discard block
 block discarded – undo
829 829
 
830 830
 
831 831
 		if ($origLat != "" && $origLon != "" && $dist != "") {
832
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
832
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
833 833
 
834 834
 			if ($globalDBdriver == 'mysql') {
835
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
835
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
836 836
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
837 837
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
838 838
 			} else {
839
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
839
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
840 840
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
841 841
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
842 842
 			}
843 843
 		} else {		
844
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
844
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
845 845
 					".$additional_query."
846 846
 					".$orderby_query;
847 847
 		}
848
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
848
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
849 849
 		return $spotter_array;
850 850
 	}
851 851
 	
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 		{
869 869
 			$limit_array = explode(",", $limit);
870 870
 			
871
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
872
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
871
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
872
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
873 873
 			
874 874
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
875 875
 			{
@@ -886,9 +886,9 @@  discard block
 block discarded – undo
886 886
 			$orderby_query = " ORDER BY spotter_output.date DESC";
887 887
 		}
888 888
 
889
-		$query  = $global_query.$filter_query." ".$orderby_query;
889
+		$query = $global_query.$filter_query." ".$orderby_query;
890 890
 
891
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
891
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
892 892
 
893 893
 		return $spotter_array;
894 894
 	}
@@ -934,34 +934,34 @@  discard block
 block discarded – undo
934 934
 			{
935 935
 				return false;
936 936
 			} else {
937
-				if ($interval == "30m"){
937
+				if ($interval == "30m") {
938 938
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
939
-				} else if ($interval == "1h"){
939
+				} else if ($interval == "1h") {
940 940
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
941
-				} else if ($interval == "3h"){
941
+				} else if ($interval == "3h") {
942 942
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
943
-				} else if ($interval == "6h"){
943
+				} else if ($interval == "6h") {
944 944
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
945
-				} else if ($interval == "12h"){
945
+				} else if ($interval == "12h") {
946 946
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
947
-				} else if ($interval == "24h"){
947
+				} else if ($interval == "24h") {
948 948
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
949
-				} else if ($interval == "7d"){
949
+				} else if ($interval == "7d") {
950 950
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
951
-				} else if ($interval == "30d"){
951
+				} else if ($interval == "30d") {
952 952
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
953 953
 				} 
954 954
 			}
955 955
 		}
956 956
 
957
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
957
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
958 958
                    WHERE spotter_output.latitude <> '' 
959 959
 				   AND spotter_output.longitude <> '' 
960 960
                    ".$additional_query."
961 961
                    HAVING distance < :radius  
962 962
 				   ORDER BY distance";
963 963
 
964
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
964
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
965 965
 
966 966
 		return $spotter_array;
967 967
 	}
@@ -973,21 +973,21 @@  discard block
 block discarded – undo
973 973
 	* @return Array the spotter information
974 974
 	*
975 975
 	*/
976
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
976
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
977 977
 	{
978 978
 		global $global_query;
979 979
 		
980 980
 		date_default_timezone_set('UTC');
981 981
 
982
-		$filter_query = $this->getFilter($filter,true,true);
982
+		$filter_query = $this->getFilter($filter, true, true);
983 983
 
984 984
 		$limit_query = '';
985 985
 		if ($limit != "")
986 986
 		{
987 987
 			$limit_array = explode(",", $limit);
988 988
 			
989
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
990
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
989
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
990
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
991 991
 			
992 992
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
993 993
 			{
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1005 1005
 		}
1006 1006
 
1007
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1007
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1008 1008
 
1009 1009
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1010 1010
 
@@ -1023,15 +1023,15 @@  discard block
 block discarded – undo
1023 1023
 		global $global_query;
1024 1024
 		
1025 1025
 		date_default_timezone_set('UTC');
1026
-		$filter_query = $this->getFilter($filter,true,true);
1026
+		$filter_query = $this->getFilter($filter, true, true);
1027 1027
 
1028 1028
 		$limit_query = '';
1029 1029
 		if ($limit != "")
1030 1030
 		{
1031 1031
 			$limit_array = explode(",", $limit);
1032 1032
 			
1033
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1034
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1033
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1034
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1035 1035
 			
1036 1036
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1037 1037
 			{
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1049 1049
 		}
1050 1050
 
1051
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1051
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1052 1052
 
1053 1053
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1054 1054
 
@@ -1062,20 +1062,20 @@  discard block
 block discarded – undo
1062 1062
 	* @return Array the spotter information
1063 1063
 	*
1064 1064
 	*/
1065
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1065
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
1068 1068
 		
1069 1069
 		date_default_timezone_set('UTC');
1070
-		$filter_query = $this->getFilter($filter,true,true);
1070
+		$filter_query = $this->getFilter($filter, true, true);
1071 1071
 		
1072 1072
 		$limit_query = '';
1073 1073
 		if ($limit != "")
1074 1074
 		{
1075 1075
 			$limit_array = explode(",", $limit);
1076 1076
 			
1077
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1078
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1077
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1078
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1079 1079
 			
1080 1080
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1081 1081
 			{
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1093 1093
 		}
1094 1094
 
1095
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1095
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1096 1096
 
1097 1097
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1098 1098
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 		
1113 1113
 		date_default_timezone_set('UTC');
1114 1114
 		
1115
-		$filter_query = $this->getFilter($filter,true,true);
1115
+		$filter_query = $this->getFilter($filter, true, true);
1116 1116
 		
1117 1117
 		$limit_query = '';
1118 1118
 		
@@ -1120,8 +1120,8 @@  discard block
 block discarded – undo
1120 1120
 		{
1121 1121
 			$limit_array = explode(",", $limit);
1122 1122
 			
1123
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1124
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1123
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1124
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1125 1125
 			
1126 1126
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1127 1127
 			{
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1139 1139
 		}
1140 1140
 
1141
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1141
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1142 1142
 
1143 1143
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1144 1144
 
@@ -1157,14 +1157,14 @@  discard block
 block discarded – undo
1157 1157
 		global $global_query;
1158 1158
 		
1159 1159
 		date_default_timezone_set('UTC');
1160
-		$filter_query = $this->getFilter($filter,true,true);
1160
+		$filter_query = $this->getFilter($filter, true, true);
1161 1161
 		$limit_query = '';
1162 1162
 		if ($limit != "")
1163 1163
 		{
1164 1164
 			$limit_array = explode(",", $limit);
1165 1165
 			
1166
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1167
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1166
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1167
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1168 1168
 			
1169 1169
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1170 1170
 			{
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1182 1182
 		}
1183 1183
 
1184
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1184
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1185 1185
 
1186 1186
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1187 1187
 
@@ -1205,9 +1205,9 @@  discard block
 block discarded – undo
1205 1205
 		$query_values = array(':id' => $id);
1206 1206
 
1207 1207
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1208
-		$query  = $global_query." WHERE ".$additional_query." ";
1208
+		$query = $global_query." WHERE ".$additional_query." ";
1209 1209
 
1210
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1210
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1211 1211
 
1212 1212
 		return $spotter_array;
1213 1213
 	}
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 		{
1246 1246
 			$limit_array = explode(",", $limit);
1247 1247
 			
1248
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1249
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1248
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1249
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1250 1250
 			
1251 1251
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1252 1252
 			{
@@ -1300,8 +1300,8 @@  discard block
 block discarded – undo
1300 1300
 		{
1301 1301
 			$limit_array = explode(",", $limit);
1302 1302
 			
1303
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1304
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1303
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1304
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1305 1305
 			
1306 1306
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1307 1307
 			{
@@ -1350,8 +1350,8 @@  discard block
 block discarded – undo
1350 1350
 		{
1351 1351
 			$limit_array = explode(",", $limit);
1352 1352
 			
1353
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1354
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1353
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1354
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1355 1355
 			
1356 1356
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1357 1357
 			{
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 		$query_values = array();
1393 1393
 		$limit_query = '';
1394 1394
 		$additional_query = '';
1395
-		$filter_query = $this->getFilter($filter,true,true);
1395
+		$filter_query = $this->getFilter($filter, true, true);
1396 1396
 		
1397 1397
 		if ($aircraft_type != "")
1398 1398
 		{
@@ -1409,8 +1409,8 @@  discard block
 block discarded – undo
1409 1409
 		{
1410 1410
 			$limit_array = explode(",", $limit);
1411 1411
 			
1412
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1413
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1412
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1413
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1414 1414
 			
1415 1415
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1416 1416
 			{
@@ -1466,8 +1466,8 @@  discard block
 block discarded – undo
1466 1466
 		{
1467 1467
 			$limit_array = explode(",", $limit);
1468 1468
 			
1469
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1470
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1469
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1470
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1471 1471
 			
1472 1472
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1473 1473
 			{
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 		} else {
1484 1484
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1485 1485
 		}
1486
-		$filter_query = $this->getFilter($filter,true,true);
1486
+		$filter_query = $this->getFilter($filter, true, true);
1487 1487
 
1488 1488
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1489 1489
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 	* @return Array the spotter information
1503 1503
 	*
1504 1504
 	*/
1505
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1505
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1506 1506
 	{
1507 1507
 		global $global_query;
1508 1508
 		
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 		$query_values = array();
1512 1512
 		$limit_query = '';
1513 1513
 		$additional_query = '';
1514
-		$filter_query = $this->getFilter($filters,true,true);
1514
+		$filter_query = $this->getFilter($filters, true, true);
1515 1515
 		
1516 1516
 		if ($airline != "")
1517 1517
 		{
@@ -1528,8 +1528,8 @@  discard block
 block discarded – undo
1528 1528
 		{
1529 1529
 			$limit_array = explode(",", $limit);
1530 1530
 			
1531
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1532
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1531
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1532
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1533 1533
 			
1534 1534
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1535 1535
 			{
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 	* @return Array the spotter information
1560 1560
 	*
1561 1561
 	*/
1562
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1562
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1563 1563
 	{
1564 1564
 		global $global_query;
1565 1565
 		
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 		$query_values = array();
1568 1568
 		$limit_query = '';
1569 1569
 		$additional_query = '';
1570
-		$filter_query = $this->getFilter($filters,true,true);
1570
+		$filter_query = $this->getFilter($filters, true, true);
1571 1571
 		
1572 1572
 		if ($airport != "")
1573 1573
 		{
@@ -1584,8 +1584,8 @@  discard block
 block discarded – undo
1584 1584
 		{
1585 1585
 			$limit_array = explode(",", $limit);
1586 1586
 			
1587
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1588
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1587
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1588
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1589 1589
 			
1590 1590
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1591 1591
 			{
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 	* @return Array the spotter information
1618 1618
 	*
1619 1619
 	*/
1620
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1620
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1621 1621
 	{
1622 1622
 		global $global_query, $globalTimezone, $globalDBdriver;
1623 1623
 		
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 		$limit_query = '';
1626 1626
 		$additional_query = '';
1627 1627
 
1628
-		$filter_query = $this->getFilter($filter,true,true);
1628
+		$filter_query = $this->getFilter($filter, true, true);
1629 1629
 		
1630 1630
 		if ($date != "")
1631 1631
 		{
@@ -1654,8 +1654,8 @@  discard block
 block discarded – undo
1654 1654
 		{
1655 1655
 			$limit_array = explode(",", $limit);
1656 1656
 			
1657
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1658
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1657
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1658
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1659 1659
 			
1660 1660
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1661 1661
 			{
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 	* @return Array the spotter information
1686 1686
 	*
1687 1687
 	*/
1688
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1688
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1689 1689
 	{
1690 1690
 		global $global_query;
1691 1691
 		
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 		$query_values = array();
1695 1695
 		$limit_query = '';
1696 1696
 		$additional_query = '';
1697
-		$filter_query = $this->getFilter($filters,true,true);
1697
+		$filter_query = $this->getFilter($filters, true, true);
1698 1698
 		if ($country != "")
1699 1699
 		{
1700 1700
 			if (!is_string($country))
@@ -1711,8 +1711,8 @@  discard block
 block discarded – undo
1711 1711
 		{
1712 1712
 			$limit_array = explode(",", $limit);
1713 1713
 			
1714
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1715
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1714
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1715
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1716 1716
 			
1717 1717
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1718 1718
 			{
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 		$query_values = array();
1753 1753
 		$additional_query = '';
1754 1754
 		$limit_query = '';
1755
-		$filter_query = $this->getFilter($filters,true,true);
1755
+		$filter_query = $this->getFilter($filters, true, true);
1756 1756
 		
1757 1757
 		if ($aircraft_manufacturer != "")
1758 1758
 		{
@@ -1769,8 +1769,8 @@  discard block
 block discarded – undo
1769 1769
 		{
1770 1770
 			$limit_array = explode(",", $limit);
1771 1771
 			
1772
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1773
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1772
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1773
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1774 1774
 			
1775 1775
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1776 1776
 			{
@@ -1812,14 +1812,14 @@  discard block
 block discarded – undo
1812 1812
 		$query_values = array();
1813 1813
 		$additional_query = '';
1814 1814
 		$limit_query = '';
1815
-		$filter_query = $this->getFilter($filters,true,true);
1815
+		$filter_query = $this->getFilter($filters, true, true);
1816 1816
 		if ($departure_airport_icao != "")
1817 1817
 		{
1818 1818
 			if (!is_string($departure_airport_icao))
1819 1819
 			{
1820 1820
 				return false;
1821 1821
 			} else {
1822
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1822
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1823 1823
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1824 1824
 				//$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao";
1825 1825
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1832,10 +1832,10 @@  discard block
 block discarded – undo
1832 1832
 			{
1833 1833
 				return false;
1834 1834
 			} else {
1835
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1835
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1836 1836
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1837 1837
 				//$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)";
1838
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1838
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1839 1839
 			}
1840 1840
 		}
1841 1841
 		
@@ -1843,8 +1843,8 @@  discard block
 block discarded – undo
1843 1843
 		{
1844 1844
 			$limit_array = explode(",", $limit);
1845 1845
 			
1846
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1847
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1846
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1847
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1848 1848
 			
1849 1849
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1850 1850
 			{
@@ -1883,15 +1883,15 @@  discard block
 block discarded – undo
1883 1883
 		global $global_query;
1884 1884
 		
1885 1885
 		date_default_timezone_set('UTC');
1886
-		$filter_query = $this->getFilter($filter,true,true);
1886
+		$filter_query = $this->getFilter($filter, true, true);
1887 1887
 		$limit_query = '';
1888 1888
 		
1889 1889
 		if ($limit != "")
1890 1890
 		{
1891 1891
 			$limit_array = explode(",", $limit);
1892 1892
 			
1893
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1894
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1893
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1894
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1895 1895
 			
1896 1896
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1897 1897
 			{
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1909 1909
 		}
1910 1910
 
1911
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1911
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1912 1912
 
1913 1913
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1914 1914
 
@@ -1921,19 +1921,19 @@  discard block
 block discarded – undo
1921 1921
 	* @return String the highlight text
1922 1922
 	*
1923 1923
 	*/
1924
-	public function getHighlightByRegistration($registration,$filter = array())
1924
+	public function getHighlightByRegistration($registration, $filter = array())
1925 1925
 	{
1926 1926
 		global $global_query;
1927 1927
 		
1928 1928
 		date_default_timezone_set('UTC');
1929
-		$filter_query = $this->getFilter($filter,true,true);
1930
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1929
+		$filter_query = $this->getFilter($filter, true, true);
1930
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1931 1931
 		
1932
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1932
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1933 1933
 		$sth = $this->db->prepare($query);
1934 1934
 		$sth->execute(array(':registration' => $registration));
1935 1935
 
1936
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1936
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1937 1937
 		{
1938 1938
 			$highlight = $row['highlight'];
1939 1939
 		}
@@ -1949,14 +1949,14 @@  discard block
 block discarded – undo
1949 1949
 	* @return String usage
1950 1950
 	*
1951 1951
 	*/
1952
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1952
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1953 1953
 	{
1954 1954
 		
1955
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1956
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1955
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1956
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1957 1957
 
1958 1958
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1959
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1959
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1960 1960
 		
1961 1961
 		$sth = $this->db->prepare($query);
1962 1962
 		$sth->execute($query_values);
@@ -1978,9 +1978,9 @@  discard block
 block discarded – undo
1978 1978
 	public function getAirportIcao($airport_iata = '')
1979 1979
 	{
1980 1980
 		
1981
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1981
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1982 1982
 
1983
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1983
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1984 1984
 		$query_values = array(':airport' => $airport_iata);
1985 1985
 		
1986 1986
 		$sth = $this->db->prepare($query);
@@ -2002,12 +2002,12 @@  discard block
 block discarded – undo
2002 2002
 	* @return Float distance to the airport
2003 2003
 	*
2004 2004
 	*/
2005
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2005
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2006 2006
 	{
2007 2007
 		
2008
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2008
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2009 2009
 
2010
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2010
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2011 2011
 		$query_values = array(':airport' => $airport_icao);
2012 2012
 		$sth = $this->db->prepare($query);
2013 2013
 		$sth->execute($query_values);
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 			$airport_latitude = $row['latitude'];
2018 2018
 			$airport_longitude = $row['longitude'];
2019 2019
 			$Common = new Common();
2020
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2020
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2021 2021
 		} else return '';
2022 2022
 	}
2023 2023
 	
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 	public function getAllAirportInfo($airport = '')
2032 2032
 	{
2033 2033
 		
2034
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2034
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2035 2035
 
2036 2036
 		$query_values = array();
2037 2037
 		if ($airport == 'NA') {
2038
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
2038
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
2039 2039
 		} elseif ($airport == '') {
2040 2040
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
2041 2041
 		} else {
@@ -2083,14 +2083,14 @@  discard block
 block discarded – undo
2083 2083
 	{
2084 2084
 		$lst_countries = '';
2085 2085
 		foreach ($countries as $country) {
2086
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2086
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2087 2087
 			if ($lst_countries == '') {
2088 2088
 				$lst_countries = "'".$country."'";
2089 2089
 			} else {
2090 2090
 				$lst_countries .= ",'".$country."'";
2091 2091
 			}
2092 2092
 		}
2093
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2093
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2094 2094
 		
2095 2095
 		$sth = $this->db->prepare($query);
2096 2096
 		$sth->execute();
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 		$airport_array = array();
2099 2099
 		$temp_array = array();
2100 2100
 		
2101
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2101
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2102 2102
 		{
2103 2103
 			$temp_array['name'] = $row['name'];
2104 2104
 			$temp_array['city'] = $row['city'];
@@ -2126,10 +2126,10 @@  discard block
 block discarded – undo
2126 2126
 	{
2127 2127
 		global $globalDBdriver;
2128 2128
 		if (is_array($coord)) {
2129
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2130
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2131
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2132
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2129
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2130
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2131
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2132
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2133 2133
 		} else return array();
2134 2134
 		if ($globalDBdriver == 'mysql') {
2135 2135
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
     
2142 2142
 		$airport_array = array();
2143 2143
 		
2144
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2144
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2145 2145
 		{
2146 2146
 			$temp_array = $row;
2147 2147
 
@@ -2161,13 +2161,13 @@  discard block
 block discarded – undo
2161 2161
 	public function getAllWaypointsInfobyCoord($coord)
2162 2162
 	{
2163 2163
 		if (is_array($coord)) {
2164
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2165
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2166
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2167
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2164
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2165
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2166
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2167
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2168 2168
 		} else return array();
2169 2169
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2170
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2170
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2171 2171
 		//$query  = "SELECT waypoints.* FROM waypoints";
2172 2172
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
2173 2173
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -2179,7 +2179,7 @@  discard block
 block discarded – undo
2179 2179
     
2180 2180
 		$waypoints_array = array();
2181 2181
 		
2182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2183 2183
 		{
2184 2184
 			$temp_array = $row;
2185 2185
 
@@ -2201,10 +2201,10 @@  discard block
 block discarded – undo
2201 2201
 	{
2202 2202
 		global $globalUseRealAirlines;
2203 2203
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2204
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2204
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2205 2205
 		if ($airline_icao == 'NA') {
2206 2206
 			$airline_array = array();
2207
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2207
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2208 2208
 			return $airline_array;
2209 2209
 		} else {
2210 2210
 			if (strlen($airline_icao) == 2) {
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
 			if ($fromsource === NULL) {
2226 2226
 				$sth->execute(array(':airline_icao' => $airline_icao));
2227 2227
 			} else {
2228
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2228
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2229 2229
 			}
2230 2230
                         /*
2231 2231
 			$airline_array = array();
@@ -2270,13 +2270,13 @@  discard block
 block discarded – undo
2270 2270
 	{
2271 2271
 		global $globalUseRealAirlines;
2272 2272
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2273
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2274
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2273
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2274
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2275 2275
 		$sth = $this->db->prepare($query);
2276 2276
 		if ($fromsource === NULL) {
2277 2277
 			$sth->execute(array(':airline_name' => $airline_name));
2278 2278
 		} else {
2279
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2279
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2280 2280
 		}
2281 2281
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2282 2282
 		if (empty($result) && $fromsource !== NULL) {
@@ -2301,12 +2301,12 @@  discard block
 block discarded – undo
2301 2301
 	*/
2302 2302
 	public function getAllAircraftInfo($aircraft_type)
2303 2303
 	{
2304
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2304
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2305 2305
 
2306 2306
 		if ($aircraft_type == 'NA') {
2307
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2307
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2308 2308
 		}
2309
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2309
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2310 2310
 		
2311 2311
 		$sth = $this->db->prepare($query);
2312 2312
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 	*/
2339 2339
 	public function getAircraftIcao($aircraft_type)
2340 2340
 	{
2341
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2341
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2342 2342
 		$all_aircraft = array('737-300' => 'B733',
2343 2343
 				'777-200' => 'B772',
2344 2344
 				'777-200ER' => 'B772',
@@ -2350,10 +2350,10 @@  discard block
 block discarded – undo
2350 2350
 				'A380' => 'A388');
2351 2351
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2352 2352
 
2353
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2353
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2354 2354
 		$aircraft_type = strtoupper($aircraft_type);
2355 2355
 		$sth = $this->db->prepare($query);
2356
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2356
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2357 2357
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2358 2358
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2359 2359
 		else return '';
@@ -2368,9 +2368,9 @@  discard block
 block discarded – undo
2368 2368
 	*/
2369 2369
 	public function getAllAircraftType($aircraft_modes)
2370 2370
 	{
2371
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2371
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2372 2372
 
2373
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2373
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2374 2374
 		
2375 2375
 		$sth = $this->db->prepare($query);
2376 2376
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2393,9 +2393,9 @@  discard block
 block discarded – undo
2393 2393
 	*/
2394 2394
 	public function getAllAircraftTypeByRegistration($registration)
2395 2395
 	{
2396
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2396
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2397 2397
 
2398
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2398
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2399 2399
 		
2400 2400
 		$sth = $this->db->prepare($query);
2401 2401
 		$sth->execute(array(':registration' => $registration));
@@ -2416,9 +2416,9 @@  discard block
 block discarded – undo
2416 2416
 	*/
2417 2417
 	public function getAllIDByRegistration($registration)
2418 2418
 	{
2419
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2419
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2420 2420
 
2421
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2421
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2422 2422
 		
2423 2423
 		$sth = $this->db->prepare($query);
2424 2424
 		$sth->execute(array(':registration' => $registration));
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
 		$idarray = array();
2427 2427
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2428 2428
 			$date = $row['date'];
2429
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2429
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2430 2430
 		}
2431 2431
 		return $idarray;
2432 2432
 	}
@@ -2440,8 +2440,8 @@  discard block
 block discarded – undo
2440 2440
 	*/
2441 2441
 	public function getOperator($operator)
2442 2442
 	{
2443
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2444
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2443
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2444
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2445 2445
 		
2446 2446
 		$sth = $this->db->prepare($query);
2447 2447
 		$sth->execute(array(':operator' => $operator));
@@ -2462,9 +2462,9 @@  discard block
 block discarded – undo
2462 2462
 	*/
2463 2463
 	public function getRouteInfo($callsign)
2464 2464
 	{
2465
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2465
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2466 2466
                 if ($callsign == '') return array();
2467
-		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2467
+		$query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2468 2468
 		
2469 2469
 		$sth = $this->db->prepare($query);
2470 2470
 		$sth->execute(array(':callsign' => $callsign));
@@ -2485,9 +2485,9 @@  discard block
 block discarded – undo
2485 2485
 	*/
2486 2486
 	public function getAircraftInfoByRegistration($registration)
2487 2487
 	{
2488
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2488
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2489 2489
 
2490
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2490
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2491 2491
 		
2492 2492
 		$sth = $this->db->prepare($query);
2493 2493
 		$sth->execute(array(':registration' => $registration));
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
 		$aircraft_array = array();
2496 2496
 		$temp_array = array();
2497 2497
 		
2498
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2498
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2499 2499
 		{
2500 2500
 			$temp_array['airline_icao'] = $row['airline_icao'];
2501 2501
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 	*/
2518 2518
 	public function getAircraftOwnerByRegistration($registration)
2519 2519
 	{
2520
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2520
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2521 2521
 		$Connection = new Connection($this->db);
2522 2522
 		if ($Connection->tableExists('aircraft_owner')) {
2523 2523
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
 	public function getAllFlightsforSitemap()
2540 2540
 	{
2541 2541
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2542
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2542
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2543 2543
 		
2544 2544
 		$sth = $this->db->prepare($query);
2545 2545
 		$sth->execute();
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
 		$manufacturer_array = array();
2587 2587
 		$temp_array = array();
2588 2588
 		
2589
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2589
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2590 2590
 		{
2591 2591
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2592 2592
 
@@ -2623,7 +2623,7 @@  discard block
 block discarded – undo
2623 2623
 		$aircraft_array = array();
2624 2624
 		$temp_array = array();
2625 2625
 		
2626
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2626
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2627 2627
 		{
2628 2628
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2629 2629
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2644,8 +2644,8 @@  discard block
 block discarded – undo
2644 2644
 	*/
2645 2645
 	public function getAllAircraftRegistrations($filters = array())
2646 2646
 	{
2647
-		$filter_query = $this->getFilter($filters,true,true);
2648
-		$query  = "SELECT DISTINCT spotter_output.registration 
2647
+		$filter_query = $this->getFilter($filters, true, true);
2648
+		$query = "SELECT DISTINCT spotter_output.registration 
2649 2649
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2650 2650
 				ORDER BY spotter_output.registration ASC";
2651 2651
 
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
 		$aircraft_array = array();
2656 2656
 		$temp_array = array();
2657 2657
 		
2658
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2658
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2659 2659
 		{
2660 2660
 			$temp_array['registration'] = $row['registration'];
2661 2661
 
@@ -2672,11 +2672,11 @@  discard block
 block discarded – undo
2672 2672
 	* @return Array list of source name
2673 2673
 	*
2674 2674
 	*/
2675
-	public function getAllSourceName($type = '',$filters = array())
2675
+	public function getAllSourceName($type = '', $filters = array())
2676 2676
 	{
2677
-		$filter_query = $this->getFilter($filters,true,true);
2677
+		$filter_query = $this->getFilter($filters, true, true);
2678 2678
 		$query_values = array();
2679
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2679
+		$query = "SELECT DISTINCT spotter_output.source_name 
2680 2680
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2681 2681
 		if ($type != '') {
2682 2682
 			$query_values = array(':type' => $type);
@@ -2691,7 +2691,7 @@  discard block
 block discarded – undo
2691 2691
 		$source_array = array();
2692 2692
 		$temp_array = array();
2693 2693
 		
2694
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2694
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2695 2695
 		{
2696 2696
 			$temp_array['source_name'] = $row['source_name'];
2697 2697
 			$source_array[] = $temp_array;
@@ -2707,11 +2707,11 @@  discard block
 block discarded – undo
2707 2707
 	* @return Array list of airline names
2708 2708
 	*
2709 2709
 	*/
2710
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2710
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2711 2711
 	{
2712
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2713
-		$filter_query = $this->getFilter($filters,true,true);
2714
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2712
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2713
+		$filter_query = $this->getFilter($filters, true, true);
2714
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2715 2715
 		if ($airline_type == '' || $airline_type == 'all') {
2716 2716
 			/*
2717 2717
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2730,7 +2730,7 @@  discard block
 block discarded – undo
2730 2730
 				$query_data = array(':forsource' => $forsource);
2731 2731
 			}
2732 2732
 		} else {
2733
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2733
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2734 2734
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2735 2735
 					AND spotter_output.airline_type = :airline_type 
2736 2736
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
 		$airline_array = array();
2744 2744
 		$temp_array = array();
2745 2745
 		
2746
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2746
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2747 2747
 		{
2748 2748
 			$temp_array['airline_icao'] = $row['airline_icao'];
2749 2749
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2760,10 +2760,10 @@  discard block
 block discarded – undo
2760 2760
 	* @return Array list of alliance names
2761 2761
 	*
2762 2762
 	*/
2763
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2763
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2764 2764
 	{
2765
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766
-		$filter_query = $this->getFilter($filters,true,true);
2765
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2766
+		$filter_query = $this->getFilter($filters, true, true);
2767 2767
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2768 2768
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2769 2769
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2791,8 +2791,8 @@  discard block
 block discarded – undo
2791 2791
 	*/
2792 2792
 	public function getAllAirlineCountries($filters = array())
2793 2793
 	{
2794
-		$filter_query = $this->getFilter($filters,true,true);
2795
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2794
+		$filter_query = $this->getFilter($filters, true, true);
2795
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2796 2796
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2797 2797
 				ORDER BY spotter_output.airline_country ASC";
2798 2798
 		
@@ -2803,7 +2803,7 @@  discard block
 block discarded – undo
2803 2803
 		$airline_array = array();
2804 2804
 		$temp_array = array();
2805 2805
 		
2806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2807 2807
 		{
2808 2808
 			$temp_array['airline_country'] = $row['airline_country'];
2809 2809
 
@@ -2823,9 +2823,9 @@  discard block
 block discarded – undo
2823 2823
 	*/
2824 2824
 	public function getAllAirportNames($filters = array())
2825 2825
 	{
2826
-		$filter_query = $this->getFilter($filters,true,true);
2826
+		$filter_query = $this->getFilter($filters, true, true);
2827 2827
 		$airport_array = array();
2828
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2828
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2829 2829
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2830 2830
 				ORDER BY spotter_output.departure_airport_city ASC";
2831 2831
 		
@@ -2834,7 +2834,7 @@  discard block
 block discarded – undo
2834 2834
 		$sth->execute();
2835 2835
 
2836 2836
 		$temp_array = array();
2837
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2837
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2838 2838
 		{
2839 2839
 			$temp_array['airport_icao'] = $row['airport_icao'];
2840 2840
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2844,14 +2844,14 @@  discard block
 block discarded – undo
2844 2844
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2845 2845
 		}
2846 2846
 
2847
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2847
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2848 2848
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2849 2849
 								ORDER BY spotter_output.arrival_airport_city ASC";
2850 2850
 					
2851 2851
 		$sth = $this->db->prepare($query);
2852 2852
 		$sth->execute();
2853 2853
 
2854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2855 2855
 			{
2856 2856
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2857 2857
 		//	{
@@ -2891,21 +2891,21 @@  discard block
 block discarded – undo
2891 2891
    
2892 2892
 		$temp_array = array();
2893 2893
 		
2894
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2894
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2895 2895
 		{
2896 2896
 			$temp_array['airport_country'] = $row['airport_country'];
2897 2897
 
2898 2898
 			$airport_array[$row['airport_country']] = $temp_array;
2899 2899
 		}
2900
-		$filter_query = $this->getFilter($filters,true,true);
2901
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2900
+		$filter_query = $this->getFilter($filters, true, true);
2901
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2902 2902
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2903 2903
 								ORDER BY spotter_output.arrival_airport_country ASC";
2904 2904
 					
2905 2905
 		$sth = $this->db->prepare($query);
2906 2906
 		$sth->execute();
2907 2907
 		
2908
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2908
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2909 2909
 		{
2910 2910
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2911 2911
 			{
@@ -2928,9 +2928,9 @@  discard block
 block discarded – undo
2928 2928
 	*/
2929 2929
 	public function getAllCountries($filters = array())
2930 2930
 	{
2931
-		$Connection= new Connection($this->db);
2931
+		$Connection = new Connection($this->db);
2932 2932
 		if ($Connection->tableExists('countries')) {
2933
-			$query  = "SELECT countries.name AS airport_country
2933
+			$query = "SELECT countries.name AS airport_country
2934 2934
 				FROM countries
2935 2935
 				ORDER BY countries.name ASC";
2936 2936
 			$sth = $this->db->prepare($query);
@@ -2939,14 +2939,14 @@  discard block
 block discarded – undo
2939 2939
 			$temp_array = array();
2940 2940
 			$country_array = array();
2941 2941
 		
2942
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2942
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2943 2943
 			{
2944 2944
 				$temp_array['country'] = $row['airport_country'];
2945 2945
 				$country_array[$row['airport_country']] = $temp_array;
2946 2946
 			}
2947 2947
 		} else {
2948
-			$filter_query = $this->getFilter($filters,true,true);
2949
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2948
+			$filter_query = $this->getFilter($filters, true, true);
2949
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2950 2950
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2951 2951
 								ORDER BY spotter_output.departure_airport_country ASC";
2952 2952
 
@@ -2955,20 +2955,20 @@  discard block
 block discarded – undo
2955 2955
    
2956 2956
 			$temp_array = array();
2957 2957
 			$country_array = array();
2958
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2958
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2959 2959
 			{
2960 2960
 				$temp_array['country'] = $row['airport_country'];
2961 2961
 				$country_array[$row['airport_country']] = $temp_array;
2962 2962
 			}
2963 2963
 
2964
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2964
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2965 2965
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2966 2966
 								ORDER BY spotter_output.arrival_airport_country ASC";
2967 2967
 					
2968 2968
 		$sth = $this->db->prepare($query);
2969 2969
 		$sth->execute();
2970 2970
 		
2971
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2971
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2972 2972
 		{
2973 2973
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2974 2974
 			{
@@ -2978,14 +2978,14 @@  discard block
 block discarded – undo
2978 2978
 			}
2979 2979
 		}
2980 2980
 		
2981
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2981
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2982 2982
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2983 2983
 								ORDER BY spotter_output.airline_country ASC";
2984 2984
 					
2985 2985
 		$sth = $this->db->prepare($query);
2986 2986
 		$sth->execute();
2987 2987
 		
2988
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2988
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2989 2989
 		{
2990 2990
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2991 2991
 			{
@@ -3009,8 +3009,8 @@  discard block
 block discarded – undo
3009 3009
 	*/
3010 3010
 	public function getAllIdents($filters = array())
3011 3011
 	{
3012
-		$filter_query = $this->getFilter($filters,true,true);
3013
-		$query  = "SELECT DISTINCT spotter_output.ident
3012
+		$filter_query = $this->getFilter($filters, true, true);
3013
+		$query = "SELECT DISTINCT spotter_output.ident
3014 3014
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3015 3015
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3016 3016
 
@@ -3020,7 +3020,7 @@  discard block
 block discarded – undo
3020 3020
 		$ident_array = array();
3021 3021
 		$temp_array = array();
3022 3022
 		
3023
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3023
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3024 3024
 		{
3025 3025
 			$temp_array['ident'] = $row['ident'];
3026 3026
 			$ident_array[] = $temp_array;
@@ -3034,9 +3034,9 @@  discard block
 block discarded – undo
3034 3034
 	* @return Array number, icao, name and city of airports
3035 3035
 	*/
3036 3036
 
3037
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3037
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3038 3038
 		global $globalTimezone, $globalDBdriver;
3039
-		$filter_query = $this->getFilter($filters,true,true);
3039
+		$filter_query = $this->getFilter($filters, true, true);
3040 3040
 		if ($globalTimezone != '') {
3041 3041
 			date_default_timezone_set($globalTimezone);
3042 3042
 			$datetime = new DateTime();
@@ -3101,7 +3101,7 @@  discard block
 block discarded – undo
3101 3101
 
3102 3102
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3103 3103
 		global $globalTimezone, $globalDBdriver;
3104
-		$filter_query = $this->getFilter($filters,true,true);
3104
+		$filter_query = $this->getFilter($filters, true, true);
3105 3105
 		if ($globalTimezone != '') {
3106 3106
 			date_default_timezone_set($globalTimezone);
3107 3107
 			$datetime = new DateTime();
@@ -3185,7 +3185,7 @@  discard block
 block discarded – undo
3185 3185
 
3186 3186
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3187 3187
 		global $globalTimezone, $globalDBdriver;
3188
-		$filter_query = $this->getFilter($filters,true,true);
3188
+		$filter_query = $this->getFilter($filters, true, true);
3189 3189
 		if ($globalTimezone != '') {
3190 3190
 			date_default_timezone_set($globalTimezone);
3191 3191
 			$datetime = new DateTime();
@@ -3218,9 +3218,9 @@  discard block
 block discarded – undo
3218 3218
 	* @return Array number, icao, name and city of airports
3219 3219
 	*/
3220 3220
 
3221
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3221
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3222 3222
 		global $globalTimezone, $globalDBdriver;
3223
-		$filter_query = $this->getFilter($filters,true,true);
3223
+		$filter_query = $this->getFilter($filters, true, true);
3224 3224
 		if ($globalTimezone != '') {
3225 3225
 			date_default_timezone_set($globalTimezone);
3226 3226
 			$datetime = new DateTime();
@@ -3352,12 +3352,12 @@  discard block
 block discarded – undo
3352 3352
 		} else $offset = '+00:00';
3353 3353
 
3354 3354
 		if ($globalDBdriver == 'mysql') {
3355
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3355
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3356 3356
 								FROM spotter_output
3357 3357
 								WHERE spotter_output.date <> '' 
3358 3358
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3359 3359
 		} else {
3360
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3360
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3361 3361
 								FROM spotter_output
3362 3362
 								WHERE spotter_output.date <> '' 
3363 3363
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3369,7 +3369,7 @@  discard block
 block discarded – undo
3369 3369
 		$date_array = array();
3370 3370
 		$temp_array = array();
3371 3371
 		
3372
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3372
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3373 3373
 		{
3374 3374
 			$temp_array['date'] = $row['date'];
3375 3375
 
@@ -3389,7 +3389,7 @@  discard block
 block discarded – undo
3389 3389
 	*/
3390 3390
 	public function getAllRoutes()
3391 3391
 	{
3392
-		$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 
3392
+		$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 
3393 3393
 				FROM spotter_output
3394 3394
 				WHERE spotter_output.ident <> '' 
3395 3395
 				GROUP BY route
@@ -3400,7 +3400,7 @@  discard block
 block discarded – undo
3400 3400
 
3401 3401
 		$routes_array = array();
3402 3402
 		$temp_array = array();
3403
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3403
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3404 3404
 		{
3405 3405
 			$temp_array['route'] = $row['route'];
3406 3406
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3419,21 +3419,21 @@  discard block
 block discarded – undo
3419 3419
 	* @return String success or false
3420 3420
 	*
3421 3421
 	*/	
3422
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3422
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3423 3423
 	{
3424 3424
 		if (!is_numeric(substr($ident, 0, 3)))
3425 3425
 		{
3426 3426
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3427
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3427
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3428 3428
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3429
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3429
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3430 3430
 			} else {
3431 3431
 				$airline_array = $this->getAllAirlineInfo("NA");
3432 3432
 			}
3433 3433
 			if (count($airline_array) == 0) {
3434 3434
 				$airline_array = $this->getAllAirlineInfo("NA");
3435 3435
 			}
3436
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3436
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3437 3437
 				$airline_array = $this->getAllAirlineInfo("NA");
3438 3438
 			}
3439 3439
 		} else {
@@ -3446,7 +3446,7 @@  discard block
 block discarded – undo
3446 3446
 
3447 3447
 
3448 3448
 		$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';
3449
-                $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);
3449
+                $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);
3450 3450
 
3451 3451
 		try {
3452 3452
 			$sth = $this->db->prepare($query);
@@ -3467,11 +3467,11 @@  discard block
 block discarded – undo
3467 3467
 	* @return String success or false
3468 3468
 	*
3469 3469
 	*/	
3470
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3470
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3471 3471
 	{
3472 3472
 		if ($groundspeed == '') $groundspeed = NULL;
3473 3473
 		$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';
3474
-                $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);
3474
+                $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);
3475 3475
 
3476 3476
 		try {
3477 3477
 			$sth = $this->db->prepare($query);
@@ -3511,7 +3511,7 @@  discard block
 block discarded – undo
3511 3511
 	* @param String $verticalrate vertival rate of flight
3512 3512
 	* @return String success or false
3513 3513
 	*/
3514
-	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 = '')
3514
+	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 = '')
3515 3515
 	{
3516 3516
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3517 3517
 		
@@ -3535,13 +3535,13 @@  discard block
 block discarded – undo
3535 3535
 				if ($ModeS != '') {
3536 3536
 					$timeelapsed = microtime(true);
3537 3537
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3538
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3538
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3539 3539
 				} else {
3540
-					$myhex = explode('-',$flightaware_id);
3540
+					$myhex = explode('-', $flightaware_id);
3541 3541
 					if (count($myhex) > 0) {
3542 3542
 						$timeelapsed = microtime(true);
3543 3543
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3544
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3544
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3545 3545
 					}
3546 3546
 				}
3547 3547
 			}
@@ -3563,24 +3563,24 @@  discard block
 block discarded – undo
3563 3563
 				{
3564 3564
 					$timeelapsed = microtime(true);
3565 3565
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3566
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3566
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3567 3567
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3568
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3568
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3569 3569
 					} else {
3570 3570
 						$airline_array = $this->getAllAirlineInfo("NA");
3571 3571
 					}
3572 3572
 					if (count($airline_array) == 0) {
3573 3573
 						$airline_array = $this->getAllAirlineInfo("NA");
3574 3574
 					}
3575
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3575
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3576 3576
 						$airline_array = $this->getAllAirlineInfo("NA");
3577 3577
 					}
3578
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3578
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3579 3579
 
3580 3580
 				} else {
3581 3581
 					$timeelapsed = microtime(true);
3582 3582
 					$airline_array = $this->getAllAirlineInfo("NA");
3583
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3583
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3584 3584
 				}
3585 3585
 			}
3586 3586
 		} else $airline_array = array();
@@ -3597,27 +3597,27 @@  discard block
 block discarded – undo
3597 3597
 				{
3598 3598
 					$timeelapsed = microtime(true);
3599 3599
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3600
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3600
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3601 3601
 				} else {
3602 3602
 					$timeelapsed = microtime(true);
3603 3603
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3604
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3604
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3605 3605
 				}
3606 3606
 			}
3607 3607
 		} else {
3608 3608
 			if ($ModeS != '') {
3609 3609
 				$timeelapsed = microtime(true);
3610 3610
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3611
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3611
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3612 3612
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3613 3613
 				{
3614 3614
 					$timeelapsed = microtime(true);
3615 3615
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3616
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3616
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3617 3617
 				} else {
3618 3618
 					$timeelapsed = microtime(true);
3619 3619
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3620
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3620
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3621 3621
 				}
3622 3622
 			}
3623 3623
 		}
@@ -3633,7 +3633,7 @@  discard block
 block discarded – undo
3633 3633
 			} else {
3634 3634
 				$timeelapsed = microtime(true);
3635 3635
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3636
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3636
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3637 3637
 			}
3638 3638
 		}
3639 3639
 		
@@ -3648,7 +3648,7 @@  discard block
 block discarded – undo
3648 3648
 			} else {
3649 3649
 				$timeelapsed = microtime(true);
3650 3650
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3651
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3651
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3652 3652
 			}
3653 3653
 		}
3654 3654
 
@@ -3711,7 +3711,7 @@  discard block
 block discarded – undo
3711 3711
 		{
3712 3712
 			$timeelapsed = microtime(true);
3713 3713
 			$image_array = $Image->getSpotterImage($registration);
3714
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3714
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3715 3715
 			if (!isset($image_array[0]['registration']))
3716 3716
 			{
3717 3717
 				//echo "Add image !!!! \n";
@@ -3719,7 +3719,7 @@  discard block
 block discarded – undo
3719 3719
 			}
3720 3720
 			$timeelapsed = microtime(true);
3721 3721
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3722
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3722
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3723 3723
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3724 3724
 		}
3725 3725
     
@@ -3727,33 +3727,33 @@  discard block
 block discarded – undo
3727 3727
 		{
3728 3728
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3729 3729
             		else $airline_icao = '';
3730
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3730
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3731 3731
 			if (!isset($image_array[0]['registration']))
3732 3732
 			{
3733 3733
 				//echo "Add image !!!! \n";
3734
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3734
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3735 3735
 			}
3736 3736
 		}
3737 3737
     
3738
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3739
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3740
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3741
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3742
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3743
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3744
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3745
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3746
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3747
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3748
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3749
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3750
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3751
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3752
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3753
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3754
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3755
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3756
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3738
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3739
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3740
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3741
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3742
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3743
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3744
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3745
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3746
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3747
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3748
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3749
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3750
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3751
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3752
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3753
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3754
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3755
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3756
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3757 3757
 	
3758 3758
 		if (count($airline_array) == 0) 
3759 3759
 		{
@@ -3781,7 +3781,7 @@  discard block
 block discarded – undo
3781 3781
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3782 3782
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3783 3783
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3784
-                $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) 
3784
+                $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) 
3785 3785
                 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)";
3786 3786
 
3787 3787
                 $airline_name = $airline_array[0]['name'];
@@ -3791,7 +3791,7 @@  discard block
 block discarded – undo
3791 3791
 		if ($airline_type == '') {
3792 3792
 			$timeelapsed = microtime(true);
3793 3793
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3794
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3794
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3795 3795
 		}
3796 3796
 		if ($airline_type == null) $airline_type = '';
3797 3797
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3804 3804
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3805 3805
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3806
-                $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);
3806
+                $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);
3807 3807
 
3808 3808
 		try {
3809 3809
 		        
@@ -3829,13 +3829,13 @@  discard block
 block discarded – undo
3829 3829
 	{
3830 3830
 		global $globalDBdriver, $globalTimezone;
3831 3831
 		if ($globalDBdriver == 'mysql') {
3832
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3832
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3833 3833
 								WHERE spotter_output.ident = :ident 
3834 3834
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3835 3835
 								AND spotter_output.date < UTC_TIMESTAMP()";
3836 3836
 			$query_data = array(':ident' => $ident);
3837 3837
 		} else {
3838
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3838
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3839 3839
 								WHERE spotter_output.ident = :ident 
3840 3840
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3841 3841
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3844,8 +3844,8 @@  discard block
 block discarded – undo
3844 3844
 		
3845 3845
 		$sth = $this->db->prepare($query);
3846 3846
 		$sth->execute($query_data);
3847
-    		$ident_result='';
3848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3847
+    		$ident_result = '';
3848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3849 3849
 		{
3850 3850
 			$ident_result = $row['ident'];
3851 3851
 		}
@@ -3871,8 +3871,8 @@  discard block
 block discarded – undo
3871 3871
 				return false;
3872 3872
 			} else {
3873 3873
 				$q_array = explode(" ", $q);
3874
-				foreach ($q_array as $q_item){
3875
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3874
+				foreach ($q_array as $q_item) {
3875
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3876 3876
 					$additional_query .= " AND (";
3877 3877
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3878 3878
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3887,11 +3887,11 @@  discard block
 block discarded – undo
3887 3887
 			}
3888 3888
 		}
3889 3889
 		if ($globalDBdriver == 'mysql') {
3890
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3890
+			$query = "SELECT spotter_output.* FROM spotter_output 
3891 3891
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3892 3892
 				AND spotter_output.date < UTC_TIMESTAMP()";
3893 3893
 		} else {
3894
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3894
+			$query = "SELECT spotter_output.* FROM spotter_output 
3895 3895
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3896 3896
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3897 3897
 		}
@@ -3908,11 +3908,11 @@  discard block
 block discarded – undo
3908 3908
 	* @return Array the airline list
3909 3909
 	*
3910 3910
 	*/
3911
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3911
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3912 3912
 	{
3913 3913
 		global $globalDBdriver;
3914
-		$filter_query = $this->getFilter($filters,true,true);
3915
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3914
+		$filter_query = $this->getFilter($filters, true, true);
3915
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3916 3916
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
3917 3917
 		if ($olderthanmonths > 0) {
3918 3918
 			if ($globalDBdriver == 'mysql') {
@@ -3932,28 +3932,28 @@  discard block
 block discarded – undo
3932 3932
 		if ($year != '') {
3933 3933
 			if ($globalDBdriver == 'mysql') {
3934 3934
 				$query .= " AND YEAR(spotter_output.date) = :year";
3935
-				$query_values = array_merge($query_values,array(':year' => $year));
3935
+				$query_values = array_merge($query_values, array(':year' => $year));
3936 3936
 			} else {
3937 3937
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
3938
-				$query_values = array_merge($query_values,array(':year' => $year));
3938
+				$query_values = array_merge($query_values, array(':year' => $year));
3939 3939
 			}
3940 3940
 		}
3941 3941
 		if ($month != '') {
3942 3942
 			if ($globalDBdriver == 'mysql') {
3943 3943
 				$query .= " AND MONTH(spotter_output.date) = :month";
3944
-				$query_values = array_merge($query_values,array(':month' => $month));
3944
+				$query_values = array_merge($query_values, array(':month' => $month));
3945 3945
 			} else {
3946 3946
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
3947
-				$query_values = array_merge($query_values,array(':month' => $month));
3947
+				$query_values = array_merge($query_values, array(':month' => $month));
3948 3948
 			}
3949 3949
 		}
3950 3950
 		if ($day != '') {
3951 3951
 			if ($globalDBdriver == 'mysql') {
3952 3952
 				$query .= " AND DAY(spotter_output.date) = :day";
3953
-				$query_values = array_merge($query_values,array(':day' => $day));
3953
+				$query_values = array_merge($query_values, array(':day' => $day));
3954 3954
 			} else {
3955 3955
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
3956
-				$query_values = array_merge($query_values,array(':day' => $day));
3956
+				$query_values = array_merge($query_values, array(':day' => $day));
3957 3957
 			}
3958 3958
 		}
3959 3959
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -3963,7 +3963,7 @@  discard block
 block discarded – undo
3963 3963
 		$sth->execute($query_values);
3964 3964
 		$airline_array = array();
3965 3965
 		$temp_array = array();
3966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3967 3967
 		{
3968 3968
 			$temp_array['airline_name'] = $row['airline_name'];
3969 3969
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3980,11 +3980,11 @@  discard block
 block discarded – undo
3980 3980
 	* @return Array the pilots list
3981 3981
 	*
3982 3982
 	*/
3983
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
3983
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3984 3984
 	{
3985 3985
 		global $globalDBdriver;
3986
-		$filter_query = $this->getFilter($filters,true,true);
3987
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3986
+		$filter_query = $this->getFilter($filters, true, true);
3987
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3988 3988
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3989 3989
                 if ($olderthanmonths > 0) {
3990 3990
             		if ($globalDBdriver == 'mysql') {
@@ -4004,28 +4004,28 @@  discard block
 block discarded – undo
4004 4004
 		if ($year != '') {
4005 4005
 			if ($globalDBdriver == 'mysql') {
4006 4006
 				$query .= " AND YEAR(spotter_output.date) = :year";
4007
-				$query_values = array_merge($query_values,array(':year' => $year));
4007
+				$query_values = array_merge($query_values, array(':year' => $year));
4008 4008
 			} else {
4009 4009
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4010
-				$query_values = array_merge($query_values,array(':year' => $year));
4010
+				$query_values = array_merge($query_values, array(':year' => $year));
4011 4011
 			}
4012 4012
 		}
4013 4013
 		if ($month != '') {
4014 4014
 			if ($globalDBdriver == 'mysql') {
4015 4015
 				$query .= " AND MONTH(spotter_output.date) = :month";
4016
-				$query_values = array_merge($query_values,array(':month' => $month));
4016
+				$query_values = array_merge($query_values, array(':month' => $month));
4017 4017
 			} else {
4018 4018
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4019
-				$query_values = array_merge($query_values,array(':month' => $month));
4019
+				$query_values = array_merge($query_values, array(':month' => $month));
4020 4020
 			}
4021 4021
 		}
4022 4022
 		if ($day != '') {
4023 4023
 			if ($globalDBdriver == 'mysql') {
4024 4024
 				$query .= " AND DAY(spotter_output.date) = :day";
4025
-				$query_values = array_merge($query_values,array(':day' => $day));
4025
+				$query_values = array_merge($query_values, array(':day' => $day));
4026 4026
 			} else {
4027 4027
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4028
-				$query_values = array_merge($query_values,array(':day' => $day));
4028
+				$query_values = array_merge($query_values, array(':day' => $day));
4029 4029
 			}
4030 4030
 		}
4031 4031
 		
@@ -4037,7 +4037,7 @@  discard block
 block discarded – undo
4037 4037
 		$sth->execute($query_values);
4038 4038
 		$airline_array = array();
4039 4039
 		$temp_array = array();
4040
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4040
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4041 4041
 		{
4042 4042
 			$temp_array['pilot_name'] = $row['pilot_name'];
4043 4043
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4057,7 +4057,7 @@  discard block
 block discarded – undo
4057 4057
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4058 4058
 	{
4059 4059
 		global $globalDBdriver;
4060
-		$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
4060
+		$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
4061 4061
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4062 4062
                 if ($olderthanmonths > 0) {
4063 4063
             		if ($globalDBdriver == 'mysql') {
@@ -4083,7 +4083,7 @@  discard block
 block discarded – undo
4083 4083
 		$airline_array = array();
4084 4084
 		$temp_array = array();
4085 4085
         
4086
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4086
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4087 4087
 		{
4088 4088
 			$temp_array['pilot_name'] = $row['pilot_name'];
4089 4089
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4101,11 +4101,11 @@  discard block
 block discarded – undo
4101 4101
 	* @return Array the pilots list
4102 4102
 	*
4103 4103
 	*/
4104
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4104
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4105 4105
 	{
4106 4106
 		global $globalDBdriver;
4107
-		$filter_query = $this->getFilter($filters,true,true);
4108
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4107
+		$filter_query = $this->getFilter($filters, true, true);
4108
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4109 4109
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4110 4110
                 if ($olderthanmonths > 0) {
4111 4111
             		if ($globalDBdriver == 'mysql') {
@@ -4125,28 +4125,28 @@  discard block
 block discarded – undo
4125 4125
 		if ($year != '') {
4126 4126
 			if ($globalDBdriver == 'mysql') {
4127 4127
 				$query .= " AND YEAR(spotter_output.date) = :year";
4128
-				$query_values = array_merge($query_values,array(':year' => $year));
4128
+				$query_values = array_merge($query_values, array(':year' => $year));
4129 4129
 			} else {
4130 4130
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4131
-				$query_values = array_merge($query_values,array(':year' => $year));
4131
+				$query_values = array_merge($query_values, array(':year' => $year));
4132 4132
 			}
4133 4133
 		}
4134 4134
 		if ($month != '') {
4135 4135
 			if ($globalDBdriver == 'mysql') {
4136 4136
 				$query .= " AND MONTH(spotter_output.date) = :month";
4137
-				$query_values = array_merge($query_values,array(':month' => $month));
4137
+				$query_values = array_merge($query_values, array(':month' => $month));
4138 4138
 			} else {
4139 4139
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4140
-				$query_values = array_merge($query_values,array(':month' => $month));
4140
+				$query_values = array_merge($query_values, array(':month' => $month));
4141 4141
 			}
4142 4142
 		}
4143 4143
 		if ($day != '') {
4144 4144
 			if ($globalDBdriver == 'mysql') {
4145 4145
 				$query .= " AND DAY(spotter_output.date) = :day";
4146
-				$query_values = array_merge($query_values,array(':day' => $day));
4146
+				$query_values = array_merge($query_values, array(':day' => $day));
4147 4147
 			} else {
4148 4148
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4149
-				$query_values = array_merge($query_values,array(':day' => $day));
4149
+				$query_values = array_merge($query_values, array(':day' => $day));
4150 4150
 			}
4151 4151
 		}
4152 4152
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4156,7 +4156,7 @@  discard block
 block discarded – undo
4156 4156
 		$sth->execute($query_values);
4157 4157
 		$airline_array = array();
4158 4158
 		$temp_array = array();
4159
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4159
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4160 4160
 		{
4161 4161
 			$temp_array['owner_name'] = $row['owner_name'];
4162 4162
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4171,11 +4171,11 @@  discard block
 block discarded – undo
4171 4171
 	* @return Array the pilots list
4172 4172
 	*
4173 4173
 	*/
4174
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4174
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4175 4175
 	{
4176 4176
 		global $globalDBdriver;
4177
-		$filter_query = $this->getFilter($filters,true,true);
4178
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4177
+		$filter_query = $this->getFilter($filters, true, true);
4178
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4179 4179
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4180 4180
                 if ($olderthanmonths > 0) {
4181 4181
             		if ($globalDBdriver == 'mysql') {
@@ -4201,7 +4201,7 @@  discard block
 block discarded – undo
4201 4201
 		$airline_array = array();
4202 4202
 		$temp_array = array();
4203 4203
         
4204
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4204
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4205 4205
 		{
4206 4206
 			$temp_array['owner_name'] = $row['owner_name'];
4207 4207
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4217,11 +4217,11 @@  discard block
 block discarded – undo
4217 4217
 	* @return Array the airline list
4218 4218
 	*
4219 4219
 	*/
4220
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4220
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4221 4221
 	{
4222
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4223
-		$filter_query = $this->getFilter($filters,true,true);
4224
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4222
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4223
+		$filter_query = $this->getFilter($filters, true, true);
4224
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4225 4225
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4226 4226
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4227 4227
 			    ORDER BY airline_count DESC";
@@ -4233,7 +4233,7 @@  discard block
 block discarded – undo
4233 4233
 		$airline_array = array();
4234 4234
 		$temp_array = array();
4235 4235
         
4236
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4236
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4237 4237
 		{
4238 4238
 			$temp_array['airline_name'] = $row['airline_name'];
4239 4239
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4253,11 +4253,11 @@  discard block
 block discarded – undo
4253 4253
 	* @return Array the airline country list
4254 4254
 	*
4255 4255
 	*/
4256
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4256
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4257 4257
 	{
4258
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4259
-		$filter_query = $this->getFilter($filters,true,true);
4260
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4258
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4259
+		$filter_query = $this->getFilter($filters, true, true);
4260
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4261 4261
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4262 4262
                     GROUP BY spotter_output.airline_country
4263 4263
 					ORDER BY airline_country_count DESC
@@ -4270,7 +4270,7 @@  discard block
 block discarded – undo
4270 4270
 		$airline_country_array = array();
4271 4271
 		$temp_array = array();
4272 4272
         
4273
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4273
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4274 4274
 		{
4275 4275
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4276 4276
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4289,11 +4289,11 @@  discard block
 block discarded – undo
4289 4289
 	* @return Array the airline list
4290 4290
 	*
4291 4291
 	*/
4292
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4292
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4293 4293
 	{
4294
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4295
-		$filter_query = $this->getFilter($filters,true,true);
4296
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4294
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4295
+		$filter_query = $this->getFilter($filters, true, true);
4296
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4297 4297
 		    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 ) 
4298 4298
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4299 4299
 		    ORDER BY airline_count DESC";
@@ -4305,7 +4305,7 @@  discard block
 block discarded – undo
4305 4305
 		$airline_array = array();
4306 4306
 		$temp_array = array();
4307 4307
         
4308
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4308
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4309 4309
 		{
4310 4310
 			$temp_array['airline_name'] = $row['airline_name'];
4311 4311
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4324,11 +4324,11 @@  discard block
 block discarded – undo
4324 4324
 	* @return Array the airline country list
4325 4325
 	*
4326 4326
 	*/
4327
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4327
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4328 4328
 	{
4329
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4330
-		$filter_query = $this->getFilter($filters,true,true);
4331
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4329
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4330
+		$filter_query = $this->getFilter($filters, true, true);
4331
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4332 4332
 		 			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 )
4333 4333
 					GROUP BY spotter_output.airline_country
4334 4334
 					ORDER BY airline_country_count DESC
@@ -4341,7 +4341,7 @@  discard block
 block discarded – undo
4341 4341
 		$airline_country_array = array();
4342 4342
 		$temp_array = array();
4343 4343
         
4344
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4344
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4345 4345
 		{
4346 4346
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4347 4347
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4358,11 +4358,11 @@  discard block
 block discarded – undo
4358 4358
 	* @return Array the airline list
4359 4359
 	*
4360 4360
 	*/
4361
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4361
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4362 4362
 	{
4363
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4364
-		$filter_query = $this->getFilter($filters,true,true);
4365
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4363
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4364
+		$filter_query = $this->getFilter($filters, true, true);
4365
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4366 4366
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4367 4367
 					GROUP BY spotter_output.airline_name
4368 4368
 					ORDER BY airline_count DESC";
@@ -4373,7 +4373,7 @@  discard block
 block discarded – undo
4373 4373
 		$airline_array = array();
4374 4374
 		$temp_array = array();
4375 4375
         
4376
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4376
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4377 4377
 		{
4378 4378
 			$temp_array['airline_name'] = $row['airline_name'];
4379 4379
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4393,11 +4393,11 @@  discard block
 block discarded – undo
4393 4393
 	* @return Array the airline country list
4394 4394
 	*
4395 4395
 	*/
4396
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4396
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4397 4397
 	{
4398
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4399
-		$filter_query = $this->getFilter($filters,true,true);
4400
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4398
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4399
+		$filter_query = $this->getFilter($filters, true, true);
4400
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4401 4401
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4402 4402
 					GROUP BY spotter_output.airline_country
4403 4403
 					ORDER BY airline_country_count DESC
@@ -4410,7 +4410,7 @@  discard block
 block discarded – undo
4410 4410
 		$airline_country_array = array();
4411 4411
 		$temp_array = array();
4412 4412
         
4413
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4413
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4414 4414
 		{
4415 4415
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4416 4416
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4426,11 +4426,11 @@  discard block
 block discarded – undo
4426 4426
 	* @return Array the airline list
4427 4427
 	*
4428 4428
 	*/
4429
-	public function countAllAirlinesByDate($date,$filters = array())
4429
+	public function countAllAirlinesByDate($date, $filters = array())
4430 4430
 	{
4431 4431
 		global $globalTimezone, $globalDBdriver;
4432
-		$filter_query = $this->getFilter($filters,true,true);
4433
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4432
+		$filter_query = $this->getFilter($filters, true, true);
4433
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4434 4434
 		if ($globalTimezone != '') {
4435 4435
 			date_default_timezone_set($globalTimezone);
4436 4436
 			$datetime = new DateTime($date);
@@ -4438,12 +4438,12 @@  discard block
 block discarded – undo
4438 4438
 		} else $offset = '+00:00';
4439 4439
 
4440 4440
 		if ($globalDBdriver == 'mysql') {
4441
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4441
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4442 4442
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4443 4443
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4444 4444
 					ORDER BY airline_count DESC";
4445 4445
 		} else {
4446
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4446
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4447 4447
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4448 4448
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4449 4449
 					ORDER BY airline_count DESC";
@@ -4454,7 +4454,7 @@  discard block
 block discarded – undo
4454 4454
 
4455 4455
 		$airline_array = array();
4456 4456
 		$temp_array = array();
4457
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4457
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4458 4458
 		{
4459 4459
 			$temp_array['airline_name'] = $row['airline_name'];
4460 4460
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4474,11 +4474,11 @@  discard block
 block discarded – undo
4474 4474
 	* @return Array the airline country list
4475 4475
 	*
4476 4476
 	*/
4477
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4477
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4478 4478
 	{
4479 4479
 		global $globalTimezone, $globalDBdriver;
4480
-		$filter_query = $this->getFilter($filters,true,true);
4481
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4480
+		$filter_query = $this->getFilter($filters, true, true);
4481
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4482 4482
 		if ($globalTimezone != '') {
4483 4483
 			date_default_timezone_set($globalTimezone);
4484 4484
 			$datetime = new DateTime($date);
@@ -4486,13 +4486,13 @@  discard block
 block discarded – undo
4486 4486
 		} else $offset = '+00:00';
4487 4487
 		
4488 4488
 		if ($globalDBdriver == 'mysql') {
4489
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
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 DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4491 4491
 					GROUP BY spotter_output.airline_country
4492 4492
 					ORDER BY airline_country_count DESC
4493 4493
 					LIMIT 10 OFFSET 0";
4494 4494
 		} else {
4495
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4495
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4496 4496
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4497 4497
 					GROUP BY spotter_output.airline_country
4498 4498
 					ORDER BY airline_country_count DESC
@@ -4504,7 +4504,7 @@  discard block
 block discarded – undo
4504 4504
  
4505 4505
 		$airline_country_array = array();
4506 4506
 		$temp_array = array();
4507
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4507
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4508 4508
 		{
4509 4509
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4510 4510
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4521,11 +4521,11 @@  discard block
 block discarded – undo
4521 4521
 	* @return Array the airline list
4522 4522
 	*
4523 4523
 	*/
4524
-	public function countAllAirlinesByIdent($ident,$filters = array())
4524
+	public function countAllAirlinesByIdent($ident, $filters = array())
4525 4525
 	{
4526
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4527
-		$filter_query = $this->getFilter($filters,true,true);
4528
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4526
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4527
+		$filter_query = $this->getFilter($filters, true, true);
4528
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4529 4529
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4530 4530
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4531 4531
 				ORDER BY airline_count DESC";
@@ -4542,11 +4542,11 @@  discard block
 block discarded – undo
4542 4542
 	* @return Array the airline list
4543 4543
 	*
4544 4544
 	*/
4545
-	public function countAllAirlinesByOwner($owner,$filters = array())
4545
+	public function countAllAirlinesByOwner($owner, $filters = array())
4546 4546
 	{
4547
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4548
-		$filter_query = $this->getFilter($filters,true,true);
4549
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4547
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4548
+		$filter_query = $this->getFilter($filters, true, true);
4549
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4550 4550
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4551 4551
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4552 4552
 				ORDER BY airline_count DESC";
@@ -4563,11 +4563,11 @@  discard block
 block discarded – undo
4563 4563
 	* @return Array the airline list
4564 4564
 	*
4565 4565
 	*/
4566
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4566
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4567 4567
 	{
4568
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4569
-		$filter_query = $this->getFilter($filters,true,true);
4570
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4568
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4569
+		$filter_query = $this->getFilter($filters, true, true);
4570
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4571 4571
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4572 4572
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4573 4573
 				ORDER BY airline_count DESC";
@@ -4584,25 +4584,25 @@  discard block
 block discarded – undo
4584 4584
 	* @return Array the airline list
4585 4585
 	*
4586 4586
 	*/
4587
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4587
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4588 4588
 	{
4589
-		$filter_query = $this->getFilter($filters,true,true);
4590
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4591
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4589
+		$filter_query = $this->getFilter($filters, true, true);
4590
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4591
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4592 4592
 
4593
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4593
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4594 4594
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4595 4595
 					GROUP BY spotter_output.airline_name
4596 4596
 					ORDER BY airline_count DESC";
4597 4597
       
4598 4598
 		
4599 4599
 		$sth = $this->db->prepare($query);
4600
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4600
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4601 4601
       
4602 4602
 		$airline_array = array();
4603 4603
 		$temp_array = array();
4604 4604
         
4605
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4605
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4606 4606
 		{
4607 4607
 			$temp_array['airline_name'] = $row['airline_name'];
4608 4608
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4620,13 +4620,13 @@  discard block
 block discarded – undo
4620 4620
 	* @return Array the airline country list
4621 4621
 	*
4622 4622
 	*/
4623
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4623
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4624 4624
 	{
4625
-		$filter_query = $this->getFilter($filters,true,true);
4626
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4627
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4625
+		$filter_query = $this->getFilter($filters, true, true);
4626
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4627
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4628 4628
       
4629
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4629
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4630 4630
 		 		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) 
4631 4631
 				GROUP BY spotter_output.airline_country
4632 4632
 				ORDER BY airline_country_count DESC
@@ -4634,11 +4634,11 @@  discard block
 block discarded – undo
4634 4634
       
4635 4635
 		
4636 4636
 		$sth = $this->db->prepare($query);
4637
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4637
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4638 4638
       
4639 4639
 		$airline_country_array = array();
4640 4640
 		$temp_array = array();
4641
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4641
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4642 4642
 		{
4643 4643
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4644 4644
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4656,11 +4656,11 @@  discard block
 block discarded – undo
4656 4656
 	* @return Array the airline list
4657 4657
 	*
4658 4658
 	*/
4659
-	public function countAllAirlinesByCountry($country,$filters = array())
4659
+	public function countAllAirlinesByCountry($country, $filters = array())
4660 4660
 	{
4661
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4662
-		$filter_query = $this->getFilter($filters,true,true);
4663
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4661
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4662
+		$filter_query = $this->getFilter($filters, true, true);
4663
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4664 4664
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4665 4665
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4666 4666
 			    ORDER BY airline_count DESC";
@@ -4671,7 +4671,7 @@  discard block
 block discarded – undo
4671 4671
 
4672 4672
 		$airline_array = array();
4673 4673
 		$temp_array = array();
4674
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4674
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4675 4675
 		{
4676 4676
 			$temp_array['airline_name'] = $row['airline_name'];
4677 4677
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4690,11 +4690,11 @@  discard block
 block discarded – undo
4690 4690
 	* @return Array the airline country list
4691 4691
 	*
4692 4692
 	*/
4693
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4693
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4694 4694
 	{
4695
-		$filter_query = $this->getFilter($filters,true,true);
4696
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4697
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4695
+		$filter_query = $this->getFilter($filters, true, true);
4696
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4697
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4698 4698
 		 		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 
4699 4699
 				GROUP BY spotter_output.airline_country
4700 4700
 				ORDER BY airline_country_count DESC
@@ -4706,7 +4706,7 @@  discard block
 block discarded – undo
4706 4706
 
4707 4707
 		$airline_country_array = array();
4708 4708
 		$temp_array = array();
4709
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4709
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4710 4710
 		{
4711 4711
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4712 4712
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4726,35 +4726,35 @@  discard block
 block discarded – undo
4726 4726
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4727 4727
 	{
4728 4728
 		global $globalDBdriver;
4729
-		$filter_query = $this->getFilter($filters,true,true);
4730
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4729
+		$filter_query = $this->getFilter($filters, true, true);
4730
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4731 4731
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4732 4732
 		$query_values = array();
4733 4733
 		if ($year != '') {
4734 4734
 			if ($globalDBdriver == 'mysql') {
4735 4735
 				$query .= " AND YEAR(spotter_output.date) = :year";
4736
-				$query_values = array_merge($query_values,array(':year' => $year));
4736
+				$query_values = array_merge($query_values, array(':year' => $year));
4737 4737
 			} else {
4738 4738
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4739
-				$query_values = array_merge($query_values,array(':year' => $year));
4739
+				$query_values = array_merge($query_values, array(':year' => $year));
4740 4740
 			}
4741 4741
 		}
4742 4742
 		if ($month != '') {
4743 4743
 			if ($globalDBdriver == 'mysql') {
4744 4744
 				$query .= " AND MONTH(spotter_output.date) = :month";
4745
-				$query_values = array_merge($query_values,array(':month' => $month));
4745
+				$query_values = array_merge($query_values, array(':month' => $month));
4746 4746
 			} else {
4747 4747
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4748
-				$query_values = array_merge($query_values,array(':month' => $month));
4748
+				$query_values = array_merge($query_values, array(':month' => $month));
4749 4749
 			}
4750 4750
 		}
4751 4751
 		if ($day != '') {
4752 4752
 			if ($globalDBdriver == 'mysql') {
4753 4753
 				$query .= " AND DAY(spotter_output.date) = :day";
4754
-				$query_values = array_merge($query_values,array(':day' => $day));
4754
+				$query_values = array_merge($query_values, array(':day' => $day));
4755 4755
 			} else {
4756 4756
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4757
-				$query_values = array_merge($query_values,array(':day' => $day));
4757
+				$query_values = array_merge($query_values, array(':day' => $day));
4758 4758
 			}
4759 4759
 		}
4760 4760
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4766,7 +4766,7 @@  discard block
 block discarded – undo
4766 4766
 
4767 4767
 		$airline_array = array();
4768 4768
 		$temp_array = array();
4769
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4769
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4770 4770
 		{
4771 4771
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4772 4772
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4782,11 +4782,11 @@  discard block
 block discarded – undo
4782 4782
 	* @return Array the airline country list
4783 4783
 	*
4784 4784
 	*/
4785
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4785
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4786 4786
 	{
4787 4787
 		global $globalDBdriver;
4788 4788
 		//$filter_query = $this->getFilter($filters,true,true);
4789
-		$Connection= new Connection($this->db);
4789
+		$Connection = new Connection($this->db);
4790 4790
 		if (!$Connection->tableExists('countries')) return array();
4791 4791
 		/*
4792 4792
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4801,7 +4801,7 @@  discard block
 block discarded – undo
4801 4801
 */
4802 4802
 		require_once('class.SpotterLive.php');
4803 4803
 		$SpotterLive = new SpotterLive();
4804
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4804
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4805 4805
 		$filter_query .= ' over_country IS NOT NULL';
4806 4806
                 if ($olderthanmonths > 0) {
4807 4807
 			if ($globalDBdriver == 'mysql') {
@@ -4828,7 +4828,7 @@  discard block
 block discarded – undo
4828 4828
 		$flight_array = array();
4829 4829
 		$temp_array = array();
4830 4830
         
4831
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4831
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4832 4832
 		{
4833 4833
 			$temp_array['flight_count'] = $row['nb'];
4834 4834
 			$temp_array['flight_country'] = $row['name'];
@@ -4846,11 +4846,11 @@  discard block
 block discarded – undo
4846 4846
 	* @return Array the aircraft list
4847 4847
 	*
4848 4848
 	*/
4849
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4849
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4850 4850
 	{
4851 4851
 		global $globalDBdriver;
4852
-		$filter_query = $this->getFilter($filters,true,true);
4853
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4852
+		$filter_query = $this->getFilter($filters, true, true);
4853
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4854 4854
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4855 4855
 		if ($olderthanmonths > 0) {
4856 4856
 			if ($globalDBdriver == 'mysql') {
@@ -4870,28 +4870,28 @@  discard block
 block discarded – undo
4870 4870
 		if ($year != '') {
4871 4871
 			if ($globalDBdriver == 'mysql') {
4872 4872
 				$query .= " AND YEAR(spotter_output.date) = :year";
4873
-				$query_values = array_merge($query_values,array(':year' => $year));
4873
+				$query_values = array_merge($query_values, array(':year' => $year));
4874 4874
 			} else {
4875 4875
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4876
-				$query_values = array_merge($query_values,array(':year' => $year));
4876
+				$query_values = array_merge($query_values, array(':year' => $year));
4877 4877
 			}
4878 4878
 		}
4879 4879
 		if ($month != '') {
4880 4880
 			if ($globalDBdriver == 'mysql') {
4881 4881
 				$query .= " AND MONTH(spotter_output.date) = :month";
4882
-				$query_values = array_merge($query_values,array(':month' => $month));
4882
+				$query_values = array_merge($query_values, array(':month' => $month));
4883 4883
 			} else {
4884 4884
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4885
-				$query_values = array_merge($query_values,array(':month' => $month));
4885
+				$query_values = array_merge($query_values, array(':month' => $month));
4886 4886
 			}
4887 4887
 		}
4888 4888
 		if ($day != '') {
4889 4889
 			if ($globalDBdriver == 'mysql') {
4890 4890
 				$query .= " AND DAY(spotter_output.date) = :day";
4891
-				$query_values = array_merge($query_values,array(':day' => $day));
4891
+				$query_values = array_merge($query_values, array(':day' => $day));
4892 4892
 			} else {
4893 4893
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4894
-				$query_values = array_merge($query_values,array(':day' => $day));
4894
+				$query_values = array_merge($query_values, array(':day' => $day));
4895 4895
 			}
4896 4896
 		}
4897 4897
 
@@ -4903,7 +4903,7 @@  discard block
 block discarded – undo
4903 4903
 
4904 4904
 		$aircraft_array = array();
4905 4905
 		$temp_array = array();
4906
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4906
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4907 4907
 		{
4908 4908
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4909 4909
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4920,11 +4920,11 @@  discard block
 block discarded – undo
4920 4920
 	* @return Array the aircraft list
4921 4921
 	*
4922 4922
 	*/
4923
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
4923
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4924 4924
 	{
4925 4925
 		global $globalDBdriver;
4926
-		$filter_query = $this->getFilter($filters,true,true);
4927
-		$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 
4926
+		$filter_query = $this->getFilter($filters, true, true);
4927
+		$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 
4928 4928
 		    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' ";
4929 4929
 		if ($olderthanmonths > 0) {
4930 4930
 			if ($globalDBdriver == 'mysql') {
@@ -4944,28 +4944,28 @@  discard block
 block discarded – undo
4944 4944
 		if ($year != '') {
4945 4945
 			if ($globalDBdriver == 'mysql') {
4946 4946
 				$query .= " AND YEAR(spotter_output.date) = :year";
4947
-				$query_values = array_merge($query_values,array(':year' => $year));
4947
+				$query_values = array_merge($query_values, array(':year' => $year));
4948 4948
 			} else {
4949 4949
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4950
-				$query_values = array_merge($query_values,array(':year' => $year));
4950
+				$query_values = array_merge($query_values, array(':year' => $year));
4951 4951
 			}
4952 4952
 		}
4953 4953
 		if ($month != '') {
4954 4954
 			if ($globalDBdriver == 'mysql') {
4955 4955
 				$query .= " AND MONTH(spotter_output.date) = :month";
4956
-				$query_values = array_merge($query_values,array(':month' => $month));
4956
+				$query_values = array_merge($query_values, array(':month' => $month));
4957 4957
 			} else {
4958 4958
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4959
-				$query_values = array_merge($query_values,array(':month' => $month));
4959
+				$query_values = array_merge($query_values, array(':month' => $month));
4960 4960
 			}
4961 4961
 		}
4962 4962
 		if ($day != '') {
4963 4963
 			if ($globalDBdriver == 'mysql') {
4964 4964
 				$query .= " AND DAY(spotter_output.date) = :day";
4965
-				$query_values = array_merge($query_values,array(':day' => $day));
4965
+				$query_values = array_merge($query_values, array(':day' => $day));
4966 4966
 			} else {
4967 4967
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4968
-				$query_values = array_merge($query_values,array(':day' => $day));
4968
+				$query_values = array_merge($query_values, array(':day' => $day));
4969 4969
 			}
4970 4970
 		}
4971 4971
 
@@ -4977,7 +4977,7 @@  discard block
 block discarded – undo
4977 4977
 
4978 4978
 		$aircraft_array = array();
4979 4979
 		$temp_array = array();
4980
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4980
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4981 4981
 		{
4982 4982
 			$temp_array['airline_icao'] = $row['airline_icao'];
4983 4983
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4995,11 +4995,11 @@  discard block
 block discarded – undo
4995 4995
 	* @return Array the aircraft list
4996 4996
 	*
4997 4997
 	*/
4998
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4998
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4999 4999
 	{
5000 5000
 		global $globalDBdriver;
5001
-		$filter_query = $this->getFilter($filters,true,true);
5002
-		$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 
5001
+		$filter_query = $this->getFilter($filters, true, true);
5002
+		$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 
5003 5003
 		    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' ";
5004 5004
 		if ($olderthanmonths > 0) {
5005 5005
 			if ($globalDBdriver == 'mysql') {
@@ -5024,7 +5024,7 @@  discard block
 block discarded – undo
5024 5024
 
5025 5025
 		$aircraft_array = array();
5026 5026
 		$temp_array = array();
5027
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5027
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5028 5028
 		{
5029 5029
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5030 5030
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5043,13 +5043,13 @@  discard block
 block discarded – undo
5043 5043
 	* @return Array the aircraft list
5044 5044
 	*
5045 5045
 	*/
5046
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5046
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5047 5047
 	{
5048 5048
 		$Image = new Image($this->db);
5049
-		$filter_query = $this->getFilter($filters,true,true);
5050
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5049
+		$filter_query = $this->getFilter($filters, true, true);
5050
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5051 5051
 
5052
-		$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  
5052
+		$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  
5053 5053
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5054 5054
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5055 5055
 				ORDER BY registration_count DESC";
@@ -5060,14 +5060,14 @@  discard block
 block discarded – undo
5060 5060
 		$aircraft_array = array();
5061 5061
 		$temp_array = array();
5062 5062
         
5063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5064 5064
 		{
5065 5065
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5066 5066
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5067 5067
 			$temp_array['registration'] = $row['registration'];
5068 5068
 			$temp_array['airline_name'] = $row['airline_name'];
5069 5069
 			$temp_array['image_thumbnail'] = "";
5070
-			if($row['registration'] != "")
5070
+			if ($row['registration'] != "")
5071 5071
 			{
5072 5072
 				$image_array = $Image->getSpotterImage($row['registration']);
5073 5073
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5086,11 +5086,11 @@  discard block
 block discarded – undo
5086 5086
 	* @return Array the aircraft list
5087 5087
 	*
5088 5088
 	*/
5089
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5089
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5090 5090
 	{
5091
-		$filter_query = $this->getFilter($filters,true,true);
5092
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5093
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5091
+		$filter_query = $this->getFilter($filters, true, true);
5092
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5093
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5094 5094
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5095 5095
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5096 5096
 			    ORDER BY aircraft_icao_count DESC";
@@ -5101,7 +5101,7 @@  discard block
 block discarded – undo
5101 5101
 		$aircraft_array = array();
5102 5102
 		$temp_array = array();
5103 5103
 
5104
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5104
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5105 5105
 		{
5106 5106
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5107 5107
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5119,13 +5119,13 @@  discard block
 block discarded – undo
5119 5119
 	* @return Array the aircraft list
5120 5120
 	*
5121 5121
 	*/
5122
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5122
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5123 5123
 	{
5124
-		$filter_query = $this->getFilter($filters,true,true);
5124
+		$filter_query = $this->getFilter($filters, true, true);
5125 5125
 		$Image = new Image($this->db);
5126
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5126
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5127 5127
 
5128
-		$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 
5128
+		$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 5129
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5130 5130
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5131 5131
 			    ORDER BY registration_count DESC";
@@ -5135,14 +5135,14 @@  discard block
 block discarded – undo
5135 5135
 
5136 5136
 		$aircraft_array = array();
5137 5137
 		$temp_array = array();
5138
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5138
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5139 5139
 		{
5140 5140
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5141 5141
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5142 5142
 			$temp_array['registration'] = $row['registration'];
5143 5143
 			$temp_array['airline_name'] = $row['airline_name'];
5144 5144
 			$temp_array['image_thumbnail'] = "";
5145
-			if($row['registration'] != "")
5145
+			if ($row['registration'] != "")
5146 5146
 			{
5147 5147
 				$image_array = $Image->getSpotterImage($row['registration']);
5148 5148
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5161,11 +5161,11 @@  discard block
 block discarded – undo
5161 5161
 	* @return Array the aircraft list
5162 5162
 	*
5163 5163
 	*/
5164
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5164
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5165 5165
 	{
5166
-		$filter_query = $this->getFilter($filters,true,true);
5167
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5168
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5166
+		$filter_query = $this->getFilter($filters, true, true);
5167
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5168
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5169 5169
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5170 5170
 				GROUP BY spotter_output.aircraft_manufacturer 
5171 5171
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5176,7 +5176,7 @@  discard block
 block discarded – undo
5176 5176
 		$aircraft_array = array();
5177 5177
 		$temp_array = array();
5178 5178
 
5179
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5179
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5180 5180
 		{
5181 5181
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5182 5182
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5193,12 +5193,12 @@  discard block
 block discarded – undo
5193 5193
 	* @return Array the aircraft list
5194 5194
 	*
5195 5195
 	*/
5196
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5196
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5197 5197
 	{
5198
-		$filter_query = $this->getFilter($filters,true,true);
5199
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5198
+		$filter_query = $this->getFilter($filters, true, true);
5199
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5200 5200
 
5201
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5201
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5202 5202
 				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) 
5203 5203
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5204 5204
 				ORDER BY aircraft_icao_count DESC";
@@ -5208,7 +5208,7 @@  discard block
 block discarded – undo
5208 5208
 
5209 5209
 		$aircraft_array = array();
5210 5210
 		$temp_array = array();
5211
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5211
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5212 5212
 		{
5213 5213
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5214 5214
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5226,13 +5226,13 @@  discard block
 block discarded – undo
5226 5226
 	* @return Array the aircraft list
5227 5227
 	*
5228 5228
 	*/
5229
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5229
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5230 5230
 	{
5231
-		$filter_query = $this->getFilter($filters,true,true);
5231
+		$filter_query = $this->getFilter($filters, true, true);
5232 5232
 		$Image = new Image($this->db);
5233
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5233
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5234 5234
 
5235
-		$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  
5235
+		$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  
5236 5236
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5237 5237
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5238 5238
 		    ORDER BY registration_count DESC";
@@ -5242,14 +5242,14 @@  discard block
 block discarded – undo
5242 5242
 
5243 5243
 		$aircraft_array = array();
5244 5244
 		$temp_array = array();
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'];
@@ -5267,11 +5267,11 @@  discard block
 block discarded – undo
5267 5267
 	* @return Array the aircraft list
5268 5268
 	*
5269 5269
 	*/
5270
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5270
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5271 5271
 	{
5272
-		$filter_query = $this->getFilter($filters,true,true);
5273
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5274
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5272
+		$filter_query = $this->getFilter($filters, true, true);
5273
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5274
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5275 5275
                     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)  
5276 5276
                     GROUP BY spotter_output.aircraft_manufacturer 
5277 5277
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5282,7 +5282,7 @@  discard block
 block discarded – undo
5282 5282
 
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'];
@@ -5297,12 +5297,12 @@  discard block
 block discarded – undo
5297 5297
 	* @return Array the aircraft list
5298 5298
 	*
5299 5299
 	*/
5300
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5300
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5301 5301
 	{
5302
-		$filter_query = $this->getFilter($filters,true,true);
5303
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5302
+		$filter_query = $this->getFilter($filters, true, true);
5303
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5304 5304
 
5305
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5305
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5306 5306
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5307 5307
                     GROUP BY spotter_output.aircraft_name 
5308 5308
 					ORDER BY aircraft_icao_count DESC";
@@ -5311,7 +5311,7 @@  discard block
 block discarded – undo
5311 5311
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5312 5312
 		$aircraft_array = array();
5313 5313
 		$temp_array = array();
5314
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5314
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5315 5315
 		{
5316 5316
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5317 5317
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5330,11 +5330,11 @@  discard block
 block discarded – undo
5330 5330
 	*/
5331 5331
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5332 5332
 	{
5333
-		$filter_query = $this->getFilter($filters,true,true);
5333
+		$filter_query = $this->getFilter($filters, true, true);
5334 5334
 		$Image = new Image($this->db);
5335
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5335
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5336 5336
 
5337
-		$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   
5337
+		$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   
5338 5338
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5339 5339
                     GROUP BY spotter_output.registration 
5340 5340
 					ORDER BY registration_count DESC";
@@ -5344,14 +5344,14 @@  discard block
 block discarded – undo
5344 5344
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5345 5345
 		$aircraft_array = array();
5346 5346
 		$temp_array = array();
5347
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5347
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5348 5348
 		{
5349 5349
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5350 5350
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5351 5351
 			$temp_array['registration'] = $row['registration'];
5352 5352
 			$temp_array['airline_name'] = $row['airline_name'];
5353 5353
 			$temp_array['image_thumbnail'] = "";
5354
-			if($row['registration'] != "")
5354
+			if ($row['registration'] != "")
5355 5355
 			{
5356 5356
 				$image_array = $Image->getSpotterImage($row['registration']);
5357 5357
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5368,11 +5368,11 @@  discard block
 block discarded – undo
5368 5368
 	* @return Array the aircraft list
5369 5369
 	*
5370 5370
 	*/
5371
-	public function countAllAircraftTypesByDate($date,$filters = array())
5371
+	public function countAllAircraftTypesByDate($date, $filters = array())
5372 5372
 	{
5373 5373
 		global $globalTimezone, $globalDBdriver;
5374
-		$filter_query = $this->getFilter($filters,true,true);
5375
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5374
+		$filter_query = $this->getFilter($filters, true, true);
5375
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5376 5376
 		if ($globalTimezone != '') {
5377 5377
 			date_default_timezone_set($globalTimezone);
5378 5378
 			$datetime = new DateTime($date);
@@ -5380,12 +5380,12 @@  discard block
 block discarded – undo
5380 5380
 		} else $offset = '+00:00';
5381 5381
 
5382 5382
 		if ($globalDBdriver == 'mysql') {
5383
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5383
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5384 5384
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5385 5385
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5386 5386
 					ORDER BY aircraft_icao_count DESC";
5387 5387
 		} else {
5388
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5388
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5389 5389
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5390 5390
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5391 5391
 					ORDER BY aircraft_icao_count DESC";
@@ -5396,7 +5396,7 @@  discard block
 block discarded – undo
5396 5396
 
5397 5397
 		$aircraft_array = array();
5398 5398
 		$temp_array = array();
5399
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5399
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5400 5400
 		{
5401 5401
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5402 5402
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5414,12 +5414,12 @@  discard block
 block discarded – undo
5414 5414
 	* @return Array the aircraft list
5415 5415
 	*
5416 5416
 	*/
5417
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5417
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5418 5418
 	{
5419 5419
 		global $globalTimezone, $globalDBdriver;
5420
-		$filter_query = $this->getFilter($filters,true,true);
5420
+		$filter_query = $this->getFilter($filters, true, true);
5421 5421
 		$Image = new Image($this->db);
5422
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5422
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5423 5423
 		if ($globalTimezone != '') {
5424 5424
 			date_default_timezone_set($globalTimezone);
5425 5425
 			$datetime = new DateTime($date);
@@ -5427,12 +5427,12 @@  discard block
 block discarded – undo
5427 5427
 		} else $offset = '+00:00';
5428 5428
 
5429 5429
 		if ($globalDBdriver == 'mysql') {
5430
-			$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 
5430
+			$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 
5431 5431
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5432 5432
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5433 5433
 					ORDER BY registration_count DESC";
5434 5434
 		} else {
5435
-			$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    
5435
+			$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    
5436 5436
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5437 5437
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5438 5438
 					ORDER BY registration_count DESC";
@@ -5443,14 +5443,14 @@  discard block
 block discarded – undo
5443 5443
 
5444 5444
 		$aircraft_array = array();
5445 5445
 		$temp_array = array();
5446
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5446
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5447 5447
 		{
5448 5448
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5449 5449
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5450 5450
 			$temp_array['registration'] = $row['registration'];
5451 5451
 			$temp_array['airline_name'] = $row['airline_name'];
5452 5452
 			$temp_array['image_thumbnail'] = "";
5453
-			if($row['registration'] != "")
5453
+			if ($row['registration'] != "")
5454 5454
 			{
5455 5455
 				$image_array = $Image->getSpotterImage($row['registration']);
5456 5456
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5469,11 +5469,11 @@  discard block
 block discarded – undo
5469 5469
 	* @return Array the aircraft manufacturer list
5470 5470
 	*
5471 5471
 	*/
5472
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5472
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5473 5473
 	{
5474 5474
 		global $globalTimezone, $globalDBdriver;
5475
-		$filter_query = $this->getFilter($filters,true,true);
5476
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5475
+		$filter_query = $this->getFilter($filters, true, true);
5476
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5477 5477
 		if ($globalTimezone != '') {
5478 5478
 			date_default_timezone_set($globalTimezone);
5479 5479
 			$datetime = new DateTime($date);
@@ -5481,12 +5481,12 @@  discard block
 block discarded – undo
5481 5481
 		} else $offset = '+00:00';
5482 5482
 
5483 5483
 		if ($globalDBdriver == 'mysql') {
5484
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5484
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5485 5485
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5486 5486
 				GROUP BY spotter_output.aircraft_manufacturer 
5487 5487
 				ORDER BY aircraft_manufacturer_count DESC";
5488 5488
 		} else {
5489
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5489
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5490 5490
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5491 5491
 				GROUP BY spotter_output.aircraft_manufacturer 
5492 5492
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5498,7 +5498,7 @@  discard block
 block discarded – undo
5498 5498
 		$aircraft_array = array();
5499 5499
 		$temp_array = array();
5500 5500
 
5501
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5501
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5502 5502
 		{
5503 5503
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5504 5504
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5515,11 +5515,11 @@  discard block
 block discarded – undo
5515 5515
 	* @return Array the aircraft list
5516 5516
 	*
5517 5517
 	*/
5518
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5518
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5519 5519
 	{
5520
-		$filter_query = $this->getFilter($filters,true,true);
5521
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5522
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5520
+		$filter_query = $this->getFilter($filters, true, true);
5521
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5522
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5523 5523
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5524 5524
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5525 5525
 				ORDER BY aircraft_icao_count DESC";
@@ -5530,7 +5530,7 @@  discard block
 block discarded – undo
5530 5530
 		$aircraft_array = array();
5531 5531
 		$temp_array = array();
5532 5532
 
5533
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5533
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5534 5534
 		{
5535 5535
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5536 5536
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5547,11 +5547,11 @@  discard block
 block discarded – undo
5547 5547
 	* @return Array the aircraft list
5548 5548
 	*
5549 5549
 	*/
5550
-	public function countAllAircraftTypesByPilot($pilot,$filters = array())
5550
+	public function countAllAircraftTypesByPilot($pilot, $filters = array())
5551 5551
 	{
5552
-		$filter_query = $this->getFilter($filters,true,true);
5553
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5554
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5552
+		$filter_query = $this->getFilter($filters, true, true);
5553
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5554
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5555 5555
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot) 
5556 5556
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5557 5557
 				ORDER BY aircraft_icao_count DESC";
@@ -5567,11 +5567,11 @@  discard block
 block discarded – undo
5567 5567
 	* @return Array the aircraft list
5568 5568
 	*
5569 5569
 	*/
5570
-	public function countAllAircraftTypesByOwner($owner,$filters = array())
5570
+	public function countAllAircraftTypesByOwner($owner, $filters = array())
5571 5571
 	{
5572
-		$filter_query = $this->getFilter($filters,true,true);
5573
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5574
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5572
+		$filter_query = $this->getFilter($filters, true, true);
5573
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5574
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5575 5575
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
5576 5576
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5577 5577
 				ORDER BY aircraft_icao_count DESC";
@@ -5588,13 +5588,13 @@  discard block
 block discarded – undo
5588 5588
 	* @return Array the aircraft list
5589 5589
 	*
5590 5590
 	*/
5591
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5591
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5592 5592
 	{
5593
-		$filter_query = $this->getFilter($filters,true,true);
5593
+		$filter_query = $this->getFilter($filters, true, true);
5594 5594
 		$Image = new Image($this->db);
5595
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5595
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5596 5596
 
5597
-		$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  
5597
+		$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  
5598 5598
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5599 5599
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5600 5600
 		    ORDER BY registration_count DESC";
@@ -5606,14 +5606,14 @@  discard block
 block discarded – undo
5606 5606
 		$aircraft_array = array();
5607 5607
 		$temp_array = array();
5608 5608
         
5609
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5609
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5610 5610
 		{
5611 5611
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5612 5612
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5613 5613
 			$temp_array['registration'] = $row['registration'];
5614 5614
 			$temp_array['airline_name'] = $row['airline_name'];
5615 5615
 			$temp_array['image_thumbnail'] = "";
5616
-			if($row['registration'] != "")
5616
+			if ($row['registration'] != "")
5617 5617
 			{
5618 5618
 				$image_array = $Image->getSpotterImage($row['registration']);
5619 5619
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5631,13 +5631,13 @@  discard block
 block discarded – undo
5631 5631
 	* @return Array the aircraft list
5632 5632
 	*
5633 5633
 	*/
5634
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
5634
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array())
5635 5635
 	{
5636
-		$filter_query = $this->getFilter($filters,true,true);
5636
+		$filter_query = $this->getFilter($filters, true, true);
5637 5637
 		$Image = new Image($this->db);
5638
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5638
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5639 5639
 
5640
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5640
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5641 5641
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner 
5642 5642
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5643 5643
 		    ORDER BY registration_count DESC LIMIT 100";
@@ -5649,7 +5649,7 @@  discard block
 block discarded – undo
5649 5649
 		$aircraft_array = array();
5650 5650
 		$temp_array = array();
5651 5651
         
5652
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5652
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5653 5653
 		{
5654 5654
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5655 5655
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5657,7 +5657,7 @@  discard block
 block discarded – undo
5657 5657
 			$temp_array['registration'] = $row['registration'];
5658 5658
 			$temp_array['airline_name'] = $row['airline_name'];
5659 5659
 			$temp_array['image_thumbnail'] = "";
5660
-			if($row['registration'] != "")
5660
+			if ($row['registration'] != "")
5661 5661
 			{
5662 5662
 				$image_array = $Image->getSpotterImage($row['registration']);
5663 5663
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5675,13 +5675,13 @@  discard block
 block discarded – undo
5675 5675
 	* @return Array the aircraft list
5676 5676
 	*
5677 5677
 	*/
5678
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array())
5678
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array())
5679 5679
 	{
5680
-		$filter_query = $this->getFilter($filters,true,true);
5680
+		$filter_query = $this->getFilter($filters, true, true);
5681 5681
 		$Image = new Image($this->db);
5682
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5682
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5683 5683
 
5684
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5684
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5685 5685
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
5686 5686
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5687 5687
 		    ORDER BY registration_count DESC LIMIT 100";
@@ -5693,7 +5693,7 @@  discard block
 block discarded – undo
5693 5693
 		$aircraft_array = array();
5694 5694
 		$temp_array = array();
5695 5695
         
5696
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5696
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5697 5697
 		{
5698 5698
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5699 5699
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5701,7 +5701,7 @@  discard block
 block discarded – undo
5701 5701
 			$temp_array['registration'] = $row['registration'];
5702 5702
 			$temp_array['airline_name'] = $row['airline_name'];
5703 5703
 			$temp_array['image_thumbnail'] = "";
5704
-			if($row['registration'] != "")
5704
+			if ($row['registration'] != "")
5705 5705
 			{
5706 5706
 				$image_array = $Image->getSpotterImage($row['registration']);
5707 5707
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5720,11 +5720,11 @@  discard block
 block discarded – undo
5720 5720
 	* @return Array the aircraft manufacturer list
5721 5721
 	*
5722 5722
 	*/
5723
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5723
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5724 5724
 	{
5725
-		$filter_query = $this->getFilter($filters,true,true);
5726
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5727
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5725
+		$filter_query = $this->getFilter($filters, true, true);
5726
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5727
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5728 5728
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5729 5729
                     GROUP BY spotter_output.aircraft_manufacturer 
5730 5730
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5734,7 +5734,7 @@  discard block
 block discarded – undo
5734 5734
 		$sth->execute(array(':ident' => $ident));
5735 5735
 		$aircraft_array = array();
5736 5736
 		$temp_array = array();
5737
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5737
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5738 5738
 		{
5739 5739
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5740 5740
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5749,11 +5749,11 @@  discard block
 block discarded – undo
5749 5749
 	* @return Array the aircraft manufacturer list
5750 5750
 	*
5751 5751
 	*/
5752
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
5752
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array())
5753 5753
 	{
5754
-		$filter_query = $this->getFilter($filters,true,true);
5755
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5756
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5754
+		$filter_query = $this->getFilter($filters, true, true);
5755
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5756
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5757 5757
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner 
5758 5758
 		    GROUP BY spotter_output.aircraft_manufacturer 
5759 5759
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -5770,11 +5770,11 @@  discard block
 block discarded – undo
5770 5770
 	* @return Array the aircraft manufacturer list
5771 5771
 	*
5772 5772
 	*/
5773
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array())
5773
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array())
5774 5774
 	{
5775
-		$filter_query = $this->getFilter($filters,true,true);
5776
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5777
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5775
+		$filter_query = $this->getFilter($filters, true, true);
5776
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5777
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5778 5778
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
5779 5779
 		    GROUP BY spotter_output.aircraft_manufacturer 
5780 5780
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -5792,24 +5792,24 @@  discard block
 block discarded – undo
5792 5792
 	* @return Array the aircraft list
5793 5793
 	*
5794 5794
 	*/
5795
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5795
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5796 5796
 	{
5797
-		$filter_query = $this->getFilter($filters,true,true);
5798
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5799
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5797
+		$filter_query = $this->getFilter($filters, true, true);
5798
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5799
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5800 5800
 		
5801 5801
 
5802
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5802
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5803 5803
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5804 5804
                     GROUP BY spotter_output.aircraft_name 
5805 5805
 					ORDER BY aircraft_icao_count DESC";
5806 5806
  
5807 5807
 		
5808 5808
 		$sth = $this->db->prepare($query);
5809
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5809
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5810 5810
 		$aircraft_array = array();
5811 5811
 		$temp_array = array();
5812
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5812
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5813 5813
 		{
5814 5814
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5815 5815
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5825,33 +5825,33 @@  discard block
 block discarded – undo
5825 5825
 	* @return Array the aircraft list
5826 5826
 	*
5827 5827
 	*/
5828
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5828
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5829 5829
 	{
5830
-		$filter_query = $this->getFilter($filters,true,true);
5830
+		$filter_query = $this->getFilter($filters, true, true);
5831 5831
 		$Image = new Image($this->db);
5832
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5833
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5832
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5833
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5834 5834
 
5835
-		$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   
5835
+		$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   
5836 5836
                     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)   
5837 5837
                     GROUP BY spotter_output.registration 
5838 5838
 					ORDER BY registration_count DESC";
5839 5839
 
5840 5840
 		
5841 5841
 		$sth = $this->db->prepare($query);
5842
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5842
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5843 5843
       
5844 5844
 		$aircraft_array = array();
5845 5845
 		$temp_array = array();
5846 5846
         
5847
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5847
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5848 5848
 		{
5849 5849
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5850 5850
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5851 5851
 			$temp_array['registration'] = $row['registration'];
5852 5852
 			$temp_array['airline_name'] = $row['airline_name'];
5853 5853
 			$temp_array['image_thumbnail'] = "";
5854
-			if($row['registration'] != "")
5854
+			if ($row['registration'] != "")
5855 5855
 			{
5856 5856
 				$image_array = $Image->getSpotterImage($row['registration']);
5857 5857
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5871,25 +5871,25 @@  discard block
 block discarded – undo
5871 5871
 	* @return Array the aircraft manufacturer list
5872 5872
 	*
5873 5873
 	*/
5874
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5874
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5875 5875
 	{
5876
-		$filter_query = $this->getFilter($filters,true,true);
5877
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5878
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5876
+		$filter_query = $this->getFilter($filters, true, true);
5877
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5878
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5879 5879
 
5880
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5880
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5881 5881
                     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) 
5882 5882
                     GROUP BY spotter_output.aircraft_manufacturer 
5883 5883
 					ORDER BY aircraft_manufacturer_count DESC";
5884 5884
 
5885 5885
 		
5886 5886
 		$sth = $this->db->prepare($query);
5887
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5887
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5888 5888
       
5889 5889
 		$aircraft_array = array();
5890 5890
 		$temp_array = array();
5891 5891
         
5892
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5892
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5893 5893
 		{
5894 5894
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5895 5895
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5909,11 +5909,11 @@  discard block
 block discarded – undo
5909 5909
 	* @return Array the aircraft list
5910 5910
 	*
5911 5911
 	*/
5912
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5912
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5913 5913
 	{
5914
-		$filter_query = $this->getFilter($filters,true,true);
5915
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5916
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5914
+		$filter_query = $this->getFilter($filters, true, true);
5915
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5916
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5917 5917
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5918 5918
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5919 5919
 			    ORDER BY aircraft_icao_count DESC";
@@ -5925,7 +5925,7 @@  discard block
 block discarded – undo
5925 5925
 		$aircraft_array = array();
5926 5926
 		$temp_array = array();
5927 5927
         
5928
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5928
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5929 5929
 		{
5930 5930
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5931 5931
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5944,12 +5944,12 @@  discard block
 block discarded – undo
5944 5944
 	* @return Array the aircraft list
5945 5945
 	*
5946 5946
 	*/
5947
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5947
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5948 5948
 	{
5949
-		$filter_query = $this->getFilter($filters,true,true);
5949
+		$filter_query = $this->getFilter($filters, true, true);
5950 5950
 		$Image = new Image($this->db);
5951
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5952
-		$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 
5951
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5952
+		$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 
5953 5953
 			    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)    
5954 5954
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5955 5955
 			    ORDER BY registration_count DESC";
@@ -5961,14 +5961,14 @@  discard block
 block discarded – undo
5961 5961
 		$aircraft_array = array();
5962 5962
 		$temp_array = array();
5963 5963
         
5964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5965 5965
 		{
5966 5966
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5967 5967
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5968 5968
 			$temp_array['registration'] = $row['registration'];
5969 5969
 			$temp_array['airline_name'] = $row['airline_name'];
5970 5970
 			$temp_array['image_thumbnail'] = "";
5971
-			if($row['registration'] != "")
5971
+			if ($row['registration'] != "")
5972 5972
 			{
5973 5973
 				$image_array = $Image->getSpotterImage($row['registration']);
5974 5974
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5988,11 +5988,11 @@  discard block
 block discarded – undo
5988 5988
 	* @return Array the aircraft manufacturer list
5989 5989
 	*
5990 5990
 	*/
5991
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5991
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5992 5992
 	{
5993
-		$filter_query = $this->getFilter($filters,true,true);
5994
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5995
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5993
+		$filter_query = $this->getFilter($filters, true, true);
5994
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5995
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5996 5996
                     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) 
5997 5997
                     GROUP BY spotter_output.aircraft_manufacturer 
5998 5998
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6004,7 +6004,7 @@  discard block
 block discarded – undo
6004 6004
 		$aircraft_array = array();
6005 6005
 		$temp_array = array();
6006 6006
         
6007
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6007
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6008 6008
 		{
6009 6009
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6010 6010
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6023,38 +6023,38 @@  discard block
 block discarded – undo
6023 6023
 	* @return Array the aircraft list
6024 6024
 	*
6025 6025
 	*/
6026
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6026
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6027 6027
 	{
6028 6028
 		global $globalDBdriver;
6029
-		$filter_query = $this->getFilter($filters,true,true);
6030
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6029
+		$filter_query = $this->getFilter($filters, true, true);
6030
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6031 6031
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6032 6032
                 $query_values = array();
6033 6033
 		if ($year != '') {
6034 6034
 			if ($globalDBdriver == 'mysql') {
6035 6035
 				$query .= " AND YEAR(spotter_output.date) = :year";
6036
-				$query_values = array_merge($query_values,array(':year' => $year));
6036
+				$query_values = array_merge($query_values, array(':year' => $year));
6037 6037
 			} else {
6038 6038
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6039
-				$query_values = array_merge($query_values,array(':year' => $year));
6039
+				$query_values = array_merge($query_values, array(':year' => $year));
6040 6040
 			}
6041 6041
 		}
6042 6042
 		if ($month != '') {
6043 6043
 			if ($globalDBdriver == 'mysql') {
6044 6044
 				$query .= " AND MONTH(spotter_output.date) = :month";
6045
-				$query_values = array_merge($query_values,array(':month' => $month));
6045
+				$query_values = array_merge($query_values, array(':month' => $month));
6046 6046
 			} else {
6047 6047
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6048
-				$query_values = array_merge($query_values,array(':month' => $month));
6048
+				$query_values = array_merge($query_values, array(':month' => $month));
6049 6049
 			}
6050 6050
 		}
6051 6051
 		if ($day != '') {
6052 6052
 			if ($globalDBdriver == 'mysql') {
6053 6053
 				$query .= " AND DAY(spotter_output.date) = :day";
6054
-				$query_values = array_merge($query_values,array(':day' => $day));
6054
+				$query_values = array_merge($query_values, array(':day' => $day));
6055 6055
 			} else {
6056 6056
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6057
-				$query_values = array_merge($query_values,array(':day' => $day));
6057
+				$query_values = array_merge($query_values, array(':day' => $day));
6058 6058
 			}
6059 6059
 		}
6060 6060
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6068,7 +6068,7 @@  discard block
 block discarded – undo
6068 6068
 		$manufacturer_array = array();
6069 6069
 		$temp_array = array();
6070 6070
         
6071
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6071
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6072 6072
 		{
6073 6073
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6074 6074
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6087,12 +6087,12 @@  discard block
 block discarded – undo
6087 6087
 	* @return Array the aircraft list
6088 6088
 	*
6089 6089
 	*/
6090
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6090
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6091 6091
 	{
6092 6092
 		global $globalDBdriver;
6093 6093
 		$Image = new Image($this->db);
6094
-		$filter_query = $this->getFilter($filters,true,true);
6095
-		$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    
6094
+		$filter_query = $this->getFilter($filters, true, true);
6095
+		$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    
6096 6096
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6097 6097
                 if ($olderthanmonths > 0) {
6098 6098
             		if ($globalDBdriver == 'mysql') {
@@ -6112,28 +6112,28 @@  discard block
 block discarded – undo
6112 6112
 		if ($year != '') {
6113 6113
 			if ($globalDBdriver == 'mysql') {
6114 6114
 				$query .= " AND YEAR(spotter_output.date) = :year";
6115
-				$query_values = array_merge($query_values,array(':year' => $year));
6115
+				$query_values = array_merge($query_values, array(':year' => $year));
6116 6116
 			} else {
6117 6117
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6118
-				$query_values = array_merge($query_values,array(':year' => $year));
6118
+				$query_values = array_merge($query_values, array(':year' => $year));
6119 6119
 			}
6120 6120
 		}
6121 6121
 		if ($month != '') {
6122 6122
 			if ($globalDBdriver == 'mysql') {
6123 6123
 				$query .= " AND MONTH(spotter_output.date) = :month";
6124
-				$query_values = array_merge($query_values,array(':month' => $month));
6124
+				$query_values = array_merge($query_values, array(':month' => $month));
6125 6125
 			} else {
6126 6126
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6127
-				$query_values = array_merge($query_values,array(':month' => $month));
6127
+				$query_values = array_merge($query_values, array(':month' => $month));
6128 6128
 			}
6129 6129
 		}
6130 6130
 		if ($day != '') {
6131 6131
 			if ($globalDBdriver == 'mysql') {
6132 6132
 				$query .= " AND DAY(spotter_output.date) = :day";
6133
-				$query_values = array_merge($query_values,array(':day' => $day));
6133
+				$query_values = array_merge($query_values, array(':day' => $day));
6134 6134
 			} else {
6135 6135
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6136
-				$query_values = array_merge($query_values,array(':day' => $day));
6136
+				$query_values = array_merge($query_values, array(':day' => $day));
6137 6137
 			}
6138 6138
 		}
6139 6139
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6145,7 +6145,7 @@  discard block
 block discarded – undo
6145 6145
 		$aircraft_array = array();
6146 6146
 		$temp_array = array();
6147 6147
         
6148
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6148
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6149 6149
 		{
6150 6150
 			$temp_array['registration'] = $row['registration'];
6151 6151
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6153,7 +6153,7 @@  discard block
 block discarded – undo
6153 6153
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6154 6154
 			$temp_array['airline_name'] = $row['airline_name'];
6155 6155
 			$temp_array['image_thumbnail'] = "";
6156
-			if($row['registration'] != "")
6156
+			if ($row['registration'] != "")
6157 6157
 			{
6158 6158
 				$image_array = $Image->getSpotterImage($row['registration']);
6159 6159
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6172,12 +6172,12 @@  discard block
 block discarded – undo
6172 6172
 	* @return Array the aircraft list
6173 6173
 	*
6174 6174
 	*/
6175
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6175
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6176 6176
 	{
6177 6177
 		global $globalDBdriver;
6178
-		$filter_query = $this->getFilter($filters,true,true);
6178
+		$filter_query = $this->getFilter($filters, true, true);
6179 6179
 		$Image = new Image($this->db);
6180
-		$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    
6180
+		$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    
6181 6181
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6182 6182
                 if ($olderthanmonths > 0) {
6183 6183
             		if ($globalDBdriver == 'mysql') {
@@ -6205,7 +6205,7 @@  discard block
 block discarded – undo
6205 6205
 		$aircraft_array = array();
6206 6206
 		$temp_array = array();
6207 6207
         
6208
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6208
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6209 6209
 		{
6210 6210
 			$temp_array['registration'] = $row['registration'];
6211 6211
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6214,7 +6214,7 @@  discard block
 block discarded – undo
6214 6214
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6215 6215
 			$temp_array['airline_name'] = $row['airline_name'];
6216 6216
 			$temp_array['image_thumbnail'] = "";
6217
-			if($row['registration'] != "")
6217
+			if ($row['registration'] != "")
6218 6218
 			{
6219 6219
 				$image_array = $Image->getSpotterImage($row['registration']);
6220 6220
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6233,11 +6233,11 @@  discard block
 block discarded – undo
6233 6233
 	* @return Array the airport list
6234 6234
 	*
6235 6235
 	*/
6236
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6236
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6237 6237
 	{
6238 6238
 		global $globalDBdriver;
6239
-		$filter_query = $this->getFilter($filters,true,true);
6240
-		$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 
6239
+		$filter_query = $this->getFilter($filters, true, true);
6240
+		$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 
6241 6241
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6242 6242
                 if ($olderthanmonths > 0) {
6243 6243
             		if ($globalDBdriver == 'mysql') {
@@ -6257,28 +6257,28 @@  discard block
 block discarded – undo
6257 6257
 		if ($year != '') {
6258 6258
 			if ($globalDBdriver == 'mysql') {
6259 6259
 				$query .= " AND YEAR(spotter_output.date) = :year";
6260
-				$query_values = array_merge($query_values,array(':year' => $year));
6260
+				$query_values = array_merge($query_values, array(':year' => $year));
6261 6261
 			} else {
6262 6262
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6263
-				$query_values = array_merge($query_values,array(':year' => $year));
6263
+				$query_values = array_merge($query_values, array(':year' => $year));
6264 6264
 			}
6265 6265
 		}
6266 6266
 		if ($month != '') {
6267 6267
 			if ($globalDBdriver == 'mysql') {
6268 6268
 				$query .= " AND MONTH(spotter_output.date) = :month";
6269
-				$query_values = array_merge($query_values,array(':month' => $month));
6269
+				$query_values = array_merge($query_values, array(':month' => $month));
6270 6270
 			} else {
6271 6271
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6272
-				$query_values = array_merge($query_values,array(':month' => $month));
6272
+				$query_values = array_merge($query_values, array(':month' => $month));
6273 6273
 			}
6274 6274
 		}
6275 6275
 		if ($day != '') {
6276 6276
 			if ($globalDBdriver == 'mysql') {
6277 6277
 				$query .= " AND DAY(spotter_output.date) = :day";
6278
-				$query_values = array_merge($query_values,array(':day' => $day));
6278
+				$query_values = array_merge($query_values, array(':day' => $day));
6279 6279
 			} else {
6280 6280
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6281
-				$query_values = array_merge($query_values,array(':day' => $day));
6281
+				$query_values = array_merge($query_values, array(':day' => $day));
6282 6282
 			}
6283 6283
 		}
6284 6284
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6290,7 +6290,7 @@  discard block
 block discarded – undo
6290 6290
 
6291 6291
 		$airport_array = array();
6292 6292
 		$temp_array = array();
6293
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6293
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6294 6294
 		{
6295 6295
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6296 6296
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6309,11 +6309,11 @@  discard block
 block discarded – undo
6309 6309
 	* @return Array the airport list
6310 6310
 	*
6311 6311
 	*/
6312
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6312
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6313 6313
 	{
6314 6314
 		global $globalDBdriver;
6315
-		$filter_query = $this->getFilter($filters,true,true);
6316
-		$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 
6315
+		$filter_query = $this->getFilter($filters, true, true);
6316
+		$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 
6317 6317
 			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 <> '' ";
6318 6318
                 if ($olderthanmonths > 0) {
6319 6319
             		if ($globalDBdriver == 'mysql') {
@@ -6342,7 +6342,7 @@  discard block
 block discarded – undo
6342 6342
 		$airport_array = array();
6343 6343
 		$temp_array = array();
6344 6344
         
6345
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6345
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6346 6346
 		{
6347 6347
 			$temp_array['airline_icao'] = $row['airline_icao'];
6348 6348
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6362,11 +6362,11 @@  discard block
 block discarded – undo
6362 6362
 	* @return Array the airport list
6363 6363
 	*
6364 6364
 	*/
6365
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6365
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6366 6366
 	{
6367 6367
 		global $globalDBdriver;
6368
-		$filter_query = $this->getFilter($filters,true,true);
6369
-		$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
6368
+		$filter_query = $this->getFilter($filters, true, true);
6369
+		$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
6370 6370
 				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";
6371 6371
                 if ($olderthanmonths > 0) {
6372 6372
             		if ($globalDBdriver == 'mysql') {
@@ -6386,28 +6386,28 @@  discard block
 block discarded – undo
6386 6386
 		if ($year != '') {
6387 6387
 			if ($globalDBdriver == 'mysql') {
6388 6388
 				$query .= " AND YEAR(spotter_output.date) = :year";
6389
-				$query_values = array_merge($query_values,array(':year' => $year));
6389
+				$query_values = array_merge($query_values, array(':year' => $year));
6390 6390
 			} else {
6391 6391
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6392
-				$query_values = array_merge($query_values,array(':year' => $year));
6392
+				$query_values = array_merge($query_values, array(':year' => $year));
6393 6393
 			}
6394 6394
 		}
6395 6395
 		if ($month != '') {
6396 6396
 			if ($globalDBdriver == 'mysql') {
6397 6397
 				$query .= " AND MONTH(spotter_output.date) = :month";
6398
-				$query_values = array_merge($query_values,array(':month' => $month));
6398
+				$query_values = array_merge($query_values, array(':month' => $month));
6399 6399
 			} else {
6400 6400
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6401
-				$query_values = array_merge($query_values,array(':month' => $month));
6401
+				$query_values = array_merge($query_values, array(':month' => $month));
6402 6402
 			}
6403 6403
 		}
6404 6404
 		if ($day != '') {
6405 6405
 			if ($globalDBdriver == 'mysql') {
6406 6406
 				$query .= " AND DAY(spotter_output.date) = :day";
6407
-				$query_values = array_merge($query_values,array(':day' => $day));
6407
+				$query_values = array_merge($query_values, array(':day' => $day));
6408 6408
 			} else {
6409 6409
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6410
-				$query_values = array_merge($query_values,array(':day' => $day));
6410
+				$query_values = array_merge($query_values, array(':day' => $day));
6411 6411
 			}
6412 6412
 		}
6413 6413
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6420,7 +6420,7 @@  discard block
 block discarded – undo
6420 6420
 		$airport_array = array();
6421 6421
 		$temp_array = array();
6422 6422
         
6423
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6423
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6424 6424
 		{
6425 6425
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6426 6426
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6439,11 +6439,11 @@  discard block
 block discarded – undo
6439 6439
 	* @return Array the airport list
6440 6440
 	*
6441 6441
 	*/
6442
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6442
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6443 6443
 	{
6444 6444
 		global $globalDBdriver;
6445
-		$filter_query = $this->getFilter($filters,true,true);
6446
-		$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
6445
+		$filter_query = $this->getFilter($filters, true, true);
6446
+		$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
6447 6447
 				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 ";
6448 6448
                 if ($olderthanmonths > 0) {
6449 6449
             		if ($globalDBdriver == 'mysql') {
@@ -6472,7 +6472,7 @@  discard block
 block discarded – undo
6472 6472
 		$airport_array = array();
6473 6473
 		$temp_array = array();
6474 6474
         
6475
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6475
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6476 6476
 		{
6477 6477
 			$temp_array['airline_icao'] = $row['airline_icao'];
6478 6478
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6492,11 +6492,11 @@  discard block
 block discarded – undo
6492 6492
 	* @return Array the airport list
6493 6493
 	*
6494 6494
 	*/
6495
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6495
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6496 6496
 	{
6497
-		$filter_query = $this->getFilter($filters,true,true);
6498
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6499
-		$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 
6497
+		$filter_query = $this->getFilter($filters, true, true);
6498
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6499
+		$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 
6500 6500
 			    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 <> '' 
6501 6501
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6502 6502
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6508,7 +6508,7 @@  discard block
 block discarded – undo
6508 6508
 		$airport_array = array();
6509 6509
 		$temp_array = array();
6510 6510
         
6511
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6511
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6512 6512
 		{
6513 6513
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6514 6514
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6530,11 +6530,11 @@  discard block
 block discarded – undo
6530 6530
 	* @return Array the airport list
6531 6531
 	*
6532 6532
 	*/
6533
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6533
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6534 6534
 	{
6535
-		$filter_query = $this->getFilter($filters,true,true);
6536
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6537
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6535
+		$filter_query = $this->getFilter($filters, true, true);
6536
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6537
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6538 6538
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6539 6539
                     GROUP BY spotter_output.departure_airport_country
6540 6540
 					ORDER BY airport_departure_country_count DESC";
@@ -6546,7 +6546,7 @@  discard block
 block discarded – undo
6546 6546
 		$airport_array = array();
6547 6547
 		$temp_array = array();
6548 6548
         
6549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6550 6550
 		{
6551 6551
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6552 6552
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6565,11 +6565,11 @@  discard block
 block discarded – undo
6565 6565
 	* @return Array the airport list
6566 6566
 	*
6567 6567
 	*/
6568
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6568
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6569 6569
 	{
6570
-		$filter_query = $this->getFilter($filters,true,true);
6571
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6572
-		$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 
6570
+		$filter_query = $this->getFilter($filters, true, true);
6571
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6572
+		$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 
6573 6573
 			    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 <> '' 
6574 6574
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6575 6575
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6581,7 +6581,7 @@  discard block
 block discarded – undo
6581 6581
 		$airport_array = array();
6582 6582
 		$temp_array = array();
6583 6583
         
6584
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6584
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6585 6585
 		{
6586 6586
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6587 6587
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6602,11 +6602,11 @@  discard block
 block discarded – undo
6602 6602
 	* @return Array the airport list
6603 6603
 	*
6604 6604
 	*/
6605
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6605
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6606 6606
 	{
6607
-		$filter_query = $this->getFilter($filters,true,true);
6608
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6609
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6607
+		$filter_query = $this->getFilter($filters, true, true);
6608
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6609
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6610 6610
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6611 6611
                     GROUP BY spotter_output.departure_airport_country
6612 6612
 					ORDER BY airport_departure_country_count DESC";
@@ -6618,7 +6618,7 @@  discard block
 block discarded – undo
6618 6618
 		$airport_array = array();
6619 6619
 		$temp_array = array();
6620 6620
         
6621
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6621
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6622 6622
 		{
6623 6623
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6624 6624
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6636,11 +6636,11 @@  discard block
 block discarded – undo
6636 6636
 	* @return Array the airport list
6637 6637
 	*
6638 6638
 	*/
6639
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6639
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
6640 6640
 	{
6641
-		$filter_query = $this->getFilter($filters,true,true);
6642
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6643
-		$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 
6641
+		$filter_query = $this->getFilter($filters, true, true);
6642
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6643
+		$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 
6644 6644
 			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 <> '' 
6645 6645
                     GROUP BY spotter_output.departure_airport_icao
6646 6646
 					ORDER BY airport_departure_icao_count DESC";
@@ -6652,7 +6652,7 @@  discard block
 block discarded – undo
6652 6652
 		$airport_array = array();
6653 6653
 		$temp_array = array();
6654 6654
         
6655
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6655
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6656 6656
 		{
6657 6657
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6658 6658
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6673,11 +6673,11 @@  discard block
 block discarded – undo
6673 6673
 	* @return Array the airport list
6674 6674
 	*
6675 6675
 	*/
6676
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6676
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6677 6677
 	{
6678
-		$filter_query = $this->getFilter($filters,true,true);
6679
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6680
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6678
+		$filter_query = $this->getFilter($filters, true, true);
6679
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6680
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6681 6681
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
6682 6682
                     GROUP BY spotter_output.departure_airport_country
6683 6683
 					ORDER BY airport_departure_country_count DESC";
@@ -6689,7 +6689,7 @@  discard block
 block discarded – undo
6689 6689
 		$airport_array = array();
6690 6690
 		$temp_array = array();
6691 6691
         
6692
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6692
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6693 6693
 		{
6694 6694
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6695 6695
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6707,11 +6707,11 @@  discard block
 block discarded – undo
6707 6707
 	* @return Array the airport list
6708 6708
 	*
6709 6709
 	*/
6710
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6710
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6711 6711
 	{
6712
-		$filter_query = $this->getFilter($filters,true,true);
6713
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6714
-		$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 
6712
+		$filter_query = $this->getFilter($filters, true, true);
6713
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6714
+		$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 
6715 6715
 			    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 <> '' 
6716 6716
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6717 6717
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6723,7 +6723,7 @@  discard block
 block discarded – undo
6723 6723
 		$airport_array = array();
6724 6724
 		$temp_array = array();
6725 6725
         
6726
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6726
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6727 6727
 		{
6728 6728
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6729 6729
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6744,11 +6744,11 @@  discard block
 block discarded – undo
6744 6744
 	* @return Array the airport list
6745 6745
 	*
6746 6746
 	*/
6747
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6747
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6748 6748
 	{
6749
-		$filter_query = $this->getFilter($filters,true,true);
6750
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6751
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6749
+		$filter_query = $this->getFilter($filters, true, true);
6750
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6751
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6752 6752
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6753 6753
                     GROUP BY spotter_output.departure_airport_country
6754 6754
 					ORDER BY airport_departure_country_count DESC";
@@ -6760,7 +6760,7 @@  discard block
 block discarded – undo
6760 6760
 		$airport_array = array();
6761 6761
 		$temp_array = array();
6762 6762
         
6763
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6763
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6764 6764
 		{
6765 6765
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6766 6766
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6779,11 +6779,11 @@  discard block
 block discarded – undo
6779 6779
 	* @return Array the airport list
6780 6780
 	*
6781 6781
 	*/
6782
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6782
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6783 6783
 	{
6784
-		$filter_query = $this->getFilter($filters,true,true);
6785
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6786
-		$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 
6784
+		$filter_query = $this->getFilter($filters, true, true);
6785
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6786
+		$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 
6787 6787
 			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 <> '' 
6788 6788
                     GROUP BY spotter_output.departure_airport_icao
6789 6789
 					ORDER BY airport_departure_icao_count DESC";
@@ -6795,7 +6795,7 @@  discard block
 block discarded – undo
6795 6795
 		$airport_array = array();
6796 6796
 		$temp_array = array();
6797 6797
         
6798
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6798
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6799 6799
 		{
6800 6800
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6801 6801
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6816,11 +6816,11 @@  discard block
 block discarded – undo
6816 6816
 	* @return Array the airport list
6817 6817
 	*
6818 6818
 	*/
6819
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6819
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6820 6820
 	{
6821
-		$filter_query = $this->getFilter($filters,true,true);
6822
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6823
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6821
+		$filter_query = $this->getFilter($filters, true, true);
6822
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6823
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6824 6824
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6825 6825
                     GROUP BY spotter_output.departure_airport_country
6826 6826
 					ORDER BY airport_departure_country_count DESC";
@@ -6832,7 +6832,7 @@  discard block
 block discarded – undo
6832 6832
 		$airport_array = array();
6833 6833
 		$temp_array = array();
6834 6834
         
6835
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6835
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6836 6836
 		{
6837 6837
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6838 6838
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6850,11 +6850,11 @@  discard block
 block discarded – undo
6850 6850
 	* @return Array the airport list
6851 6851
 	*
6852 6852
 	*/
6853
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6853
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6854 6854
 	{
6855 6855
 		global $globalTimezone, $globalDBdriver;
6856
-		$filter_query = $this->getFilter($filters,true,true);
6857
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6856
+		$filter_query = $this->getFilter($filters, true, true);
6857
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6858 6858
 		if ($globalTimezone != '') {
6859 6859
 			date_default_timezone_set($globalTimezone);
6860 6860
 			$datetime = new DateTime($date);
@@ -6862,12 +6862,12 @@  discard block
 block discarded – undo
6862 6862
 		} else $offset = '+00:00';
6863 6863
 
6864 6864
 		if ($globalDBdriver == 'mysql') {
6865
-			$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 
6865
+			$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 
6866 6866
 					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
6867 6867
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6868 6868
 					ORDER BY airport_departure_icao_count DESC";
6869 6869
 		} else {
6870
-			$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 
6870
+			$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 
6871 6871
 					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
6872 6872
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6873 6873
 					ORDER BY airport_departure_icao_count DESC";
@@ -6879,7 +6879,7 @@  discard block
 block discarded – undo
6879 6879
 		$airport_array = array();
6880 6880
 		$temp_array = array();
6881 6881
         
6882
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6882
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6883 6883
 		{
6884 6884
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6885 6885
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6900,11 +6900,11 @@  discard block
 block discarded – undo
6900 6900
 	* @return Array the airport list
6901 6901
 	*
6902 6902
 	*/
6903
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6903
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6904 6904
 	{
6905 6905
 		global $globalTimezone, $globalDBdriver;
6906
-		$filter_query = $this->getFilter($filters,true,true);
6907
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6906
+		$filter_query = $this->getFilter($filters, true, true);
6907
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6908 6908
 		if ($globalTimezone != '') {
6909 6909
 			date_default_timezone_set($globalTimezone);
6910 6910
 			$datetime = new DateTime($date);
@@ -6912,12 +6912,12 @@  discard block
 block discarded – undo
6912 6912
 		} else $offset = '+00:00';
6913 6913
 
6914 6914
 		if ($globalDBdriver == 'mysql') {
6915
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6915
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6916 6916
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6917 6917
 					GROUP BY spotter_output.departure_airport_country
6918 6918
 					ORDER BY airport_departure_country_count DESC";
6919 6919
 		} else {
6920
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6920
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6921 6921
 					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 
6922 6922
 					GROUP BY spotter_output.departure_airport_country
6923 6923
 					ORDER BY airport_departure_country_count DESC";
@@ -6929,7 +6929,7 @@  discard block
 block discarded – undo
6929 6929
 		$airport_array = array();
6930 6930
 		$temp_array = array();
6931 6931
         
6932
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6932
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6933 6933
 		{
6934 6934
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6935 6935
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6947,11 +6947,11 @@  discard block
 block discarded – undo
6947 6947
 	* @return Array the airport list
6948 6948
 	*
6949 6949
 	*/
6950
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6950
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6951 6951
 	{
6952
-		$filter_query = $this->getFilter($filters,true,true);
6953
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6954
-		$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 
6952
+		$filter_query = $this->getFilter($filters, true, true);
6953
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6954
+		$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 
6955 6955
 		    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 
6956 6956
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6957 6957
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6963,7 +6963,7 @@  discard block
 block discarded – undo
6963 6963
 		$airport_array = array();
6964 6964
 		$temp_array = array();
6965 6965
         
6966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6967 6967
 		{
6968 6968
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6969 6969
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6983,11 +6983,11 @@  discard block
 block discarded – undo
6983 6983
 	* @return Array the airport list
6984 6984
 	*
6985 6985
 	*/
6986
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
6986
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
6987 6987
 	{
6988
-		$filter_query = $this->getFilter($filters,true,true);
6989
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
6990
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6988
+		$filter_query = $this->getFilter($filters, true, true);
6989
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
6990
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6991 6991
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.owner_name = :owner 
6992 6992
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6993 6993
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6999,7 +6999,7 @@  discard block
 block discarded – undo
6999 6999
 		$airport_array = array();
7000 7000
 		$temp_array = array();
7001 7001
         
7002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7003 7003
 		{
7004 7004
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7005 7005
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7019,11 +7019,11 @@  discard block
 block discarded – undo
7019 7019
 	* @return Array the airport list
7020 7020
 	*
7021 7021
 	*/
7022
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7022
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7023 7023
 	{
7024
-		$filter_query = $this->getFilter($filters,true,true);
7025
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7026
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7024
+		$filter_query = $this->getFilter($filters, true, true);
7025
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7026
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7027 7027
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7028 7028
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7029 7029
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7034,7 +7034,7 @@  discard block
 block discarded – undo
7034 7034
 		$airport_array = array();
7035 7035
 		$temp_array = array();
7036 7036
         
7037
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7037
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7038 7038
 		{
7039 7039
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7040 7040
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7056,11 +7056,11 @@  discard block
 block discarded – undo
7056 7056
 	* @return Array the airport list
7057 7057
 	*
7058 7058
 	*/
7059
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7059
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7060 7060
 	{
7061
-		$filter_query = $this->getFilter($filters,true,true);
7062
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7063
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7061
+		$filter_query = $this->getFilter($filters, true, true);
7062
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7063
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7064 7064
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7065 7065
                     GROUP BY spotter_output.departure_airport_country
7066 7066
 					ORDER BY airport_departure_country_count DESC";
@@ -7072,7 +7072,7 @@  discard block
 block discarded – undo
7072 7072
 		$airport_array = array();
7073 7073
 		$temp_array = array();
7074 7074
         
7075
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7075
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7076 7076
 		{
7077 7077
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7078 7078
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_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 countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7092
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7093 7093
 	{
7094
-		$filter_query = $this->getFilter($filters,true,true);
7095
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7096
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7094
+		$filter_query = $this->getFilter($filters, true, true);
7095
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7096
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7097 7097
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7098 7098
 			GROUP BY spotter_output.departure_airport_country
7099 7099
 			ORDER BY airport_departure_country_count DESC";
@@ -7109,11 +7109,11 @@  discard block
 block discarded – undo
7109 7109
 	* @return Array the airport list
7110 7110
 	*
7111 7111
 	*/
7112
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7112
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7113 7113
 	{
7114
-		$filter_query = $this->getFilter($filters,true,true);
7115
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7116
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7114
+		$filter_query = $this->getFilter($filters, true, true);
7115
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7116
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7117 7117
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7118 7118
 			GROUP BY spotter_output.departure_airport_country
7119 7119
 			ORDER BY airport_departure_country_count DESC";
@@ -7131,12 +7131,12 @@  discard block
 block discarded – undo
7131 7131
 	* @return Array the airport list
7132 7132
 	*
7133 7133
 	*/
7134
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7134
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7135 7135
 	{
7136
-		$filter_query = $this->getFilter($filters,true,true);
7137
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7136
+		$filter_query = $this->getFilter($filters, true, true);
7137
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7138 7138
 
7139
-		$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 
7139
+		$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 
7140 7140
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7141 7141
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7142 7142
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7148,7 +7148,7 @@  discard block
 block discarded – undo
7148 7148
 		$airport_array = array();
7149 7149
 		$temp_array = array();
7150 7150
         
7151
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7151
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7152 7152
 		{
7153 7153
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7154 7154
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7169,11 +7169,11 @@  discard block
 block discarded – undo
7169 7169
 	* @return Array the airport list
7170 7170
 	*
7171 7171
 	*/
7172
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7172
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7173 7173
 	{
7174
-		$filter_query = $this->getFilter($filters,true,true);
7175
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7176
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7174
+		$filter_query = $this->getFilter($filters, true, true);
7175
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7176
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7177 7177
 			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 
7178 7178
                     GROUP BY spotter_output.departure_airport_country
7179 7179
 					ORDER BY airport_departure_country_count DESC";
@@ -7185,7 +7185,7 @@  discard block
 block discarded – undo
7185 7185
 		$airport_array = array();
7186 7186
 		$temp_array = array();
7187 7187
         
7188
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7188
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7189 7189
 		{
7190 7190
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7191 7191
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7208,11 +7208,11 @@  discard block
 block discarded – undo
7208 7208
 	* @return Array the airport list
7209 7209
 	*
7210 7210
 	*/
7211
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7211
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7212 7212
 	{
7213 7213
 		global $globalDBdriver;
7214
-		$filter_query = $this->getFilter($filters,true,true);
7215
-		$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 
7214
+		$filter_query = $this->getFilter($filters, true, true);
7215
+		$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 
7216 7216
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7217 7217
                 if ($olderthanmonths > 0) {
7218 7218
             		if ($globalDBdriver == 'mysql') {
@@ -7232,28 +7232,28 @@  discard block
 block discarded – undo
7232 7232
 		if ($year != '') {
7233 7233
 			if ($globalDBdriver == 'mysql') {
7234 7234
 				$query .= " AND YEAR(spotter_output.date) = :year";
7235
-				$query_values = array_merge($query_values,array(':year' => $year));
7235
+				$query_values = array_merge($query_values, array(':year' => $year));
7236 7236
 			} else {
7237 7237
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7238
-				$query_values = array_merge($query_values,array(':year' => $year));
7238
+				$query_values = array_merge($query_values, array(':year' => $year));
7239 7239
 			}
7240 7240
 		}
7241 7241
 		if ($month != '') {
7242 7242
 			if ($globalDBdriver == 'mysql') {
7243 7243
 				$query .= " AND MONTH(spotter_output.date) = :month";
7244
-				$query_values = array_merge($query_values,array(':month' => $month));
7244
+				$query_values = array_merge($query_values, array(':month' => $month));
7245 7245
 			} else {
7246 7246
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7247
-				$query_values = array_merge($query_values,array(':month' => $month));
7247
+				$query_values = array_merge($query_values, array(':month' => $month));
7248 7248
 			}
7249 7249
 		}
7250 7250
 		if ($day != '') {
7251 7251
 			if ($globalDBdriver == 'mysql') {
7252 7252
 				$query .= " AND DAY(spotter_output.date) = :day";
7253
-				$query_values = array_merge($query_values,array(':day' => $day));
7253
+				$query_values = array_merge($query_values, array(':day' => $day));
7254 7254
 			} else {
7255 7255
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7256
-				$query_values = array_merge($query_values,array(':day' => $day));
7256
+				$query_values = array_merge($query_values, array(':day' => $day));
7257 7257
 			}
7258 7258
 		}
7259 7259
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7267,7 +7267,7 @@  discard block
 block discarded – undo
7267 7267
 		$airport_array = array();
7268 7268
 		$temp_array = array();
7269 7269
         
7270
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7270
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7271 7271
 		{
7272 7272
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7273 7273
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7290,11 +7290,11 @@  discard block
 block discarded – undo
7290 7290
 	* @return Array the airport list
7291 7291
 	*
7292 7292
 	*/
7293
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7293
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7294 7294
 	{
7295 7295
 		global $globalDBdriver;
7296
-		$filter_query = $this->getFilter($filters,true,true);
7297
-		$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 
7296
+		$filter_query = $this->getFilter($filters, true, true);
7297
+		$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 
7298 7298
 			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 <> '' ";
7299 7299
                 if ($olderthanmonths > 0) {
7300 7300
             		if ($globalDBdriver == 'mysql') {
@@ -7324,7 +7324,7 @@  discard block
 block discarded – undo
7324 7324
 		$airport_array = array();
7325 7325
 		$temp_array = array();
7326 7326
         
7327
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7327
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7328 7328
 		{
7329 7329
 			$temp_array['airline_icao'] = $row['airline_icao'];
7330 7330
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7349,11 +7349,11 @@  discard block
 block discarded – undo
7349 7349
 	* @return Array the airport list
7350 7350
 	*
7351 7351
 	*/
7352
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7352
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7353 7353
 	{
7354 7354
 		global $globalDBdriver;
7355
-		$filter_query = $this->getFilter($filters,true,true);
7356
-		$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 
7355
+		$filter_query = $this->getFilter($filters, true, true);
7356
+		$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 
7357 7357
 			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";
7358 7358
                 if ($olderthanmonths > 0) {
7359 7359
             		if ($globalDBdriver == 'mysql') {
@@ -7373,28 +7373,28 @@  discard block
 block discarded – undo
7373 7373
 		if ($year != '') {
7374 7374
 			if ($globalDBdriver == 'mysql') {
7375 7375
 				$query .= " AND YEAR(spotter_output.date) = :year";
7376
-				$query_values = array_merge($query_values,array(':year' => $year));
7376
+				$query_values = array_merge($query_values, array(':year' => $year));
7377 7377
 			} else {
7378 7378
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7379
-				$query_values = array_merge($query_values,array(':year' => $year));
7379
+				$query_values = array_merge($query_values, array(':year' => $year));
7380 7380
 			}
7381 7381
 		}
7382 7382
 		if ($month != '') {
7383 7383
 			if ($globalDBdriver == 'mysql') {
7384 7384
 				$query .= " AND MONTH(spotter_output.date) = :month";
7385
-				$query_values = array_merge($query_values,array(':month' => $month));
7385
+				$query_values = array_merge($query_values, array(':month' => $month));
7386 7386
 			} else {
7387 7387
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7388
-				$query_values = array_merge($query_values,array(':month' => $month));
7388
+				$query_values = array_merge($query_values, array(':month' => $month));
7389 7389
 			}
7390 7390
 		}
7391 7391
 		if ($day != '') {
7392 7392
 			if ($globalDBdriver == 'mysql') {
7393 7393
 				$query .= " AND DAY(spotter_output.date) = :day";
7394
-				$query_values = array_merge($query_values,array(':day' => $day));
7394
+				$query_values = array_merge($query_values, array(':day' => $day));
7395 7395
 			} else {
7396 7396
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7397
-				$query_values = array_merge($query_values,array(':day' => $day));
7397
+				$query_values = array_merge($query_values, array(':day' => $day));
7398 7398
 			}
7399 7399
 		}
7400 7400
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7407,7 +7407,7 @@  discard block
 block discarded – undo
7407 7407
       
7408 7408
 		$airport_array = array();
7409 7409
 		$temp_array = array();
7410
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7410
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7411 7411
 		{
7412 7412
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7413 7413
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7430,11 +7430,11 @@  discard block
 block discarded – undo
7430 7430
 	* @return Array the airport list
7431 7431
 	*
7432 7432
 	*/
7433
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7433
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7434 7434
 	{
7435 7435
 		global $globalDBdriver;
7436
-		$filter_query = $this->getFilter($filters,true,true);
7437
-		$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 
7436
+		$filter_query = $this->getFilter($filters, true, true);
7437
+		$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 
7438 7438
 			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 ";
7439 7439
                 if ($olderthanmonths > 0) {
7440 7440
             		if ($globalDBdriver == 'mysql') {
@@ -7464,7 +7464,7 @@  discard block
 block discarded – undo
7464 7464
 		$airport_array = array();
7465 7465
 		$temp_array = array();
7466 7466
         
7467
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7467
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7468 7468
 		{
7469 7469
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7470 7470
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7490,9 +7490,9 @@  discard block
 block discarded – undo
7490 7490
 	*/
7491 7491
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7492 7492
 	{
7493
-		$filter_query = $this->getFilter($filters,true,true);
7494
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7495
-		$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 
7493
+		$filter_query = $this->getFilter($filters, true, true);
7494
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7495
+		$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 
7496 7496
 			    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 
7497 7497
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7498 7498
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7503,7 +7503,7 @@  discard block
 block discarded – undo
7503 7503
 		$airport_array = array();
7504 7504
 		$temp_array = array();
7505 7505
         
7506
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7506
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7507 7507
 		{
7508 7508
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7509 7509
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7524,12 +7524,12 @@  discard block
 block discarded – undo
7524 7524
 	* @return Array the airport list
7525 7525
 	*
7526 7526
 	*/
7527
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7527
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7528 7528
 	{
7529
-		$filter_query = $this->getFilter($filters,true,true);
7530
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7529
+		$filter_query = $this->getFilter($filters, true, true);
7530
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7531 7531
 					
7532
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7532
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7533 7533
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7534 7534
                     GROUP BY spotter_output.arrival_airport_country
7535 7535
 					ORDER BY airport_arrival_country_count DESC";
@@ -7541,7 +7541,7 @@  discard block
 block discarded – undo
7541 7541
 		$airport_array = array();
7542 7542
 		$temp_array = array();
7543 7543
         
7544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7545 7545
 		{
7546 7546
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7547 7547
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7559,11 +7559,11 @@  discard block
 block discarded – undo
7559 7559
 	* @return Array the airport list
7560 7560
 	*
7561 7561
 	*/
7562
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7562
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7563 7563
 	{
7564
-		$filter_query = $this->getFilter($filters,true,true);
7565
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7566
-		$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 
7564
+		$filter_query = $this->getFilter($filters, true, true);
7565
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7566
+		$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 
7567 7567
 			    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 
7568 7568
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7569 7569
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7575,7 +7575,7 @@  discard block
 block discarded – undo
7575 7575
 		$airport_array = array();
7576 7576
 		$temp_array = array();
7577 7577
         
7578
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7578
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7579 7579
 		{
7580 7580
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7581 7581
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7597,11 +7597,11 @@  discard block
 block discarded – undo
7597 7597
 	* @return Array the airport list
7598 7598
 	*
7599 7599
 	*/
7600
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7600
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
7601 7601
 	{
7602
-		$filter_query = $this->getFilter($filters,true,true);
7603
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7604
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7602
+		$filter_query = $this->getFilter($filters, true, true);
7603
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7604
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7605 7605
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7606 7606
                     GROUP BY spotter_output.arrival_airport_country
7607 7607
 					ORDER BY airport_arrival_country_count DESC";
@@ -7613,7 +7613,7 @@  discard block
 block discarded – undo
7613 7613
 		$airport_array = array();
7614 7614
 		$temp_array = array();
7615 7615
         
7616
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7616
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7617 7617
 		{
7618 7618
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7619 7619
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7631,12 +7631,12 @@  discard block
 block discarded – undo
7631 7631
 	* @return Array the airport list
7632 7632
 	*
7633 7633
 	*/
7634
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
7634
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
7635 7635
 	{
7636
-		$filter_query = $this->getFilter($filters,true,true);
7637
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7636
+		$filter_query = $this->getFilter($filters, true, true);
7637
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7638 7638
 
7639
-		$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 
7639
+		$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 
7640 7640
 			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 
7641 7641
                     GROUP BY spotter_output.arrival_airport_icao
7642 7642
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7648,7 +7648,7 @@  discard block
 block discarded – undo
7648 7648
 		$airport_array = array();
7649 7649
 		$temp_array = array();
7650 7650
         
7651
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7651
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7652 7652
 		{
7653 7653
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7654 7654
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7669,11 +7669,11 @@  discard block
 block discarded – undo
7669 7669
 	* @return Array the airport list
7670 7670
 	*
7671 7671
 	*/
7672
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
7672
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
7673 7673
 	{
7674
-		$filter_query = $this->getFilter($filters,true,true);
7675
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7676
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7674
+		$filter_query = $this->getFilter($filters, true, true);
7675
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7676
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7677 7677
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
7678 7678
                     GROUP BY spotter_output.arrival_airport_country
7679 7679
 					ORDER BY airport_arrival_country_count DESC";
@@ -7685,7 +7685,7 @@  discard block
 block discarded – undo
7685 7685
 		$airport_array = array();
7686 7686
 		$temp_array = array();
7687 7687
         
7688
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7688
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7689 7689
 		{
7690 7690
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7691 7691
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7704,11 +7704,11 @@  discard block
 block discarded – undo
7704 7704
 	* @return Array the airport list
7705 7705
 	*
7706 7706
 	*/
7707
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
7707
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
7708 7708
 	{
7709
-		$filter_query = $this->getFilter($filters,true,true);
7710
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7711
-		$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 
7709
+		$filter_query = $this->getFilter($filters, true, true);
7710
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7711
+		$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 
7712 7712
 			    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 
7713 7713
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7714 7714
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7720,7 +7720,7 @@  discard block
 block discarded – undo
7720 7720
 		$airport_array = array();
7721 7721
 		$temp_array = array();
7722 7722
         
7723
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7723
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7724 7724
 		{
7725 7725
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7726 7726
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7741,11 +7741,11 @@  discard block
 block discarded – undo
7741 7741
 	* @return Array the airport list
7742 7742
 	*
7743 7743
 	*/
7744
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7744
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
7745 7745
 	{
7746
-		$filter_query = $this->getFilter($filters,true,true);
7747
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7748
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7746
+		$filter_query = $this->getFilter($filters, true, true);
7747
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7748
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7749 7749
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
7750 7750
                     GROUP BY spotter_output.arrival_airport_country
7751 7751
 					ORDER BY airport_arrival_country_count DESC";
@@ -7757,7 +7757,7 @@  discard block
 block discarded – undo
7757 7757
 		$airport_array = array();
7758 7758
 		$temp_array = array();
7759 7759
         
7760
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7760
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7761 7761
 		{
7762 7762
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7763 7763
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7775,11 +7775,11 @@  discard block
 block discarded – undo
7775 7775
 	* @return Array the airport list
7776 7776
 	*
7777 7777
 	*/
7778
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7778
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7779 7779
 	{
7780
-		$filter_query = $this->getFilter($filters,true,true);
7781
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7782
-		$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 
7780
+		$filter_query = $this->getFilter($filters, true, true);
7781
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7782
+		$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 
7783 7783
 			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 
7784 7784
                     GROUP BY spotter_output.arrival_airport_icao
7785 7785
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7791,7 +7791,7 @@  discard block
 block discarded – undo
7791 7791
 		$airport_array = array();
7792 7792
 		$temp_array = array();
7793 7793
         
7794
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7794
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7795 7795
 		{
7796 7796
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7797 7797
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7813,11 +7813,11 @@  discard block
 block discarded – undo
7813 7813
 	* @return Array the airport list
7814 7814
 	*
7815 7815
 	*/
7816
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7816
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7817 7817
 	{
7818
-		$filter_query = $this->getFilter($filters,true,true);
7819
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7820
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7818
+		$filter_query = $this->getFilter($filters, true, true);
7819
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7820
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7821 7821
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7822 7822
                     GROUP BY spotter_output.arrival_airport_country
7823 7823
 					ORDER BY airport_arrival_country_count DESC";
@@ -7829,7 +7829,7 @@  discard block
 block discarded – undo
7829 7829
 		$airport_array = array();
7830 7830
 		$temp_array = array();
7831 7831
         
7832
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7832
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7833 7833
 		{
7834 7834
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7835 7835
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7848,11 +7848,11 @@  discard block
 block discarded – undo
7848 7848
 	* @return Array the airport list
7849 7849
 	*
7850 7850
 	*/
7851
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7851
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7852 7852
 	{
7853 7853
 		global $globalTimezone, $globalDBdriver;
7854
-		$filter_query = $this->getFilter($filters,true,true);
7855
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7854
+		$filter_query = $this->getFilter($filters, true, true);
7855
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7856 7856
 		if ($globalTimezone != '') {
7857 7857
 			date_default_timezone_set($globalTimezone);
7858 7858
 			$datetime = new DateTime($date);
@@ -7860,12 +7860,12 @@  discard block
 block discarded – undo
7860 7860
 		} else $offset = '+00:00';
7861 7861
 
7862 7862
 		if ($globalDBdriver == 'mysql') {
7863
-			$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 
7863
+			$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 
7864 7864
 					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  
7865 7865
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7866 7866
 					ORDER BY airport_arrival_icao_count DESC";
7867 7867
 		} else {
7868
-			$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 
7868
+			$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 
7869 7869
 					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  
7870 7870
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7871 7871
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7877,7 +7877,7 @@  discard block
 block discarded – undo
7877 7877
 		$airport_array = array();
7878 7878
 		$temp_array = array();
7879 7879
         
7880
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7880
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7881 7881
 		{
7882 7882
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7883 7883
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7901,8 +7901,8 @@  discard block
 block discarded – undo
7901 7901
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7902 7902
 	{
7903 7903
 		global $globalTimezone, $globalDBdriver;
7904
-		$filter_query = $this->getFilter($filters,true,true);
7905
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7904
+		$filter_query = $this->getFilter($filters, true, true);
7905
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7906 7906
 		if ($globalTimezone != '') {
7907 7907
 			date_default_timezone_set($globalTimezone);
7908 7908
 			$datetime = new DateTime($date);
@@ -7910,12 +7910,12 @@  discard block
 block discarded – undo
7910 7910
 		} else $offset = '+00:00';
7911 7911
 
7912 7912
 		if ($globalDBdriver == 'mysql') {
7913
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7913
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7914 7914
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7915 7915
 					GROUP BY spotter_output.arrival_airport_country
7916 7916
 					ORDER BY airport_arrival_country_count DESC";
7917 7917
 		} else {
7918
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7918
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7919 7919
 					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 
7920 7920
 					GROUP BY spotter_output.arrival_airport_country
7921 7921
 					ORDER BY airport_arrival_country_count DESC";
@@ -7927,7 +7927,7 @@  discard block
 block discarded – undo
7927 7927
 		$airport_array = array();
7928 7928
 		$temp_array = array();
7929 7929
         
7930
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7930
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7931 7931
 		{
7932 7932
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7933 7933
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7945,11 +7945,11 @@  discard block
 block discarded – undo
7945 7945
 	* @return Array the airport list
7946 7946
 	*
7947 7947
 	*/
7948
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7948
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7949 7949
 	{
7950
-		$filter_query = $this->getFilter($filters,true,true);
7951
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7952
-		$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 
7950
+		$filter_query = $this->getFilter($filters, true, true);
7951
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7952
+		$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 
7953 7953
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
7954 7954
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7955 7955
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7961,7 +7961,7 @@  discard block
 block discarded – undo
7961 7961
 		$airport_array = array();
7962 7962
 		$temp_array = array();
7963 7963
         
7964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7965 7965
 		{
7966 7966
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7967 7967
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7981,11 +7981,11 @@  discard block
 block discarded – undo
7981 7981
 	* @return Array the airport list
7982 7982
 	*
7983 7983
 	*/
7984
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
7984
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
7985 7985
 	{
7986
-		$filter_query = $this->getFilter($filters,true,true);
7987
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7988
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7986
+		$filter_query = $this->getFilter($filters, true, true);
7987
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7988
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7989 7989
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.owner_name = :owner 
7990 7990
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7991 7991
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7996,7 +7996,7 @@  discard block
 block discarded – undo
7996 7996
 		$airport_array = array();
7997 7997
 		$temp_array = array();
7998 7998
         
7999
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7999
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8000 8000
 		{
8001 8001
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8002 8002
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8016,11 +8016,11 @@  discard block
 block discarded – undo
8016 8016
 	* @return Array the airport list
8017 8017
 	*
8018 8018
 	*/
8019
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8019
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8020 8020
 	{
8021
-		$filter_query = $this->getFilter($filters,true,true);
8022
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8023
-		$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 
8021
+		$filter_query = $this->getFilter($filters, true, true);
8022
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8023
+		$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 
8024 8024
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8025 8025
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8026 8026
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8031,7 +8031,7 @@  discard block
 block discarded – undo
8031 8031
 		$airport_array = array();
8032 8032
 		$temp_array = array();
8033 8033
         
8034
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8034
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8035 8035
 		{
8036 8036
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8037 8037
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8053,9 +8053,9 @@  discard block
 block discarded – undo
8053 8053
 	*/
8054 8054
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8055 8055
 	{
8056
-		$filter_query = $this->getFilter($filters,true,true);
8057
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8058
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8056
+		$filter_query = $this->getFilter($filters, true, true);
8057
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8058
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8059 8059
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8060 8060
                     GROUP BY spotter_output.arrival_airport_country
8061 8061
 					ORDER BY airport_arrival_country_count DESC";
@@ -8067,7 +8067,7 @@  discard block
 block discarded – undo
8067 8067
 		$airport_array = array();
8068 8068
 		$temp_array = array();
8069 8069
         
8070
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8070
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8071 8071
 		{
8072 8072
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8073 8073
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8086,9 +8086,9 @@  discard block
 block discarded – undo
8086 8086
 	*/
8087 8087
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8088 8088
 	{
8089
-		$filter_query = $this->getFilter($filters,true,true);
8090
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8091
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8089
+		$filter_query = $this->getFilter($filters, true, true);
8090
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8091
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8092 8092
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8093 8093
                     GROUP BY spotter_output.arrival_airport_country
8094 8094
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8106,11 +8106,11 @@  discard block
 block discarded – undo
8106 8106
 	* @return Array the airport list
8107 8107
 	*
8108 8108
 	*/
8109
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8109
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8110 8110
 	{
8111
-		$filter_query = $this->getFilter($filters,true,true);
8112
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8113
-		$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 
8111
+		$filter_query = $this->getFilter($filters, true, true);
8112
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8113
+		$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 
8114 8114
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8115 8115
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8116 8116
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8122,7 +8122,7 @@  discard block
 block discarded – undo
8122 8122
 		$airport_array = array();
8123 8123
 		$temp_array = array();
8124 8124
         
8125
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8125
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8126 8126
 		{
8127 8127
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8128 8128
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8143,12 +8143,12 @@  discard block
 block discarded – undo
8143 8143
 	* @return Array the airport list
8144 8144
 	*
8145 8145
 	*/
8146
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8146
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8147 8147
 	{
8148 8148
 		global $globalDBdriver;
8149
-		$filter_query = $this->getFilter($filters,true,true);
8150
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8151
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8149
+		$filter_query = $this->getFilter($filters, true, true);
8150
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8151
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8152 8152
 			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 
8153 8153
                     GROUP BY spotter_output.arrival_airport_country
8154 8154
 					ORDER BY airport_arrival_country_count DESC";
@@ -8160,7 +8160,7 @@  discard block
 block discarded – undo
8160 8160
 		$airport_array = array();
8161 8161
 		$temp_array = array();
8162 8162
         
8163
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8163
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8164 8164
 		{
8165 8165
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8166 8166
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8179,38 +8179,38 @@  discard block
 block discarded – undo
8179 8179
 	* @return Array the airport departure list
8180 8180
 	*
8181 8181
 	*/
8182
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8182
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8183 8183
 	{
8184 8184
 		global $globalDBdriver;
8185
-		$filter_query = $this->getFilter($filters,true,true);
8186
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8185
+		$filter_query = $this->getFilter($filters, true, true);
8186
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8187 8187
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8188 8188
 		$query_values = array();
8189 8189
 		if ($year != '') {
8190 8190
 			if ($globalDBdriver == 'mysql') {
8191 8191
 				$query .= " AND YEAR(spotter_output.date) = :year";
8192
-				$query_values = array_merge($query_values,array(':year' => $year));
8192
+				$query_values = array_merge($query_values, array(':year' => $year));
8193 8193
 			} else {
8194 8194
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8195
-				$query_values = array_merge($query_values,array(':year' => $year));
8195
+				$query_values = array_merge($query_values, array(':year' => $year));
8196 8196
 			}
8197 8197
 		}
8198 8198
 		if ($month != '') {
8199 8199
 			if ($globalDBdriver == 'mysql') {
8200 8200
 				$query .= " AND MONTH(spotter_output.date) = :month";
8201
-				$query_values = array_merge($query_values,array(':month' => $month));
8201
+				$query_values = array_merge($query_values, array(':month' => $month));
8202 8202
 			} else {
8203 8203
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8204
-				$query_values = array_merge($query_values,array(':month' => $month));
8204
+				$query_values = array_merge($query_values, array(':month' => $month));
8205 8205
 			}
8206 8206
 		}
8207 8207
 		if ($day != '') {
8208 8208
 			if ($globalDBdriver == 'mysql') {
8209 8209
 				$query .= " AND DAY(spotter_output.date) = :day";
8210
-				$query_values = array_merge($query_values,array(':day' => $day));
8210
+				$query_values = array_merge($query_values, array(':day' => $day));
8211 8211
 			} else {
8212 8212
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8213
-				$query_values = array_merge($query_values,array(':day' => $day));
8213
+				$query_values = array_merge($query_values, array(':day' => $day));
8214 8214
 			}
8215 8215
 		}
8216 8216
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -8224,7 +8224,7 @@  discard block
 block discarded – undo
8224 8224
 		$airport_array = array();
8225 8225
 		$temp_array = array();
8226 8226
         
8227
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8227
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8228 8228
 		{
8229 8229
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8230 8230
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8242,38 +8242,38 @@  discard block
 block discarded – undo
8242 8242
 	* @return Array the airport arrival list
8243 8243
 	*
8244 8244
 	*/
8245
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8245
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8246 8246
 	{
8247 8247
 		global $globalDBdriver;
8248
-		$filter_query = $this->getFilter($filters,true,true);
8249
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8248
+		$filter_query = $this->getFilter($filters, true, true);
8249
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8250 8250
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8251 8251
 		$query_values = array();
8252 8252
 		if ($year != '') {
8253 8253
 			if ($globalDBdriver == 'mysql') {
8254 8254
 				$query .= " AND YEAR(spotter_output.date) = :year";
8255
-				$query_values = array_merge($query_values,array(':year' => $year));
8255
+				$query_values = array_merge($query_values, array(':year' => $year));
8256 8256
 			} else {
8257 8257
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8258
-				$query_values = array_merge($query_values,array(':year' => $year));
8258
+				$query_values = array_merge($query_values, array(':year' => $year));
8259 8259
 			}
8260 8260
 		}
8261 8261
 		if ($month != '') {
8262 8262
 			if ($globalDBdriver == 'mysql') {
8263 8263
 				$query .= " AND MONTH(spotter_output.date) = :month";
8264
-				$query_values = array_merge($query_values,array(':month' => $month));
8264
+				$query_values = array_merge($query_values, array(':month' => $month));
8265 8265
 			} else {
8266 8266
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8267
-				$query_values = array_merge($query_values,array(':month' => $month));
8267
+				$query_values = array_merge($query_values, array(':month' => $month));
8268 8268
 			}
8269 8269
 		}
8270 8270
 		if ($day != '') {
8271 8271
 			if ($globalDBdriver == 'mysql') {
8272 8272
 				$query .= " AND DAY(spotter_output.date) = :day";
8273
-				$query_values = array_merge($query_values,array(':day' => $day));
8273
+				$query_values = array_merge($query_values, array(':day' => $day));
8274 8274
 			} else {
8275 8275
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8276
-				$query_values = array_merge($query_values,array(':day' => $day));
8276
+				$query_values = array_merge($query_values, array(':day' => $day));
8277 8277
 			}
8278 8278
 		}
8279 8279
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -8287,7 +8287,7 @@  discard block
 block discarded – undo
8287 8287
 		$airport_array = array();
8288 8288
 		$temp_array = array();
8289 8289
         
8290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8291 8291
 		{
8292 8292
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8293 8293
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8310,8 +8310,8 @@  discard block
 block discarded – undo
8310 8310
 	*/
8311 8311
 	public function countAllRoutes($filters = array())
8312 8312
 	{
8313
-		$filter_query = $this->getFilter($filters,true,true);
8314
-		$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
8313
+		$filter_query = $this->getFilter($filters, true, true);
8314
+		$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
8315 8315
 		    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 <> ''
8316 8316
                     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
8317 8317
                     ORDER BY route_count DESC
@@ -8324,7 +8324,7 @@  discard block
 block discarded – undo
8324 8324
 		$routes_array = array();
8325 8325
 		$temp_array = array();
8326 8326
         
8327
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8327
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8328 8328
 		{
8329 8329
 			$temp_array['route_count'] = $row['route_count'];
8330 8330
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8351,11 +8351,11 @@  discard block
 block discarded – undo
8351 8351
 	* @return Array the route list
8352 8352
 	*
8353 8353
 	*/
8354
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8354
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8355 8355
 	{
8356
-		$filter_query = $this->getFilter($filters,true,true);
8357
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8358
-		$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
8356
+		$filter_query = $this->getFilter($filters, true, true);
8357
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8358
+		$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
8359 8359
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8360 8360
 			    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 
8361 8361
 			    ORDER BY route_count DESC";
@@ -8366,7 +8366,7 @@  discard block
 block discarded – undo
8366 8366
 		$routes_array = array();
8367 8367
 		$temp_array = array();
8368 8368
         
8369
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8369
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8370 8370
 		{
8371 8371
 			$temp_array['route_count'] = $row['route_count'];
8372 8372
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8393,9 +8393,9 @@  discard block
 block discarded – undo
8393 8393
 	*/
8394 8394
 	public function countAllRoutesByRegistration($registration, $filters = array())
8395 8395
 	{
8396
-		$filter_query = $this->getFilter($filters,true,true);
8396
+		$filter_query = $this->getFilter($filters, true, true);
8397 8397
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8398
-		$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
8398
+		$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
8399 8399
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8400 8400
                     GROUP BY route
8401 8401
                     ORDER BY route_count DESC";
@@ -8407,7 +8407,7 @@  discard block
 block discarded – undo
8407 8407
 		$routes_array = array();
8408 8408
 		$temp_array = array();
8409 8409
         
8410
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8410
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8411 8411
 		{
8412 8412
 			$temp_array['route_count'] = $row['route_count'];
8413 8413
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8435,9 +8435,9 @@  discard block
 block discarded – undo
8435 8435
 	*/
8436 8436
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8437 8437
 	{
8438
-		$filter_query = $this->getFilter($filters,true,true);
8439
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8440
-		$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
8438
+		$filter_query = $this->getFilter($filters, true, true);
8439
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8440
+		$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
8441 8441
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8442 8442
 			    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 
8443 8443
 			    ORDER BY route_count DESC";
@@ -8449,7 +8449,7 @@  discard block
 block discarded – undo
8449 8449
 		$routes_array = array();
8450 8450
 		$temp_array = array();
8451 8451
         
8452
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8452
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8453 8453
 		{
8454 8454
 			$temp_array['route_count'] = $row['route_count'];
8455 8455
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8477,9 +8477,9 @@  discard block
 block discarded – undo
8477 8477
 	*/
8478 8478
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8479 8479
 	{
8480
-		$filter_query = $this->getFilter($filters,true,true);
8481
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8482
-		$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
8480
+		$filter_query = $this->getFilter($filters, true, true);
8481
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8482
+		$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
8483 8483
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8484 8484
 			    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 
8485 8485
 			    ORDER BY route_count DESC";
@@ -8490,7 +8490,7 @@  discard block
 block discarded – undo
8490 8490
 		$routes_array = array();
8491 8491
 		$temp_array = array();
8492 8492
         
8493
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8493
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8494 8494
 		{
8495 8495
 			$temp_array['route_count'] = $row['route_count'];
8496 8496
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8518,9 +8518,9 @@  discard block
 block discarded – undo
8518 8518
 	*/
8519 8519
 	public function countAllRoutesByCountry($country, $filters = array())
8520 8520
 	{
8521
-		$filter_query = $this->getFilter($filters,true,true);
8522
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8523
-		$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
8521
+		$filter_query = $this->getFilter($filters, true, true);
8522
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8523
+		$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
8524 8524
 			    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 
8525 8525
 			    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 
8526 8526
 			    ORDER BY route_count DESC";
@@ -8531,7 +8531,7 @@  discard block
 block discarded – undo
8531 8531
 		$routes_array = array();
8532 8532
 		$temp_array = array();
8533 8533
         
8534
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8534
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8535 8535
 		{
8536 8536
 			$temp_array['route_count'] = $row['route_count'];
8537 8537
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8559,8 +8559,8 @@  discard block
 block discarded – undo
8559 8559
 	public function countAllRoutesByDate($date, $filters = array())
8560 8560
 	{
8561 8561
 		global $globalTimezone, $globalDBdriver;
8562
-		$filter_query = $this->getFilter($filters,true,true);
8563
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8562
+		$filter_query = $this->getFilter($filters, true, true);
8563
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8564 8564
 		if ($globalTimezone != '') {
8565 8565
 			date_default_timezone_set($globalTimezone);
8566 8566
 			$datetime = new DateTime($date);
@@ -8568,12 +8568,12 @@  discard block
 block discarded – undo
8568 8568
 		} else $offset = '+00:00';
8569 8569
 		
8570 8570
 		if ($globalDBdriver == 'mysql') {
8571
-			$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
8571
+			$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
8572 8572
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8573 8573
 				    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
8574 8574
 				    ORDER BY route_count DESC";
8575 8575
 		} else {
8576
-			$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
8576
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
8577 8577
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8578 8578
 				    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
8579 8579
 				    ORDER BY route_count DESC";
@@ -8585,7 +8585,7 @@  discard block
 block discarded – undo
8585 8585
 		$routes_array = array();
8586 8586
 		$temp_array = array();
8587 8587
         
8588
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8588
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8589 8589
 		{
8590 8590
 			$temp_array['route_count'] = $row['route_count'];
8591 8591
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8612,9 +8612,9 @@  discard block
 block discarded – undo
8612 8612
 	*/
8613 8613
 	public function countAllRoutesByIdent($ident, $filters = array())
8614 8614
 	{
8615
-		$filter_query = $this->getFilter($filters,true,true);
8616
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8617
-		$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
8615
+		$filter_query = $this->getFilter($filters, true, true);
8616
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8617
+		$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
8618 8618
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
8619 8619
                     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
8620 8620
                     ORDER BY route_count DESC";
@@ -8626,7 +8626,7 @@  discard block
 block discarded – undo
8626 8626
 		$routes_array = array();
8627 8627
 		$temp_array = array();
8628 8628
         
8629
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8629
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8630 8630
 		{
8631 8631
 			$temp_array['route_count'] = $row['route_count'];
8632 8632
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8650,11 +8650,11 @@  discard block
 block discarded – undo
8650 8650
 	* @return Array the route list
8651 8651
 	*
8652 8652
 	*/
8653
-	public function countAllRoutesByOwner($owner,$filters = array())
8653
+	public function countAllRoutesByOwner($owner, $filters = array())
8654 8654
 	{
8655
-		$filter_query = $this->getFilter($filters,true,true);
8656
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8657
-		$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
8655
+		$filter_query = $this->getFilter($filters, true, true);
8656
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8657
+		$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
8658 8658
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
8659 8659
                     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
8660 8660
                     ORDER BY route_count DESC";
@@ -8666,7 +8666,7 @@  discard block
 block discarded – undo
8666 8666
 		$routes_array = array();
8667 8667
 		$temp_array = array();
8668 8668
         
8669
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8669
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8670 8670
 		{
8671 8671
 			$temp_array['route_count'] = $row['route_count'];
8672 8672
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8690,11 +8690,11 @@  discard block
 block discarded – undo
8690 8690
 	* @return Array the route list
8691 8691
 	*
8692 8692
 	*/
8693
-	public function countAllRoutesByPilot($pilot,$filters = array())
8693
+	public function countAllRoutesByPilot($pilot, $filters = array())
8694 8694
 	{
8695
-		$filter_query = $this->getFilter($filters,true,true);
8696
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8697
-		$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
8695
+		$filter_query = $this->getFilter($filters, true, true);
8696
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8697
+		$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
8698 8698
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8699 8699
                     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
8700 8700
                     ORDER BY route_count DESC";
@@ -8706,7 +8706,7 @@  discard block
 block discarded – undo
8706 8706
 		$routes_array = array();
8707 8707
 		$temp_array = array();
8708 8708
         
8709
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8709
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8710 8710
 		{
8711 8711
 			$temp_array['route_count'] = $row['route_count'];
8712 8712
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8733,9 +8733,9 @@  discard block
 block discarded – undo
8733 8733
 	*/
8734 8734
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
8735 8735
 	{
8736
-		$filter_query = $this->getFilter($filters,true,true);
8737
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8738
-		$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
8736
+		$filter_query = $this->getFilter($filters, true, true);
8737
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8738
+		$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
8739 8739
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
8740 8740
                     GROUP BY route
8741 8741
                     ORDER BY route_count DESC";
@@ -8747,7 +8747,7 @@  discard block
 block discarded – undo
8747 8747
 		$routes_array = array();
8748 8748
 		$temp_array = array();
8749 8749
         
8750
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8750
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8751 8751
 		{
8752 8752
 			$temp_array['route_count'] = $row['route_count'];
8753 8753
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8775,8 +8775,8 @@  discard block
 block discarded – undo
8775 8775
 	*/
8776 8776
 	public function countAllRoutesWithWaypoints($filters = array())
8777 8777
 	{
8778
-		$filter_query = $this->getFilter($filters,true,true);
8779
-		$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
8778
+		$filter_query = $this->getFilter($filters, true, true);
8779
+		$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
8780 8780
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
8781 8781
                     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
8782 8782
                     ORDER BY route_count DESC
@@ -8789,7 +8789,7 @@  discard block
 block discarded – undo
8789 8789
 		$routes_array = array();
8790 8790
 		$temp_array = array();
8791 8791
         
8792
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8792
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8793 8793
 		{
8794 8794
 			$temp_array['spotter_id'] = $row['spotter_id'];
8795 8795
 			$temp_array['route_count'] = $row['route_count'];
@@ -8814,11 +8814,11 @@  discard block
 block discarded – undo
8814 8814
 	* @return Array the callsign list
8815 8815
 	*
8816 8816
 	*/
8817
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
8817
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
8818 8818
 	{
8819 8819
 		global $globalDBdriver;
8820
-		$filter_query = $this->getFilter($filters,true,true);
8821
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8820
+		$filter_query = $this->getFilter($filters, true, true);
8821
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8822 8822
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
8823 8823
 		 if ($olderthanmonths > 0) {
8824 8824
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -8832,28 +8832,28 @@  discard block
 block discarded – undo
8832 8832
 		if ($year != '') {
8833 8833
 			if ($globalDBdriver == 'mysql') {
8834 8834
 				$query .= " AND YEAR(spotter_output.date) = :year";
8835
-				$query_values = array_merge($query_values,array(':year' => $year));
8835
+				$query_values = array_merge($query_values, array(':year' => $year));
8836 8836
 			} else {
8837 8837
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8838
-				$query_values = array_merge($query_values,array(':year' => $year));
8838
+				$query_values = array_merge($query_values, array(':year' => $year));
8839 8839
 			}
8840 8840
 		}
8841 8841
 		if ($month != '') {
8842 8842
 			if ($globalDBdriver == 'mysql') {
8843 8843
 				$query .= " AND MONTH(spotter_output.date) = :month";
8844
-				$query_values = array_merge($query_values,array(':month' => $month));
8844
+				$query_values = array_merge($query_values, array(':month' => $month));
8845 8845
 			} else {
8846 8846
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8847
-				$query_values = array_merge($query_values,array(':month' => $month));
8847
+				$query_values = array_merge($query_values, array(':month' => $month));
8848 8848
 			}
8849 8849
 		}
8850 8850
 		if ($day != '') {
8851 8851
 			if ($globalDBdriver == 'mysql') {
8852 8852
 				$query .= " AND DAY(spotter_output.date) = :day";
8853
-				$query_values = array_merge($query_values,array(':day' => $day));
8853
+				$query_values = array_merge($query_values, array(':day' => $day));
8854 8854
 			} else {
8855 8855
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8856
-				$query_values = array_merge($query_values,array(':day' => $day));
8856
+				$query_values = array_merge($query_values, array(':day' => $day));
8857 8857
 			}
8858 8858
 		}
8859 8859
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -8865,7 +8865,7 @@  discard block
 block discarded – undo
8865 8865
 		$callsign_array = array();
8866 8866
 		$temp_array = array();
8867 8867
         
8868
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8868
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8869 8869
 		{
8870 8870
 			$temp_array['callsign_icao'] = $row['ident'];
8871 8871
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -8887,8 +8887,8 @@  discard block
 block discarded – undo
8887 8887
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
8888 8888
 	{
8889 8889
 		global $globalDBdriver;
8890
-		$filter_query = $this->getFilter($filters,true,true);
8891
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8890
+		$filter_query = $this->getFilter($filters, true, true);
8891
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8892 8892
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8893 8893
 		 if ($olderthanmonths > 0) {
8894 8894
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -8907,7 +8907,7 @@  discard block
 block discarded – undo
8907 8907
 		$callsign_array = array();
8908 8908
 		$temp_array = array();
8909 8909
         
8910
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8910
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8911 8911
 		{
8912 8912
 			$temp_array['callsign_icao'] = $row['ident'];
8913 8913
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -8961,7 +8961,7 @@  discard block
 block discarded – undo
8961 8961
 		$date_array = array();
8962 8962
 		$temp_array = array();
8963 8963
         
8964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8965 8965
 		{
8966 8966
 			$temp_array['date_name'] = $row['date_name'];
8967 8967
 			$temp_array['date_count'] = $row['date_count'];
@@ -8986,15 +8986,15 @@  discard block
 block discarded – undo
8986 8986
 			$datetime = new DateTime();
8987 8987
 			$offset = $datetime->format('P');
8988 8988
 		} else $offset = '+00:00';
8989
-		$filter_query = $this->getFilter($filters,true,true);
8989
+		$filter_query = $this->getFilter($filters, true, true);
8990 8990
 		if ($globalDBdriver == 'mysql') {
8991
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8991
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8992 8992
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8993 8993
 								GROUP BY spotter_output.airline_icao, date_name 
8994 8994
 								ORDER BY date_count DESC
8995 8995
 								LIMIT 10 OFFSET 0";
8996 8996
 		} else {
8997
-			$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
8997
+			$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
8998 8998
 								FROM spotter_output 
8999 8999
 								WHERE spotter_output.airline_icao <> '' 
9000 9000
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9009,7 +9009,7 @@  discard block
 block discarded – undo
9009 9009
 		$date_array = array();
9010 9010
 		$temp_array = array();
9011 9011
         
9012
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9012
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9013 9013
 		{
9014 9014
 			$temp_array['date_name'] = $row['date_name'];
9015 9015
 			$temp_array['date_count'] = $row['date_count'];
@@ -9035,7 +9035,7 @@  discard block
 block discarded – undo
9035 9035
 			$datetime = new DateTime();
9036 9036
 			$offset = $datetime->format('P');
9037 9037
 		} else $offset = '+00:00';
9038
-		$filter_query = $this->getFilter($filters,true,true);
9038
+		$filter_query = $this->getFilter($filters, true, true);
9039 9039
 		if ($globalDBdriver == 'mysql') {
9040 9040
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9041 9041
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9056,7 +9056,7 @@  discard block
 block discarded – undo
9056 9056
 		$date_array = array();
9057 9057
 		$temp_array = array();
9058 9058
         
9059
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9059
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9060 9060
 		{
9061 9061
 			$temp_array['date_name'] = $row['date_name'];
9062 9062
 			$temp_array['date_count'] = $row['date_count'];
@@ -9081,7 +9081,7 @@  discard block
 block discarded – undo
9081 9081
 			$datetime = new DateTime();
9082 9082
 			$offset = $datetime->format('P');
9083 9083
 		} else $offset = '+00:00';
9084
-		$filter_query = $this->getFilter($filters,true,true);
9084
+		$filter_query = $this->getFilter($filters, true, true);
9085 9085
 		if ($globalDBdriver == 'mysql') {
9086 9086
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9087 9087
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9102,7 +9102,7 @@  discard block
 block discarded – undo
9102 9102
 		$date_array = array();
9103 9103
 		$temp_array = array();
9104 9104
         
9105
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9105
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9106 9106
 		{
9107 9107
 			$temp_array['date_name'] = $row['date_name'];
9108 9108
 			$temp_array['date_count'] = $row['date_count'];
@@ -9123,7 +9123,7 @@  discard block
 block discarded – undo
9123 9123
 	public function countAllDatesLastMonthByAirlines($filters = array())
9124 9124
 	{
9125 9125
 		global $globalTimezone, $globalDBdriver;
9126
-		$filter_query = $this->getFilter($filters,true,true);
9126
+		$filter_query = $this->getFilter($filters, true, true);
9127 9127
 		if ($globalTimezone != '') {
9128 9128
 			date_default_timezone_set($globalTimezone);
9129 9129
 			$datetime = new DateTime();
@@ -9131,13 +9131,13 @@  discard block
 block discarded – undo
9131 9131
 		} else $offset = '+00:00';
9132 9132
 		
9133 9133
 		if ($globalDBdriver == 'mysql') {
9134
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9134
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9135 9135
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9136 9136
 								GROUP BY spotter_output.airline_icao, date_name 
9137 9137
 								ORDER BY spotter_output.date ASC";
9138 9138
 			$query_data = array(':offset' => $offset);
9139 9139
 		} else {
9140
-			$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
9140
+			$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
9141 9141
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9142 9142
 								GROUP BY spotter_output.airline_icao, date_name 
9143 9143
 								ORDER BY date_name ASC";
@@ -9150,7 +9150,7 @@  discard block
 block discarded – undo
9150 9150
 		$date_array = array();
9151 9151
 		$temp_array = array();
9152 9152
         
9153
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9153
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9154 9154
 		{
9155 9155
 			$temp_array['date_name'] = $row['date_name'];
9156 9156
 			$temp_array['date_count'] = $row['date_count'];
@@ -9197,7 +9197,7 @@  discard block
 block discarded – undo
9197 9197
 		$date_array = array();
9198 9198
 		$temp_array = array();
9199 9199
         
9200
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9200
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9201 9201
 		{
9202 9202
 			$temp_array['month_name'] = $row['month_name'];
9203 9203
 			$temp_array['year_name'] = $row['year_name'];
@@ -9218,7 +9218,7 @@  discard block
 block discarded – undo
9218 9218
 	public function countAllMonthsByAirlines($filters = array())
9219 9219
 	{
9220 9220
 		global $globalTimezone, $globalDBdriver;
9221
-		$filter_query = $this->getFilter($filters,true,true);
9221
+		$filter_query = $this->getFilter($filters, true, true);
9222 9222
 		if ($globalTimezone != '') {
9223 9223
 			date_default_timezone_set($globalTimezone);
9224 9224
 			$datetime = new DateTime();
@@ -9226,12 +9226,12 @@  discard block
 block discarded – undo
9226 9226
 		} else $offset = '+00:00';
9227 9227
 
9228 9228
 		if ($globalDBdriver == 'mysql') {
9229
-			$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
9229
+			$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
9230 9230
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9231 9231
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9232 9232
 								ORDER BY date_count DESC";
9233 9233
 		} else {
9234
-			$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
9234
+			$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
9235 9235
 								FROM spotter_output 
9236 9236
 								WHERE spotter_output.airline_icao <> '' 
9237 9237
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9245,7 +9245,7 @@  discard block
 block discarded – undo
9245 9245
 		$date_array = array();
9246 9246
 		$temp_array = array();
9247 9247
         
9248
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9248
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9249 9249
 		{
9250 9250
 			$temp_array['month_name'] = $row['month_name'];
9251 9251
 			$temp_array['year_name'] = $row['year_name'];
@@ -9272,14 +9272,14 @@  discard block
 block discarded – undo
9272 9272
 			$datetime = new DateTime();
9273 9273
 			$offset = $datetime->format('P');
9274 9274
 		} else $offset = '+00:00';
9275
-		$filter_query = $this->getFilter($filters,true,true);
9275
+		$filter_query = $this->getFilter($filters, true, true);
9276 9276
 		if ($globalDBdriver == 'mysql') {
9277
-			$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
9277
+			$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
9278 9278
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9279 9279
 								GROUP BY year_name, month_name 
9280 9280
 								ORDER BY date_count DESC";
9281 9281
 		} else {
9282
-			$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
9282
+			$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
9283 9283
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9284 9284
 								GROUP BY year_name, month_name 
9285 9285
 								ORDER BY date_count DESC";
@@ -9291,7 +9291,7 @@  discard block
 block discarded – undo
9291 9291
 		$date_array = array();
9292 9292
 		$temp_array = array();
9293 9293
         
9294
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9294
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9295 9295
 		{
9296 9296
 			$temp_array['month_name'] = $row['month_name'];
9297 9297
 			$temp_array['year_name'] = $row['year_name'];
@@ -9317,15 +9317,15 @@  discard block
 block discarded – undo
9317 9317
 			$datetime = new DateTime();
9318 9318
 			$offset = $datetime->format('P');
9319 9319
 		} else $offset = '+00:00';
9320
-		$filter_query = $this->getFilter($filters,true,true);
9320
+		$filter_query = $this->getFilter($filters, true, true);
9321 9321
 
9322 9322
 		if ($globalDBdriver == 'mysql') {
9323
-			$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
9323
+			$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
9324 9324
 								FROM spotter_output".$filter_query." owner_name <> ''
9325 9325
 								GROUP BY year_name, month_name
9326 9326
 								ORDER BY date_count DESC";
9327 9327
 		} else {
9328
-			$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
9328
+			$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
9329 9329
 								FROM spotter_output".$filter_query." owner_name <> ''
9330 9330
 								GROUP BY year_name, month_name
9331 9331
 								ORDER BY date_count DESC";
@@ -9337,7 +9337,7 @@  discard block
 block discarded – undo
9337 9337
 		$date_array = array();
9338 9338
 		$temp_array = array();
9339 9339
         
9340
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9340
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9341 9341
 		{
9342 9342
 			$temp_array['month_name'] = $row['month_name'];
9343 9343
 			$temp_array['year_name'] = $row['year_name'];
@@ -9358,7 +9358,7 @@  discard block
 block discarded – undo
9358 9358
 	public function countAllMonthsOwnersByAirlines($filters = array())
9359 9359
 	{
9360 9360
 		global $globalTimezone, $globalDBdriver;
9361
-		$filter_query = $this->getFilter($filters,true,true);
9361
+		$filter_query = $this->getFilter($filters, true, true);
9362 9362
 		if ($globalTimezone != '') {
9363 9363
 			date_default_timezone_set($globalTimezone);
9364 9364
 			$datetime = new DateTime();
@@ -9366,12 +9366,12 @@  discard block
 block discarded – undo
9366 9366
 		} else $offset = '+00:00';
9367 9367
 
9368 9368
 		if ($globalDBdriver == 'mysql') {
9369
-			$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
9369
+			$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
9370 9370
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9371 9371
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9372 9372
 								ORDER BY date_count DESC";
9373 9373
 		} else {
9374
-			$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
9374
+			$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
9375 9375
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9376 9376
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9377 9377
 								ORDER BY date_count DESC";
@@ -9383,7 +9383,7 @@  discard block
 block discarded – undo
9383 9383
 		$date_array = array();
9384 9384
 		$temp_array = array();
9385 9385
         
9386
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9386
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9387 9387
 		{
9388 9388
 			$temp_array['month_name'] = $row['month_name'];
9389 9389
 			$temp_array['year_name'] = $row['year_name'];
@@ -9410,15 +9410,15 @@  discard block
 block discarded – undo
9410 9410
 			$datetime = new DateTime();
9411 9411
 			$offset = $datetime->format('P');
9412 9412
 		} else $offset = '+00:00';
9413
-		$filter_query = $this->getFilter($filters,true,true);
9413
+		$filter_query = $this->getFilter($filters, true, true);
9414 9414
 
9415 9415
 		if ($globalDBdriver == 'mysql') {
9416
-			$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
9416
+			$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
9417 9417
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9418 9418
 								GROUP BY year_name, month_name
9419 9419
 								ORDER BY date_count DESC";
9420 9420
 		} else {
9421
-			$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
9421
+			$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
9422 9422
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9423 9423
 								GROUP BY year_name, month_name
9424 9424
 								ORDER BY date_count DESC";
@@ -9430,7 +9430,7 @@  discard block
 block discarded – undo
9430 9430
 		$date_array = array();
9431 9431
 		$temp_array = array();
9432 9432
         
9433
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9433
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9434 9434
 		{
9435 9435
 			$temp_array['month_name'] = $row['month_name'];
9436 9436
 			$temp_array['year_name'] = $row['year_name'];
@@ -9451,7 +9451,7 @@  discard block
 block discarded – undo
9451 9451
 	public function countAllMonthsPilotsByAirlines($filters = array())
9452 9452
 	{
9453 9453
 		global $globalTimezone, $globalDBdriver;
9454
-		$filter_query = $this->getFilter($filters,true,true);
9454
+		$filter_query = $this->getFilter($filters, true, true);
9455 9455
 		if ($globalTimezone != '') {
9456 9456
 			date_default_timezone_set($globalTimezone);
9457 9457
 			$datetime = new DateTime();
@@ -9459,12 +9459,12 @@  discard block
 block discarded – undo
9459 9459
 		} else $offset = '+00:00';
9460 9460
 
9461 9461
 		if ($globalDBdriver == 'mysql') {
9462
-			$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
9462
+			$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
9463 9463
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9464 9464
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9465 9465
 								ORDER BY date_count DESC";
9466 9466
 		} else {
9467
-			$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
9467
+			$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
9468 9468
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9469 9469
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9470 9470
 								ORDER BY date_count DESC";
@@ -9476,7 +9476,7 @@  discard block
 block discarded – undo
9476 9476
 		$date_array = array();
9477 9477
 		$temp_array = array();
9478 9478
         
9479
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9479
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9480 9480
 		{
9481 9481
 			$temp_array['month_name'] = $row['month_name'];
9482 9482
 			$temp_array['year_name'] = $row['year_name'];
@@ -9498,7 +9498,7 @@  discard block
 block discarded – undo
9498 9498
 	public function countAllMonthsAirlines($filters = array())
9499 9499
 	{
9500 9500
 		global $globalTimezone, $globalDBdriver;
9501
-		$filter_query = $this->getFilter($filters,true,true);
9501
+		$filter_query = $this->getFilter($filters, true, true);
9502 9502
 		if ($globalTimezone != '') {
9503 9503
 			date_default_timezone_set($globalTimezone);
9504 9504
 			$datetime = new DateTime();
@@ -9506,12 +9506,12 @@  discard block
 block discarded – undo
9506 9506
 		} else $offset = '+00:00';
9507 9507
 
9508 9508
 		if ($globalDBdriver == 'mysql') {
9509
-			$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
9509
+			$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
9510 9510
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9511 9511
 								GROUP BY year_name, month_name
9512 9512
 								ORDER BY date_count DESC";
9513 9513
 		} else {
9514
-			$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
9514
+			$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
9515 9515
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9516 9516
 								GROUP BY year_name, month_name
9517 9517
 								ORDER BY date_count DESC";
@@ -9523,7 +9523,7 @@  discard block
 block discarded – undo
9523 9523
 		$date_array = array();
9524 9524
 		$temp_array = array();
9525 9525
         
9526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9527 9527
 		{
9528 9528
 			$temp_array['month_name'] = $row['month_name'];
9529 9529
 			$temp_array['year_name'] = $row['year_name'];
@@ -9549,15 +9549,15 @@  discard block
 block discarded – undo
9549 9549
 			$datetime = new DateTime();
9550 9550
 			$offset = $datetime->format('P');
9551 9551
 		} else $offset = '+00:00';
9552
-		$filter_query = $this->getFilter($filters,true,true);
9552
+		$filter_query = $this->getFilter($filters, true, true);
9553 9553
 
9554 9554
 		if ($globalDBdriver == 'mysql') {
9555
-			$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
9555
+			$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
9556 9556
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9557 9557
 								GROUP BY year_name, month_name
9558 9558
 								ORDER BY date_count DESC";
9559 9559
 		} else {
9560
-			$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
9560
+			$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
9561 9561
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9562 9562
 								GROUP BY year_name, month_name
9563 9563
 								ORDER BY date_count DESC";
@@ -9569,7 +9569,7 @@  discard block
 block discarded – undo
9569 9569
 		$date_array = array();
9570 9570
 		$temp_array = array();
9571 9571
         
9572
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9572
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9573 9573
 		{
9574 9574
 			$temp_array['month_name'] = $row['month_name'];
9575 9575
 			$temp_array['year_name'] = $row['year_name'];
@@ -9591,7 +9591,7 @@  discard block
 block discarded – undo
9591 9591
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9592 9592
 	{
9593 9593
 		global $globalTimezone, $globalDBdriver;
9594
-		$filter_query = $this->getFilter($filters,true,true);
9594
+		$filter_query = $this->getFilter($filters, true, true);
9595 9595
 		if ($globalTimezone != '') {
9596 9596
 			date_default_timezone_set($globalTimezone);
9597 9597
 			$datetime = new DateTime();
@@ -9599,12 +9599,12 @@  discard block
 block discarded – undo
9599 9599
 		} else $offset = '+00:00';
9600 9600
 
9601 9601
 		if ($globalDBdriver == 'mysql') {
9602
-			$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
9602
+			$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
9603 9603
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
9604 9604
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9605 9605
 								ORDER BY date_count DESC";
9606 9606
 		} else {
9607
-			$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
9607
+			$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
9608 9608
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
9609 9609
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9610 9610
 								ORDER BY date_count DESC";
@@ -9616,7 +9616,7 @@  discard block
 block discarded – undo
9616 9616
 		$date_array = array();
9617 9617
 		$temp_array = array();
9618 9618
         
9619
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9619
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9620 9620
 		{
9621 9621
 			$temp_array['month_name'] = $row['month_name'];
9622 9622
 			$temp_array['year_name'] = $row['year_name'];
@@ -9643,15 +9643,15 @@  discard block
 block discarded – undo
9643 9643
 			$datetime = new DateTime();
9644 9644
 			$offset = $datetime->format('P');
9645 9645
 		} else $offset = '+00:00';
9646
-		$filter_query = $this->getFilter($filters,true,true);
9646
+		$filter_query = $this->getFilter($filters, true, true);
9647 9647
 
9648 9648
 		if ($globalDBdriver == 'mysql') {
9649
-			$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
9649
+			$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
9650 9650
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9651 9651
 								GROUP BY year_name, month_name
9652 9652
 								ORDER BY date_count DESC";
9653 9653
 		} else {
9654
-			$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
9654
+			$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
9655 9655
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
9656 9656
 								GROUP BY year_name, month_name
9657 9657
 								ORDER BY date_count DESC";
@@ -9663,7 +9663,7 @@  discard block
 block discarded – undo
9663 9663
 		$date_array = array();
9664 9664
 		$temp_array = array();
9665 9665
         
9666
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9666
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9667 9667
 		{
9668 9668
 			$temp_array['month_name'] = $row['month_name'];
9669 9669
 			$temp_array['year_name'] = $row['year_name'];
@@ -9685,7 +9685,7 @@  discard block
 block discarded – undo
9685 9685
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
9686 9686
 	{
9687 9687
 		global $globalTimezone, $globalDBdriver;
9688
-		$filter_query = $this->getFilter($filters,true,true);
9688
+		$filter_query = $this->getFilter($filters, true, true);
9689 9689
 		if ($globalTimezone != '') {
9690 9690
 			date_default_timezone_set($globalTimezone);
9691 9691
 			$datetime = new DateTime();
@@ -9693,12 +9693,12 @@  discard block
 block discarded – undo
9693 9693
 		} else $offset = '+00:00';
9694 9694
 
9695 9695
 		if ($globalDBdriver == 'mysql') {
9696
-			$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
9696
+			$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
9697 9697
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9698 9698
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9699 9699
 								ORDER BY date_count DESC";
9700 9700
 		} else {
9701
-			$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
9701
+			$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
9702 9702
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
9703 9703
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9704 9704
 								ORDER BY date_count DESC";
@@ -9710,7 +9710,7 @@  discard block
 block discarded – undo
9710 9710
 		$date_array = array();
9711 9711
 		$temp_array = array();
9712 9712
         
9713
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9713
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9714 9714
 		{
9715 9715
 			$temp_array['month_name'] = $row['month_name'];
9716 9716
 			$temp_array['year_name'] = $row['year_name'];
@@ -9738,7 +9738,7 @@  discard block
 block discarded – undo
9738 9738
 			$datetime = new DateTime();
9739 9739
 			$offset = $datetime->format('P');
9740 9740
 		} else $offset = '+00:00';
9741
-		$filter_query = $this->getFilter($filters,true,true);
9741
+		$filter_query = $this->getFilter($filters, true, true);
9742 9742
 		if ($globalDBdriver == 'mysql') {
9743 9743
 			$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
9744 9744
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -9759,7 +9759,7 @@  discard block
 block discarded – undo
9759 9759
 		$date_array = array();
9760 9760
 		$temp_array = array();
9761 9761
         
9762
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9762
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9763 9763
 		{
9764 9764
 			$temp_array['year_name'] = $row['year_name'];
9765 9765
 			$temp_array['month_name'] = $row['month_name'];
@@ -9779,7 +9779,7 @@  discard block
 block discarded – undo
9779 9779
 	* @return Array the hour list
9780 9780
 	*
9781 9781
 	*/
9782
-	public function countAllHours($orderby,$filters = array())
9782
+	public function countAllHours($orderby, $filters = array())
9783 9783
 	{
9784 9784
 		global $globalTimezone, $globalDBdriver;
9785 9785
 		if ($globalTimezone != '') {
@@ -9827,7 +9827,7 @@  discard block
 block discarded – undo
9827 9827
 		$hour_array = array();
9828 9828
 		$temp_array = array();
9829 9829
         
9830
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9830
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9831 9831
 		{
9832 9832
 			$temp_array['hour_name'] = $row['hour_name'];
9833 9833
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9847,7 +9847,7 @@  discard block
 block discarded – undo
9847 9847
 	public function countAllHoursByAirlines($orderby, $filters = array())
9848 9848
 	{
9849 9849
 		global $globalTimezone, $globalDBdriver;
9850
-		$filter_query = $this->getFilter($filters,true,true);
9850
+		$filter_query = $this->getFilter($filters, true, true);
9851 9851
 		if ($globalTimezone != '') {
9852 9852
 			date_default_timezone_set($globalTimezone);
9853 9853
 			$datetime = new DateTime();
@@ -9865,7 +9865,7 @@  discard block
 block discarded – undo
9865 9865
 		}
9866 9866
 		
9867 9867
 		if ($globalDBdriver == 'mysql') {
9868
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9868
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9869 9869
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9870 9870
 								GROUP BY spotter_output.airline_icao, hour_name 
9871 9871
 								".$orderby_sql;
@@ -9878,7 +9878,7 @@  discard block
 block discarded – undo
9878 9878
   */    
9879 9879
 		$query_data = array(':offset' => $offset);
9880 9880
 		} else {
9881
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9881
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9882 9882
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9883 9883
 								GROUP BY spotter_output.airline_icao, hour_name 
9884 9884
 								".$orderby_sql;
@@ -9891,7 +9891,7 @@  discard block
 block discarded – undo
9891 9891
 		$hour_array = array();
9892 9892
 		$temp_array = array();
9893 9893
         
9894
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9894
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9895 9895
 		{
9896 9896
 			$temp_array['hour_name'] = $row['hour_name'];
9897 9897
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9914,34 +9914,34 @@  discard block
 block discarded – undo
9914 9914
 	public function countAllHoursByAirline($airline_icao, $filters = array())
9915 9915
 	{
9916 9916
 		global $globalTimezone, $globalDBdriver;
9917
-		$filter_query = $this->getFilter($filters,true,true);
9917
+		$filter_query = $this->getFilter($filters, true, true);
9918 9918
 		if ($globalTimezone != '') {
9919 9919
 			date_default_timezone_set($globalTimezone);
9920 9920
 			$datetime = new DateTime();
9921 9921
 			$offset = $datetime->format('P');
9922 9922
 		} else $offset = '+00:00';
9923 9923
 
9924
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9924
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
9925 9925
 
9926 9926
 		if ($globalDBdriver == 'mysql') {
9927
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9927
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9928 9928
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9929 9929
 								GROUP BY hour_name 
9930 9930
 								ORDER BY hour_name ASC";
9931 9931
 		} else {
9932
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9932
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9933 9933
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
9934 9934
 								GROUP BY hour_name 
9935 9935
 								ORDER BY hour_name ASC";
9936 9936
 		}
9937 9937
 		
9938 9938
 		$sth = $this->db->prepare($query);
9939
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
9939
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
9940 9940
       
9941 9941
 		$hour_array = array();
9942 9942
 		$temp_array = array();
9943 9943
         
9944
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9944
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9945 9945
 		{
9946 9946
 			$temp_array['hour_name'] = $row['hour_name'];
9947 9947
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9964,8 +9964,8 @@  discard block
 block discarded – undo
9964 9964
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
9965 9965
 	{
9966 9966
 		global $globalTimezone, $globalDBdriver;
9967
-		$filter_query = $this->getFilter($filters,true,true);
9968
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
9967
+		$filter_query = $this->getFilter($filters, true, true);
9968
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
9969 9969
 		if ($globalTimezone != '') {
9970 9970
 			date_default_timezone_set($globalTimezone);
9971 9971
 			$datetime = new DateTime();
@@ -9973,24 +9973,24 @@  discard block
 block discarded – undo
9973 9973
 		} else $offset = '+00:00';
9974 9974
 
9975 9975
 		if ($globalDBdriver == 'mysql') {
9976
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9976
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9977 9977
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
9978 9978
 								GROUP BY hour_name 
9979 9979
 								ORDER BY hour_name ASC";
9980 9980
 		} else {
9981
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9981
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9982 9982
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
9983 9983
 								GROUP BY hour_name 
9984 9984
 								ORDER BY hour_name ASC";
9985 9985
 		}
9986 9986
 		
9987 9987
 		$sth = $this->db->prepare($query);
9988
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
9988
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
9989 9989
       
9990 9990
 		$hour_array = array();
9991 9991
 		$temp_array = array();
9992 9992
         
9993
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9993
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9994 9994
 		{
9995 9995
 			$temp_array['hour_name'] = $row['hour_name'];
9996 9996
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10011,8 +10011,8 @@  discard block
 block discarded – undo
10011 10011
 	public function countAllHoursByRegistration($registration, $filters = array())
10012 10012
 	{
10013 10013
 		global $globalTimezone, $globalDBdriver;
10014
-		$filter_query = $this->getFilter($filters,true,true);
10015
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10014
+		$filter_query = $this->getFilter($filters, true, true);
10015
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10016 10016
 		if ($globalTimezone != '') {
10017 10017
 			date_default_timezone_set($globalTimezone);
10018 10018
 			$datetime = new DateTime();
@@ -10020,24 +10020,24 @@  discard block
 block discarded – undo
10020 10020
 		} else $offset = '+00:00';
10021 10021
 
10022 10022
 		if ($globalDBdriver == 'mysql') {
10023
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10023
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10024 10024
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10025 10025
 								GROUP BY hour_name 
10026 10026
 								ORDER BY hour_name ASC";
10027 10027
 		} else {
10028
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10028
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10029 10029
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10030 10030
 								GROUP BY hour_name 
10031 10031
 								ORDER BY hour_name ASC";
10032 10032
 		}
10033 10033
 		
10034 10034
 		$sth = $this->db->prepare($query);
10035
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10035
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10036 10036
       
10037 10037
 		$hour_array = array();
10038 10038
 		$temp_array = array();
10039 10039
         
10040
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10040
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10041 10041
 		{
10042 10042
 			$temp_array['hour_name'] = $row['hour_name'];
10043 10043
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10058,8 +10058,8 @@  discard block
 block discarded – undo
10058 10058
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10059 10059
 	{
10060 10060
 		global $globalTimezone, $globalDBdriver;
10061
-		$filter_query = $this->getFilter($filters,true,true);
10062
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10061
+		$filter_query = $this->getFilter($filters, true, true);
10062
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10063 10063
 		if ($globalTimezone != '') {
10064 10064
 			date_default_timezone_set($globalTimezone);
10065 10065
 			$datetime = new DateTime();
@@ -10067,24 +10067,24 @@  discard block
 block discarded – undo
10067 10067
 		} else $offset = '+00:00';
10068 10068
 
10069 10069
 		if ($globalDBdriver == 'mysql') {
10070
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10070
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10071 10071
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10072 10072
 								GROUP BY hour_name 
10073 10073
 								ORDER BY hour_name ASC";
10074 10074
 		} else {
10075
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10075
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10076 10076
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10077 10077
 								GROUP BY hour_name 
10078 10078
 								ORDER BY hour_name ASC";
10079 10079
 		}
10080 10080
 		
10081 10081
 		$sth = $this->db->prepare($query);
10082
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10082
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10083 10083
       
10084 10084
 		$hour_array = array();
10085 10085
 		$temp_array = array();
10086 10086
         
10087
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10087
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10088 10088
 		{
10089 10089
 			$temp_array['hour_name'] = $row['hour_name'];
10090 10090
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10103,11 +10103,11 @@  discard block
 block discarded – undo
10103 10103
 	* @return Array the hour list
10104 10104
 	*
10105 10105
 	*/
10106
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10106
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10107 10107
 	{
10108 10108
 		global $globalTimezone, $globalDBdriver;
10109
-		$filter_query = $this->getFilter($filters,true,true);
10110
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10109
+		$filter_query = $this->getFilter($filters, true, true);
10110
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10111 10111
 		if ($globalTimezone != '') {
10112 10112
 			date_default_timezone_set($globalTimezone);
10113 10113
 			$datetime = new DateTime();
@@ -10115,24 +10115,24 @@  discard block
 block discarded – undo
10115 10115
 		} else $offset = '+00:00';
10116 10116
 
10117 10117
 		if ($globalDBdriver == 'mysql') {
10118
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10118
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10119 10119
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10120 10120
 								GROUP BY hour_name 
10121 10121
 								ORDER BY hour_name ASC";
10122 10122
 		} else {
10123
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10123
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10124 10124
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10125 10125
 								GROUP BY hour_name 
10126 10126
 								ORDER BY hour_name ASC";
10127 10127
 		}
10128 10128
 		
10129 10129
 		$sth = $this->db->prepare($query);
10130
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10130
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10131 10131
       
10132 10132
 		$hour_array = array();
10133 10133
 		$temp_array = array();
10134 10134
         
10135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10136 10136
 		{
10137 10137
 			$temp_array['hour_name'] = $row['hour_name'];
10138 10138
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10154,8 +10154,8 @@  discard block
 block discarded – undo
10154 10154
 	public function countAllHoursByDate($date, $filters = array())
10155 10155
 	{
10156 10156
 		global $globalTimezone, $globalDBdriver;
10157
-		$filter_query = $this->getFilter($filters,true,true);
10158
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10157
+		$filter_query = $this->getFilter($filters, true, true);
10158
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10159 10159
 		if ($globalTimezone != '') {
10160 10160
 			date_default_timezone_set($globalTimezone);
10161 10161
 			$datetime = new DateTime($date);
@@ -10163,12 +10163,12 @@  discard block
 block discarded – undo
10163 10163
 		} else $offset = '+00:00';
10164 10164
 
10165 10165
 		if ($globalDBdriver == 'mysql') {
10166
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10166
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10167 10167
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10168 10168
 								GROUP BY hour_name 
10169 10169
 								ORDER BY hour_name ASC";
10170 10170
 		} else {
10171
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10171
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10172 10172
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10173 10173
 								GROUP BY hour_name 
10174 10174
 								ORDER BY hour_name ASC";
@@ -10180,7 +10180,7 @@  discard block
 block discarded – undo
10180 10180
 		$hour_array = array();
10181 10181
 		$temp_array = array();
10182 10182
         
10183
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10183
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10184 10184
 		{
10185 10185
 			$temp_array['hour_name'] = $row['hour_name'];
10186 10186
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10202,8 +10202,8 @@  discard block
 block discarded – undo
10202 10202
 	public function countAllHoursByIdent($ident, $filters = array())
10203 10203
 	{
10204 10204
 		global $globalTimezone, $globalDBdriver;
10205
-		$filter_query = $this->getFilter($filters,true,true);
10206
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10205
+		$filter_query = $this->getFilter($filters, true, true);
10206
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10207 10207
 		if ($globalTimezone != '') {
10208 10208
 			date_default_timezone_set($globalTimezone);
10209 10209
 			$datetime = new DateTime();
@@ -10211,12 +10211,12 @@  discard block
 block discarded – undo
10211 10211
 		} else $offset = '+00:00';
10212 10212
 
10213 10213
 		if ($globalDBdriver == 'mysql') {
10214
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10214
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10215 10215
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10216 10216
 								GROUP BY hour_name 
10217 10217
 								ORDER BY hour_name ASC";
10218 10218
 		} else {
10219
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10219
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10220 10220
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10221 10221
 								GROUP BY hour_name 
10222 10222
 								ORDER BY hour_name ASC";
@@ -10224,12 +10224,12 @@  discard block
 block discarded – undo
10224 10224
       
10225 10225
 		
10226 10226
 		$sth = $this->db->prepare($query);
10227
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10227
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10228 10228
       
10229 10229
 		$hour_array = array();
10230 10230
 		$temp_array = array();
10231 10231
         
10232
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10232
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10233 10233
 		{
10234 10234
 			$temp_array['hour_name'] = $row['hour_name'];
10235 10235
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10249,8 +10249,8 @@  discard block
 block discarded – undo
10249 10249
 	public function countAllHoursByOwner($owner, $filters = array())
10250 10250
 	{
10251 10251
 		global $globalTimezone, $globalDBdriver;
10252
-		$filter_query = $this->getFilter($filters,true,true);
10253
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10252
+		$filter_query = $this->getFilter($filters, true, true);
10253
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10254 10254
 		if ($globalTimezone != '') {
10255 10255
 			date_default_timezone_set($globalTimezone);
10256 10256
 			$datetime = new DateTime();
@@ -10258,12 +10258,12 @@  discard block
 block discarded – undo
10258 10258
 		} else $offset = '+00:00';
10259 10259
 
10260 10260
 		if ($globalDBdriver == 'mysql') {
10261
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10261
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10262 10262
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10263 10263
 								GROUP BY hour_name 
10264 10264
 								ORDER BY hour_name ASC";
10265 10265
 		} else {
10266
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10266
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10267 10267
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10268 10268
 								GROUP BY hour_name 
10269 10269
 								ORDER BY hour_name ASC";
@@ -10271,12 +10271,12 @@  discard block
 block discarded – undo
10271 10271
       
10272 10272
 		
10273 10273
 		$sth = $this->db->prepare($query);
10274
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10274
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10275 10275
       
10276 10276
 		$hour_array = array();
10277 10277
 		$temp_array = array();
10278 10278
         
10279
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10279
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10280 10280
 		{
10281 10281
 			$temp_array['hour_name'] = $row['hour_name'];
10282 10282
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10296,8 +10296,8 @@  discard block
 block discarded – undo
10296 10296
 	public function countAllHoursByPilot($pilot, $filters = array())
10297 10297
 	{
10298 10298
 		global $globalTimezone, $globalDBdriver;
10299
-		$filter_query = $this->getFilter($filters,true,true);
10300
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10299
+		$filter_query = $this->getFilter($filters, true, true);
10300
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10301 10301
 		if ($globalTimezone != '') {
10302 10302
 			date_default_timezone_set($globalTimezone);
10303 10303
 			$datetime = new DateTime();
@@ -10305,12 +10305,12 @@  discard block
 block discarded – undo
10305 10305
 		} else $offset = '+00:00';
10306 10306
 
10307 10307
 		if ($globalDBdriver == 'mysql') {
10308
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10308
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10309 10309
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10310 10310
 								GROUP BY hour_name 
10311 10311
 								ORDER BY hour_name ASC";
10312 10312
 		} else {
10313
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10313
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10314 10314
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10315 10315
 								GROUP BY hour_name 
10316 10316
 								ORDER BY hour_name ASC";
@@ -10318,12 +10318,12 @@  discard block
 block discarded – undo
10318 10318
       
10319 10319
 		
10320 10320
 		$sth = $this->db->prepare($query);
10321
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10321
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10322 10322
       
10323 10323
 		$hour_array = array();
10324 10324
 		$temp_array = array();
10325 10325
         
10326
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10326
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10327 10327
 		{
10328 10328
 			$temp_array['hour_name'] = $row['hour_name'];
10329 10329
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10342,12 +10342,12 @@  discard block
 block discarded – undo
10342 10342
 	* @return Array the hour list
10343 10343
 	*
10344 10344
 	*/
10345
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10345
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10346 10346
 	{
10347 10347
 		global $globalTimezone, $globalDBdriver;
10348
-		$filter_query = $this->getFilter($filters,true,true);
10349
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10350
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10348
+		$filter_query = $this->getFilter($filters, true, true);
10349
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10350
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10351 10351
 		if ($globalTimezone != '') {
10352 10352
 			date_default_timezone_set($globalTimezone);
10353 10353
 			$datetime = new DateTime();
@@ -10355,24 +10355,24 @@  discard block
 block discarded – undo
10355 10355
 		} else $offset = '+00:00';
10356 10356
 
10357 10357
 		if ($globalDBdriver == 'mysql') {
10358
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10358
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10359 10359
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10360 10360
 								GROUP BY hour_name 
10361 10361
 								ORDER BY hour_name ASC";
10362 10362
 		} else {
10363
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10363
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10364 10364
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10365 10365
 								GROUP BY hour_name 
10366 10366
 								ORDER BY hour_name ASC";
10367 10367
 		}
10368 10368
 		
10369 10369
 		$sth = $this->db->prepare($query);
10370
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10370
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10371 10371
       
10372 10372
 		$hour_array = array();
10373 10373
 		$temp_array = array();
10374 10374
         
10375
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10375
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10376 10376
 		{
10377 10377
 			$temp_array['hour_name'] = $row['hour_name'];
10378 10378
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10393,8 +10393,8 @@  discard block
 block discarded – undo
10393 10393
 	public function countAllHoursByCountry($country, $filters = array())
10394 10394
 	{
10395 10395
 		global $globalTimezone, $globalDBdriver;
10396
-		$filter_query = $this->getFilter($filters,true,true);
10397
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10396
+		$filter_query = $this->getFilter($filters, true, true);
10397
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10398 10398
 		if ($globalTimezone != '') {
10399 10399
 			date_default_timezone_set($globalTimezone);
10400 10400
 			$datetime = new DateTime();
@@ -10402,24 +10402,24 @@  discard block
 block discarded – undo
10402 10402
 		} else $offset = '+00:00';
10403 10403
 
10404 10404
 		if ($globalDBdriver == 'mysql') {
10405
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10405
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10406 10406
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10407 10407
 								GROUP BY hour_name 
10408 10408
 								ORDER BY hour_name ASC";
10409 10409
 		} else {
10410
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10410
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10411 10411
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10412 10412
 								GROUP BY hour_name 
10413 10413
 								ORDER BY hour_name ASC";
10414 10414
 		}
10415 10415
 		
10416 10416
 		$sth = $this->db->prepare($query);
10417
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10417
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10418 10418
       
10419 10419
 		$hour_array = array();
10420 10420
 		$temp_array = array();
10421 10421
         
10422
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10422
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10423 10423
 		{
10424 10424
 			$temp_array['hour_name'] = $row['hour_name'];
10425 10425
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10439,29 +10439,29 @@  discard block
 block discarded – undo
10439 10439
 	* @return Integer the number of aircrafts
10440 10440
 	*
10441 10441
 	*/
10442
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10442
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10443 10443
 	{
10444 10444
 		global $globalDBdriver;
10445
-		$filter_query = $this->getFilter($filters,true,true);
10446
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10445
+		$filter_query = $this->getFilter($filters, true, true);
10446
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10447 10447
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10448 10448
 		$query_values = array();
10449 10449
 		if ($year != '') {
10450 10450
 			if ($globalDBdriver == 'mysql') {
10451 10451
 				$query .= " AND YEAR(spotter_output.date) = :year";
10452
-				$query_values = array_merge($query_values,array(':year' => $year));
10452
+				$query_values = array_merge($query_values, array(':year' => $year));
10453 10453
 			} else {
10454 10454
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10455
-				$query_values = array_merge($query_values,array(':year' => $year));
10455
+				$query_values = array_merge($query_values, array(':year' => $year));
10456 10456
 			}
10457 10457
 		}
10458 10458
 		if ($month != '') {
10459 10459
 			if ($globalDBdriver == 'mysql') {
10460 10460
 				$query .= " AND MONTH(spotter_output.date) = :month";
10461
-				$query_values = array_merge($query_values,array(':month' => $month));
10461
+				$query_values = array_merge($query_values, array(':month' => $month));
10462 10462
 			} else {
10463 10463
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10464
-				$query_values = array_merge($query_values,array(':month' => $month));
10464
+				$query_values = array_merge($query_values, array(':month' => $month));
10465 10465
 			}
10466 10466
 		}
10467 10467
 
@@ -10476,29 +10476,29 @@  discard block
 block discarded – undo
10476 10476
 	* @return Integer the number of aircrafts
10477 10477
 	*
10478 10478
 	*/
10479
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10479
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10480 10480
 	{
10481 10481
 		global $globalDBdriver;
10482
-		$filter_query = $this->getFilter($filters,true,true);
10483
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10482
+		$filter_query = $this->getFilter($filters, true, true);
10483
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10484 10484
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10485 10485
 		$query_values = array();
10486 10486
 		if ($year != '') {
10487 10487
 			if ($globalDBdriver == 'mysql') {
10488 10488
 				$query .= " AND YEAR(spotter_output.date) = :year";
10489
-				$query_values = array_merge($query_values,array(':year' => $year));
10489
+				$query_values = array_merge($query_values, array(':year' => $year));
10490 10490
 			} else {
10491 10491
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10492
-				$query_values = array_merge($query_values,array(':year' => $year));
10492
+				$query_values = array_merge($query_values, array(':year' => $year));
10493 10493
 			}
10494 10494
 		}
10495 10495
 		if ($month != '') {
10496 10496
 			if ($globalDBdriver == 'mysql') {
10497 10497
 				$query .= " AND MONTH(spotter_output.date) = :month";
10498
-				$query_values = array_merge($query_values,array(':month' => $month));
10498
+				$query_values = array_merge($query_values, array(':month' => $month));
10499 10499
 			} else {
10500 10500
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10501
-				$query_values = array_merge($query_values,array(':month' => $month));
10501
+				$query_values = array_merge($query_values, array(':month' => $month));
10502 10502
 			}
10503 10503
 		}
10504 10504
 		
@@ -10513,29 +10513,29 @@  discard block
 block discarded – undo
10513 10513
 	* @return Integer the number of pilots
10514 10514
 	*
10515 10515
 	*/
10516
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10516
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10517 10517
 	{
10518 10518
 		global $globalDBdriver;
10519
-		$filter_query = $this->getFilter($filters,true,true);
10520
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10519
+		$filter_query = $this->getFilter($filters, true, true);
10520
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10521 10521
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10522 10522
 		$query_values = array();
10523 10523
 		if ($year != '') {
10524 10524
 			if ($globalDBdriver == 'mysql') {
10525 10525
 				$query .= " AND YEAR(spotter_output.date) = :year";
10526
-				$query_values = array_merge($query_values,array(':year' => $year));
10526
+				$query_values = array_merge($query_values, array(':year' => $year));
10527 10527
 			} else {
10528 10528
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10529
-				$query_values = array_merge($query_values,array(':year' => $year));
10529
+				$query_values = array_merge($query_values, array(':year' => $year));
10530 10530
 			}
10531 10531
 		}
10532 10532
 		if ($month != '') {
10533 10533
 			if ($globalDBdriver == 'mysql') {
10534 10534
 				$query .= " AND MONTH(spotter_output.date) = :month";
10535
-				$query_values = array_merge($query_values,array(':month' => $month));
10535
+				$query_values = array_merge($query_values, array(':month' => $month));
10536 10536
 			} else {
10537 10537
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10538
-				$query_values = array_merge($query_values,array(':month' => $month));
10538
+				$query_values = array_merge($query_values, array(':month' => $month));
10539 10539
 			}
10540 10540
 		}
10541 10541
 		$sth = $this->db->prepare($query);
@@ -10549,29 +10549,29 @@  discard block
 block discarded – undo
10549 10549
 	* @return Integer the number of owners
10550 10550
 	*
10551 10551
 	*/
10552
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10552
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10553 10553
 	{
10554 10554
 		global $globalDBdriver;
10555
-		$filter_query = $this->getFilter($filters,true,true);
10556
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10555
+		$filter_query = $this->getFilter($filters, true, true);
10556
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10557 10557
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10558 10558
 		$query_values = array();
10559 10559
 		if ($year != '') {
10560 10560
 			if ($globalDBdriver == 'mysql') {
10561 10561
 				$query .= " AND YEAR(spotter_output.date) = :year";
10562
-				$query_values = array_merge($query_values,array(':year' => $year));
10562
+				$query_values = array_merge($query_values, array(':year' => $year));
10563 10563
 			} else {
10564 10564
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10565
-				$query_values = array_merge($query_values,array(':year' => $year));
10565
+				$query_values = array_merge($query_values, array(':year' => $year));
10566 10566
 			}
10567 10567
 		}
10568 10568
 		if ($month != '') {
10569 10569
 			if ($globalDBdriver == 'mysql') {
10570 10570
 				$query .= " AND MONTH(spotter_output.date) = :month";
10571
-				$query_values = array_merge($query_values,array(':month' => $month));
10571
+				$query_values = array_merge($query_values, array(':month' => $month));
10572 10572
 			} else {
10573 10573
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10574
-				$query_values = array_merge($query_values,array(':month' => $month));
10574
+				$query_values = array_merge($query_values, array(':month' => $month));
10575 10575
 			}
10576 10576
 		}
10577 10577
 		$sth = $this->db->prepare($query);
@@ -10586,32 +10586,32 @@  discard block
 block discarded – undo
10586 10586
 	* @return Integer the number of flights
10587 10587
 	*
10588 10588
 	*/
10589
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
10589
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
10590 10590
 	{
10591 10591
 		global $globalDBdriver;
10592
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10592
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
10593 10593
 		$query_values = array();
10594 10594
 		$query = '';
10595 10595
 		if ($year != '') {
10596 10596
 			if ($globalDBdriver == 'mysql') {
10597 10597
 				$query .= " AND YEAR(spotter_output.date) = :year";
10598
-				$query_values = array_merge($query_values,array(':year' => $year));
10598
+				$query_values = array_merge($query_values, array(':year' => $year));
10599 10599
 			} else {
10600 10600
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10601
-				$query_values = array_merge($query_values,array(':year' => $year));
10601
+				$query_values = array_merge($query_values, array(':year' => $year));
10602 10602
 			}
10603 10603
 		}
10604 10604
 		if ($month != '') {
10605 10605
 			if ($globalDBdriver == 'mysql') {
10606 10606
 				$query .= " AND MONTH(spotter_output.date) = :month";
10607
-				$query_values = array_merge($query_values,array(':month' => $month));
10607
+				$query_values = array_merge($query_values, array(':month' => $month));
10608 10608
 			} else {
10609 10609
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10610
-				$query_values = array_merge($query_values,array(':month' => $month));
10610
+				$query_values = array_merge($query_values, array(':month' => $month));
10611 10611
 			}
10612 10612
 		}
10613 10613
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10614
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10614
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10615 10615
 		
10616 10616
 		//echo $query;
10617 10617
 		$sth = $this->db->prepare($queryi);
@@ -10625,29 +10625,29 @@  discard block
 block discarded – undo
10625 10625
 	* @return Integer the number of flights
10626 10626
 	*
10627 10627
 	*/
10628
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
10628
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
10629 10629
 	{
10630 10630
 		global $globalDBdriver;
10631
-		$filter_query = $this->getFilter($filters,true,true);
10632
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10631
+		$filter_query = $this->getFilter($filters, true, true);
10632
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
10633 10633
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
10634 10634
 		$query_values = array();
10635 10635
 		if ($year != '') {
10636 10636
 			if ($globalDBdriver == 'mysql') {
10637 10637
 				$query .= " AND YEAR(spotter_output.date) = :year";
10638
-				$query_values = array_merge($query_values,array(':year' => $year));
10638
+				$query_values = array_merge($query_values, array(':year' => $year));
10639 10639
 			} else {
10640 10640
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10641
-				$query_values = array_merge($query_values,array(':year' => $year));
10641
+				$query_values = array_merge($query_values, array(':year' => $year));
10642 10642
 			}
10643 10643
 		}
10644 10644
 		if ($month != '') {
10645 10645
 			if ($globalDBdriver == 'mysql') {
10646 10646
 				$query .= " AND MONTH(spotter_output.date) = :month";
10647
-				$query_values = array_merge($query_values,array(':month' => $month));
10647
+				$query_values = array_merge($query_values, array(':month' => $month));
10648 10648
 			} else {
10649 10649
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10650
-				$query_values = array_merge($query_values,array(':month' => $month));
10650
+				$query_values = array_merge($query_values, array(':month' => $month));
10651 10651
 			}
10652 10652
 		}
10653 10653
       
@@ -10664,10 +10664,10 @@  discard block
 block discarded – undo
10664 10664
 	* @return Integer the number of airlines
10665 10665
 	*
10666 10666
 	*/
10667
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
10667
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
10668 10668
 	{
10669 10669
 		global $globalDBdriver;
10670
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10670
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
10671 10671
 							FROM spotter_output";
10672 10672
       
10673 10673
 		$query_values = array();
@@ -10675,23 +10675,23 @@  discard block
 block discarded – undo
10675 10675
 		if ($year != '') {
10676 10676
 			if ($globalDBdriver == 'mysql') {
10677 10677
 				$query .= " AND YEAR(spotter_output.date) = :year";
10678
-				$query_values = array_merge($query_values,array(':year' => $year));
10678
+				$query_values = array_merge($query_values, array(':year' => $year));
10679 10679
 			} else {
10680 10680
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10681
-				$query_values = array_merge($query_values,array(':year' => $year));
10681
+				$query_values = array_merge($query_values, array(':year' => $year));
10682 10682
 			}
10683 10683
 		}
10684 10684
 		if ($month != '') {
10685 10685
 			if ($globalDBdriver == 'mysql') {
10686 10686
 				$query .= " AND MONTH(spotter_output.date) = :month";
10687
-				$query_values = array_merge($query_values,array(':month' => $month));
10687
+				$query_values = array_merge($query_values, array(':month' => $month));
10688 10688
 			} else {
10689 10689
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10690
-				$query_values = array_merge($query_values,array(':month' => $month));
10690
+				$query_values = array_merge($query_values, array(':month' => $month));
10691 10691
 			}
10692 10692
 		}
10693 10693
                 if ($query == '') $queryi .= $this->getFilter($filters);
10694
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
10694
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
10695 10695
 
10696 10696
 
10697 10697
 		$sth = $this->db->prepare($queryi);
@@ -10709,7 +10709,7 @@  discard block
 block discarded – undo
10709 10709
 	public function countAllHoursFromToday($filters = array())
10710 10710
 	{
10711 10711
 		global $globalTimezone, $globalDBdriver;
10712
-		$filter_query = $this->getFilter($filters,true,true);
10712
+		$filter_query = $this->getFilter($filters, true, true);
10713 10713
 		if ($globalTimezone != '') {
10714 10714
 			date_default_timezone_set($globalTimezone);
10715 10715
 			$datetime = new DateTime();
@@ -10717,12 +10717,12 @@  discard block
 block discarded – undo
10717 10717
 		} else $offset = '+00:00';
10718 10718
 
10719 10719
 		if ($globalDBdriver == 'mysql') {
10720
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10720
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10721 10721
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
10722 10722
 								GROUP BY hour_name 
10723 10723
 								ORDER BY hour_name ASC";
10724 10724
 		} else {
10725
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10725
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10726 10726
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
10727 10727
 								GROUP BY hour_name 
10728 10728
 								ORDER BY hour_name ASC";
@@ -10734,7 +10734,7 @@  discard block
 block discarded – undo
10734 10734
 		$hour_array = array();
10735 10735
 		$temp_array = array();
10736 10736
         
10737
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10737
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10738 10738
 		{
10739 10739
 			$temp_array['hour_name'] = $row['hour_name'];
10740 10740
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10753,14 +10753,14 @@  discard block
 block discarded – undo
10753 10753
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
10754 10754
 	{
10755 10755
 		global $global_query, $globalDBdriver, $globalTimezone;
10756
-		$filter_query = $this->getFilter($filters,true,true);
10756
+		$filter_query = $this->getFilter($filters, true, true);
10757 10757
 		date_default_timezone_set('UTC');
10758 10758
 		$limit_query = '';
10759 10759
 		if ($limit != "")
10760 10760
 		{
10761 10761
 			$limit_array = explode(",", $limit);
10762
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
10763
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
10762
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
10763
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
10764 10764
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
10765 10765
 			{
10766 10766
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -10813,7 +10813,7 @@  discard block
 block discarded – undo
10813 10813
 			    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')
10814 10814
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
10815 10815
 			//echo $query;
10816
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
10816
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
10817 10817
 			/*
10818 10818
 			$sth = $this->db->prepare($query);
10819 10819
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -10832,9 +10832,9 @@  discard block
 block discarded – undo
10832 10832
 	*/
10833 10833
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
10834 10834
 	{
10835
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
10835
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
10836 10836
 
10837
-		$query  = "SELECT spotter_output.spotter_id
10837
+		$query = "SELECT spotter_output.spotter_id
10838 10838
 								FROM spotter_output 
10839 10839
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
10840 10840
         
@@ -10842,7 +10842,7 @@  discard block
 block discarded – undo
10842 10842
 		$sth = $this->db->prepare($query);
10843 10843
 		$sth->execute();
10844 10844
 
10845
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10845
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10846 10846
 		{
10847 10847
 			return $row['spotter_id'];
10848 10848
 		}
@@ -10867,23 +10867,23 @@  discard block
 block discarded – undo
10867 10867
 		}
10868 10868
 		
10869 10869
 		$current_date = date("Y-m-d H:i:s");
10870
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
10870
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
10871 10871
 		
10872 10872
 		$diff = abs(strtotime($current_date) - strtotime($date));
10873 10873
 
10874
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
10874
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
10875 10875
 		$years = $time_array['years'];
10876 10876
 		
10877
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
10877
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
10878 10878
 		$months = $time_array['months'];
10879 10879
 		
10880
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
10880
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
10881 10881
 		$days = $time_array['days'];
10882
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
10882
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
10883 10883
 		$hours = $time_array['hours'];
10884
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
10884
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
10885 10885
 		$minutes = $time_array['minutes'];
10886
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10886
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
10887 10887
 		
10888 10888
 		return $time_array;	
10889 10889
 	}	
@@ -10909,63 +10909,63 @@  discard block
 block discarded – undo
10909 10909
 			$temp_array['direction_degree'] = $direction;
10910 10910
 			$temp_array['direction_shortname'] = "N";
10911 10911
 			$temp_array['direction_fullname'] = "North";
10912
-		} elseif ($direction >= 22.5 && $direction < 45){
10912
+		} elseif ($direction >= 22.5 && $direction < 45) {
10913 10913
 			$temp_array['direction_degree'] = $direction;
10914 10914
 			$temp_array['direction_shortname'] = "NNE";
10915 10915
 			$temp_array['direction_fullname'] = "North-Northeast";
10916
-		} elseif ($direction >= 45 && $direction < 67.5){
10916
+		} elseif ($direction >= 45 && $direction < 67.5) {
10917 10917
 			$temp_array['direction_degree'] = $direction;
10918 10918
 			$temp_array['direction_shortname'] = "NE";
10919 10919
 			$temp_array['direction_fullname'] = "Northeast";
10920
-		} elseif ($direction >= 67.5 && $direction < 90){
10920
+		} elseif ($direction >= 67.5 && $direction < 90) {
10921 10921
 			$temp_array['direction_degree'] = $direction;
10922 10922
 			$temp_array['direction_shortname'] = "ENE";
10923 10923
 			$temp_array['direction_fullname'] = "East-Northeast";
10924
-		} elseif ($direction >= 90 && $direction < 112.5){
10924
+		} elseif ($direction >= 90 && $direction < 112.5) {
10925 10925
 			$temp_array['direction_degree'] = $direction;
10926 10926
 			$temp_array['direction_shortname'] = "E";
10927 10927
 			$temp_array['direction_fullname'] = "East";
10928
-		} elseif ($direction >= 112.5 && $direction < 135){
10928
+		} elseif ($direction >= 112.5 && $direction < 135) {
10929 10929
 			$temp_array['direction_degree'] = $direction;
10930 10930
 			$temp_array['direction_shortname'] = "ESE";
10931 10931
 			$temp_array['direction_fullname'] = "East-Southeast";
10932
-		} elseif ($direction >= 135 && $direction < 157.5){
10932
+		} elseif ($direction >= 135 && $direction < 157.5) {
10933 10933
 			$temp_array['direction_degree'] = $direction;
10934 10934
 			$temp_array['direction_shortname'] = "SE";
10935 10935
 			$temp_array['direction_fullname'] = "Southeast";
10936
-		} elseif ($direction >= 157.5 && $direction < 180){
10936
+		} elseif ($direction >= 157.5 && $direction < 180) {
10937 10937
 			$temp_array['direction_degree'] = $direction;
10938 10938
 			$temp_array['direction_shortname'] = "SSE";
10939 10939
 			$temp_array['direction_fullname'] = "South-Southeast";
10940
-		} elseif ($direction >= 180 && $direction < 202.5){
10940
+		} elseif ($direction >= 180 && $direction < 202.5) {
10941 10941
 			$temp_array['direction_degree'] = $direction;
10942 10942
 			$temp_array['direction_shortname'] = "S";
10943 10943
 			$temp_array['direction_fullname'] = "South";
10944
-		} elseif ($direction >= 202.5 && $direction < 225){
10944
+		} elseif ($direction >= 202.5 && $direction < 225) {
10945 10945
 			$temp_array['direction_degree'] = $direction;
10946 10946
 			$temp_array['direction_shortname'] = "SSW";
10947 10947
 			$temp_array['direction_fullname'] = "South-Southwest";
10948
-		} elseif ($direction >= 225 && $direction < 247.5){
10948
+		} elseif ($direction >= 225 && $direction < 247.5) {
10949 10949
 			$temp_array['direction_degree'] = $direction;
10950 10950
 			$temp_array['direction_shortname'] = "SW";
10951 10951
 			$temp_array['direction_fullname'] = "Southwest";
10952
-		} elseif ($direction >= 247.5 && $direction < 270){
10952
+		} elseif ($direction >= 247.5 && $direction < 270) {
10953 10953
 			$temp_array['direction_degree'] = $direction;
10954 10954
 			$temp_array['direction_shortname'] = "WSW";
10955 10955
 			$temp_array['direction_fullname'] = "West-Southwest";
10956
-		} elseif ($direction >= 270 && $direction < 292.5){
10956
+		} elseif ($direction >= 270 && $direction < 292.5) {
10957 10957
 			$temp_array['direction_degree'] = $direction;
10958 10958
 			$temp_array['direction_shortname'] = "W";
10959 10959
 			$temp_array['direction_fullname'] = "West";
10960
-		} elseif ($direction >= 292.5 && $direction < 315){
10960
+		} elseif ($direction >= 292.5 && $direction < 315) {
10961 10961
 			$temp_array['direction_degree'] = $direction;
10962 10962
 			$temp_array['direction_shortname'] = "WNW";
10963 10963
 			$temp_array['direction_fullname'] = "West-Northwest";
10964
-		} elseif ($direction >= 315 && $direction < 337.5){
10964
+		} elseif ($direction >= 315 && $direction < 337.5) {
10965 10965
 			$temp_array['direction_degree'] = $direction;
10966 10966
 			$temp_array['direction_shortname'] = "NW";
10967 10967
 			$temp_array['direction_fullname'] = "Northwest";
10968
-		} elseif ($direction >= 337.5 && $direction < 360){
10968
+		} elseif ($direction >= 337.5 && $direction < 360) {
10969 10969
 			$temp_array['direction_degree'] = $direction;
10970 10970
 			$temp_array['direction_shortname'] = "NNW";
10971 10971
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11018,9 +11018,9 @@  discard block
 block discarded – undo
11018 11018
 	*/
11019 11019
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11020 11020
 	{
11021
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11021
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11022 11022
 	
11023
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11023
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11024 11024
 		
11025 11025
 		$sth = $this->db->prepare($query);
11026 11026
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11043,9 +11043,9 @@  discard block
 block discarded – undo
11043 11043
 	*/
11044 11044
 	public function getAircraftTypeBymodeS($aircraft_modes)
11045 11045
 	{
11046
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11046
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11047 11047
 	
11048
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11048
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11049 11049
 		
11050 11050
 		$sth = $this->db->prepare($query);
11051 11051
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11066,11 +11066,11 @@  discard block
 block discarded – undo
11066 11066
 	* @param Float $longitude longitute of the flight
11067 11067
 	* @return String the countrie
11068 11068
 	*/
11069
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11069
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11070 11070
 	{
11071 11071
 		global $globalDBdriver, $globalDebug;
11072
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11073
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11072
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11073
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11074 11074
 	
11075 11075
 		$Connection = new Connection($this->db);
11076 11076
 		if (!$Connection->tableExists('countries')) return '';
@@ -11110,7 +11110,7 @@  discard block
 block discarded – undo
11110 11110
 	public function getCountryFromISO2($iso2)
11111 11111
 	{
11112 11112
 		global $globalDBdriver, $globalDebug;
11113
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11113
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11114 11114
 	
11115 11115
 		$Connection = new Connection($this->db);
11116 11116
 		if (!$Connection->tableExists('countries')) return '';
@@ -11142,19 +11142,19 @@  discard block
 block discarded – undo
11142 11142
 	*/
11143 11143
 	public function convertAircraftRegistration($registration)
11144 11144
 	{
11145
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11145
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11146 11146
 		$registration_prefix = '';
11147 11147
 		$registration_1 = substr($registration, 0, 1);
11148 11148
 		$registration_2 = substr($registration, 0, 2);
11149 11149
 
11150 11150
 		//first get the prefix based on two characters
11151
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11151
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11152 11152
       
11153 11153
 		
11154 11154
 		$sth = $this->db->prepare($query);
11155 11155
 		$sth->execute(array(':registration_2' => $registration_2));
11156 11156
         
11157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11158 11158
 		{
11159 11159
 			$registration_prefix = $row['registration_prefix'];
11160 11160
 		}
@@ -11162,11 +11162,11 @@  discard block
 block discarded – undo
11162 11162
 		//if we didn't find a two chracter prefix lets just search the one with one character
11163 11163
 		if ($registration_prefix == '')
11164 11164
 		{
11165
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11165
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11166 11166
 			$sth = $this->db->prepare($query);
11167 11167
 			$sth->execute(array(':registration_1' => $registration_1));
11168 11168
 	        
11169
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11169
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11170 11170
 			{
11171 11171
 				$registration_prefix = $row['registration_prefix'];
11172 11172
 			}
@@ -11180,7 +11180,7 @@  discard block
 block discarded – undo
11180 11180
 			} else {
11181 11181
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11182 11182
 			}
11183
-		} else if(strlen($registration_prefix) == 2){
11183
+		} else if (strlen($registration_prefix) == 2) {
11184 11184
 			if (0 === strpos($registration, 'N')) {
11185 11185
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11186 11186
 			} else {
@@ -11199,17 +11199,17 @@  discard block
 block discarded – undo
11199 11199
 	*/
11200 11200
 	public function countryFromAircraftRegistration($registration)
11201 11201
 	{
11202
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11202
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11203 11203
 		
11204 11204
 		$registration_prefix = '';
11205
-		$registration_test = explode('-',$registration);
11205
+		$registration_test = explode('-', $registration);
11206 11206
 		$country = '';
11207 11207
 		if ($registration_test[0] != $registration) {
11208 11208
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11209 11209
 	      
11210 11210
 			$sth = $this->db->prepare($query);
11211 11211
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11212
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11212
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11213 11213
 			{
11214 11214
 				//$registration_prefix = $row['registration_prefix'];
11215 11215
 				$country = $row['country'];
@@ -11220,13 +11220,13 @@  discard block
 block discarded – undo
11220 11220
 
11221 11221
 			$country = '';
11222 11222
 			//first get the prefix based on two characters
11223
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11223
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11224 11224
       
11225 11225
 			
11226 11226
 			$sth = $this->db->prepare($query);
11227 11227
 			$sth->execute(array(':registration_2' => $registration_2));
11228 11228
         
11229
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11229
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11230 11230
 			{
11231 11231
 				$registration_prefix = $row['registration_prefix'];
11232 11232
 				$country = $row['country'];
@@ -11235,12 +11235,12 @@  discard block
 block discarded – undo
11235 11235
 			//if we didn't find a two chracter prefix lets just search the one with one character
11236 11236
 			if ($registration_prefix == "")
11237 11237
 			{
11238
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11238
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11239 11239
 	      
11240 11240
 				$sth = $this->db->prepare($query);
11241 11241
 				$sth->execute(array(':registration_1' => $registration_1));
11242 11242
 	        
11243
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11243
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11244 11244
 				{
11245 11245
 					//$registration_prefix = $row['registration_prefix'];
11246 11246
 					$country = $row['country'];
@@ -11260,17 +11260,17 @@  discard block
 block discarded – undo
11260 11260
 	*/
11261 11261
 	public function registrationPrefixFromAircraftRegistration($registration)
11262 11262
 	{
11263
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11263
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11264 11264
 		
11265 11265
 		$registration_prefix = '';
11266
-		$registration_test = explode('-',$registration);
11266
+		$registration_test = explode('-', $registration);
11267 11267
 		//$country = '';
11268 11268
 		if ($registration_test[0] != $registration) {
11269
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11269
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11270 11270
 	      
11271 11271
 			$sth = $this->db->prepare($query);
11272 11272
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11273
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11273
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11274 11274
 			{
11275 11275
 				$registration_prefix = $row['registration_prefix'];
11276 11276
 				//$country = $row['country'];
@@ -11280,13 +11280,13 @@  discard block
 block discarded – undo
11280 11280
 		        $registration_2 = substr($registration, 0, 2);
11281 11281
 
11282 11282
 			//first get the prefix based on two characters
11283
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11283
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11284 11284
       
11285 11285
 			
11286 11286
 			$sth = $this->db->prepare($query);
11287 11287
 			$sth->execute(array(':registration_2' => $registration_2));
11288 11288
         
11289
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11289
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11290 11290
 			{
11291 11291
 				$registration_prefix = $row['registration_prefix'];
11292 11292
 				//$country = $row['country'];
@@ -11295,12 +11295,12 @@  discard block
 block discarded – undo
11295 11295
 			//if we didn't find a two chracter prefix lets just search the one with one character
11296 11296
 			if ($registration_prefix == "")
11297 11297
 			{
11298
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11298
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11299 11299
 	      
11300 11300
 				$sth = $this->db->prepare($query);
11301 11301
 				$sth->execute(array(':registration_1' => $registration_1));
11302 11302
 	        
11303
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11303
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11304 11304
 				{
11305 11305
 					$registration_prefix = $row['registration_prefix'];
11306 11306
 					//$country = $row['country'];
@@ -11321,13 +11321,13 @@  discard block
 block discarded – undo
11321 11321
 	*/
11322 11322
 	public function countryFromAircraftRegistrationCode($registration)
11323 11323
 	{
11324
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11324
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11325 11325
 		
11326 11326
 		$country = '';
11327
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11327
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11328 11328
 		$sth = $this->db->prepare($query);
11329 11329
 		$sth->execute(array(':registration' => $registration));
11330
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11330
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11331 11331
 		{
11332 11332
 			$country = $row['country'];
11333 11333
 		}
@@ -11340,9 +11340,9 @@  discard block
 block discarded – undo
11340 11340
 	* @param String $flightaware_id flightaware_id from spotter_output table
11341 11341
 	* @param String $highlight New highlight value
11342 11342
 	*/
11343
-	public function setHighlightFlight($flightaware_id,$highlight) {
11343
+	public function setHighlightFlight($flightaware_id, $highlight) {
11344 11344
 		
11345
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11345
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11346 11346
 		$sth = $this->db->prepare($query);
11347 11347
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11348 11348
 	}
@@ -11354,13 +11354,13 @@  discard block
 block discarded – undo
11354 11354
 	* @param String $date Date of spotted aircraft
11355 11355
 	* @param String $highlight New highlight value
11356 11356
 	*/
11357
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11357
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11358 11358
 		if ($date == '') {
11359 11359
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11360 11360
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11361 11361
 		} else {
11362 11362
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11363
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11363
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11364 11364
 		}
11365 11365
 		$sth = $this->db->prepare($query);
11366 11366
 		$sth->execute($query_values);
@@ -11390,7 +11390,7 @@  discard block
 block discarded – undo
11390 11390
 		
11391 11391
 		$bitly_data = json_decode($bitly_data);
11392 11392
 		$bitly_url = '';
11393
-		if ($bitly_data->status_txt = "OK"){
11393
+		if ($bitly_data->status_txt = "OK") {
11394 11394
 			$bitly_url = $bitly_data->data->url;
11395 11395
 		}
11396 11396
 
@@ -11400,7 +11400,7 @@  discard block
 block discarded – undo
11400 11400
 
11401 11401
 	public function getOrderBy()
11402 11402
 	{
11403
-		$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"));
11403
+		$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"));
11404 11404
 		
11405 11405
 		return $orderby;
11406 11406
 		
@@ -11534,14 +11534,14 @@  discard block
 block discarded – undo
11534 11534
 		}
11535 11535
 		$sth = $this->db->prepare($query);
11536 11536
 		$sth->execute();
11537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11538 11538
 		{
11539 11539
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11540 11540
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11541 11541
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11542
-				$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";
11542
+				$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";
11543 11543
 				$sthu = $this->db->prepare($update_query);
11544
-				$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']));
11544
+				$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']));
11545 11545
 			}
11546 11546
 		}
11547 11547
 		
@@ -11554,7 +11554,7 @@  discard block
 block discarded – undo
11554 11554
 		}
11555 11555
 		$sth = $this->db->prepare($query);
11556 11556
 		$sth->execute();
11557
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11557
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11558 11558
 		{
11559 11559
 			if (is_numeric(substr($row['ident'], -1, 1)))
11560 11560
 			{
@@ -11563,11 +11563,11 @@  discard block
 block discarded – undo
11563 11563
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11564 11564
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11565 11565
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
11566
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11566
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
11567 11567
 				if (isset($airline_array[0]['name'])) {
11568
-					$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";
11568
+					$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";
11569 11569
 					$sthu = $this->db->prepare($update_query);
11570
-					$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']));
11570
+					$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']));
11571 11571
 				}
11572 11572
 			}
11573 11573
 		}
@@ -11587,18 +11587,18 @@  discard block
 block discarded – undo
11587 11587
 		}
11588 11588
 		$sth = $this->db->prepare($query);
11589 11589
 		$sth->execute();
11590
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11590
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11591 11591
 		{
11592 11592
 			if ($row['aircraft_icao'] != '') {
11593 11593
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
11594
-				if ($row['registration'] != ""){
11594
+				if ($row['registration'] != "") {
11595 11595
 					$image_array = $Image->getSpotterImage($row['registration']);
11596 11596
 					if (!isset($image_array[0]['registration'])) {
11597 11597
 						$Image->addSpotterImage($row['registration']);
11598 11598
 					}
11599 11599
 				}
11600 11600
 				if (count($aircraft_name) > 0) {
11601
-					$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";
11601
+					$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";
11602 11602
 					$sthu = $this->db->prepare($update_query);
11603 11603
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
11604 11604
 				}
@@ -11613,10 +11613,10 @@  discard block
 block discarded – undo
11613 11613
 		$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";
11614 11614
 		$sth = $this->db->prepare($query);
11615 11615
 		$sth->execute();
11616
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11616
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11617 11617
 		{
11618 11618
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
11619
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
11619
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
11620 11620
 				$airport_icao = '';
11621 11621
 				 if (isset($closestAirports[0])) {
11622 11622
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -11630,7 +11630,7 @@  discard block
 block discarded – undo
11630 11630
 								break;
11631 11631
 							}
11632 11632
 						}
11633
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11633
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
11634 11634
 						$airport_icao = $closestAirports[0]['icao'];
11635 11635
 						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";
11636 11636
 					} else {
@@ -11641,28 +11641,28 @@  discard block
 block discarded – undo
11641 11641
 				}
11642 11642
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11643 11643
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
11644
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11644
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11645 11645
 					$sthu = $this->db->prepare($update_query);
11646
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
11646
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
11647 11647
 				}
11648 11648
 			}
11649 11649
 		}
11650 11650
 	}
11651 11651
 	
11652
-	public function closestAirports($origLat,$origLon,$dist = 10) {
11652
+	public function closestAirports($origLat, $origLon, $dist = 10) {
11653 11653
 		global $globalDBdriver;
11654
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
11654
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
11655 11655
 /*
11656 11656
 		$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 
11657 11657
                       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)) 
11658 11658
                       having distance < $dist ORDER BY distance limit 100;";
11659 11659
 */
11660 11660
 		if ($globalDBdriver == 'mysql') {
11661
-			$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 
11661
+			$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 
11662 11662
 	                      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)) 
11663 11663
 	                      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;";
11664 11664
                 } else {
11665
-			$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 
11665
+			$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 
11666 11666
 	                      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)) 
11667 11667
 	                      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;";
11668 11668
     		}
Please login to merge, or discard this patch.
Braces   +718 added lines, -250 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) {
73
+			$filter = array_merge($filter,$globalFilter);
74
+		}
73 75
 		$filter_query_join = '';
74 76
 		$filter_query_where = '';
75 77
 		foreach($filters as $flt) {
@@ -122,8 +124,11 @@  discard block
 block discarded – undo
122 124
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
123 125
 			}
124 126
 		}
125
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
126
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
127
+		if ($filter_query_where == '' && $where) {
128
+			$filter_query_where = ' WHERE';
129
+		} elseif ($filter_query_where != '' && $and) {
130
+			$filter_query_where .= ' AND';
131
+		}
127 132
 		$filter_query = $filter_query_join.$filter_query_where;
128 133
 		return $filter_query;
129 134
 	}
@@ -143,10 +148,18 @@  discard block
 block discarded – undo
143 148
 		$Image = new Image($this->db);
144 149
 		$Schedule = new Schedule($this->db);
145 150
 		$ACARS = new ACARS($this->db);
146
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
147
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
148
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
149
-		if (!isset($globalVAM)) $globalVAM = FALSE;
151
+		if (!isset($globalIVAO)) {
152
+			$globalIVAO = FALSE;
153
+		}
154
+		if (!isset($globalVATSIM)) {
155
+			$globalVATSIM = FALSE;
156
+		}
157
+		if (!isset($globalphpVMS)) {
158
+			$globalphpVMS = FALSE;
159
+		}
160
+		if (!isset($globalVAM)) {
161
+			$globalVAM = FALSE;
162
+		}
150 163
 		date_default_timezone_set('UTC');
151 164
 		
152 165
 		if (!is_string($query))
@@ -193,21 +206,35 @@  discard block
 block discarded – undo
193 206
 			} else {
194 207
 				$temp_array['spotter_id'] = '';
195 208
 			}
196
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
197
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
209
+			if (isset($row['flightaware_id'])) {
210
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
211
+			}
212
+			if (isset($row['modes'])) {
213
+				$temp_array['modes'] = $row['modes'];
214
+			}
198 215
 			$temp_array['ident'] = $row['ident'];
199 216
 			if (isset($row['registration']) && $row['registration'] != '') {
200 217
 				$temp_array['registration'] = $row['registration'];
201 218
 			} elseif (isset($temp_array['modes'])) {
202 219
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
203
-			} else $temp_array['registration'] = '';
204
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
220
+			} else {
221
+				$temp_array['registration'] = '';
222
+			}
223
+			if (isset($row['aircraft_icao'])) {
224
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
225
+			}
205 226
 			
206 227
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
207 228
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
208
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
209
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
210
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
229
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
230
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
231
+			}
232
+			if (isset($row['latitude'])) {
233
+				$temp_array['latitude'] = $row['latitude'];
234
+			}
235
+			if (isset($row['longitude'])) {
236
+				$temp_array['longitude'] = $row['longitude'];
237
+			}
211 238
 			/*
212 239
 			if (Connection->tableExists('countries')) {
213 240
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -217,8 +244,12 @@  discard block
 block discarded – undo
217 244
 				}
218 245
 			}
219 246
 			*/
220
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
221
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
247
+			if (isset($row['waypoints'])) {
248
+				$temp_array['waypoints'] = $row['waypoints'];
249
+			}
250
+			if (isset($row['format_source'])) {
251
+				$temp_array['format_source'] = $row['format_source'];
252
+			}
222 253
 			if (isset($row['route_stop'])) {
223 254
 				$temp_array['route_stop'] = $row['route_stop'];
224 255
 				if ($row['route_stop'] != '') {
@@ -237,13 +268,19 @@  discard block
 block discarded – undo
237 268
 					}
238 269
 				}
239 270
 			}
240
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
271
+			if (isset($row['altitude'])) {
272
+				$temp_array['altitude'] = $row['altitude'];
273
+			}
241 274
 			if (isset($row['heading'])) {
242 275
 				$temp_array['heading'] = $row['heading'];
243 276
 				$heading_direction = $this->parseDirection($row['heading']);
244
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
277
+				if (isset($heading_direction[0]['direction_fullname'])) {
278
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
279
+				}
280
+			}
281
+			if (isset($row['ground_speed'])) {
282
+				$temp_array['ground_speed'] = $row['ground_speed'];
245 283
 			}
246
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
247 284
 			$temp_array['image'] = "";
248 285
 			$temp_array['image_thumbnail'] = "";
249 286
 			$temp_array['image_source'] = "";
@@ -251,7 +288,9 @@  discard block
 block discarded – undo
251 288
  
252 289
 			if (isset($row['highlight'])) {
253 290
 				$temp_array['highlight'] = $row['highlight'];
254
-			} else $temp_array['highlight'] = '';
291
+			} else {
292
+				$temp_array['highlight'] = '';
293
+			}
255 294
 			
256 295
 			if (isset($row['date'])) {
257 296
 				$dateArray = $this->parseDateString($row['date']);
@@ -299,7 +338,9 @@  discard block
 block discarded – undo
299 338
 				
300 339
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 340
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302
-					} else $temp_array['aircraft_shadow'] = 'default.png';
341
+					} else {
342
+						$temp_array['aircraft_shadow'] = 'default.png';
343
+					}
303 344
                                 } else {
304 345
                             		$temp_array['aircraft_shadow'] = 'default.png';
305 346
 					$temp_array['aircraft_name'] = 'N/A';
@@ -307,11 +348,17 @@  discard block
 block discarded – undo
307 348
                             	}
308 349
 			}
309 350
 			$fromsource = NULL;
310
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
311
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
312
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
313
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
314
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
351
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
352
+				$fromsource = $globalAirlinesSource;
353
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
354
+				$fromsource = 'vatsim';
355
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
356
+				$fromsource = 'ivao';
357
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
358
+				$fromsource = 'vatsim';
359
+			} elseif (isset($globalIVAO) && $globalIVAO) {
360
+				$fromsource = 'ivao';
361
+			}
315 362
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
316 363
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
317 364
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -334,12 +381,18 @@  discard block
 block discarded – undo
334 381
 				}
335 382
 			} else {
336 383
 				$temp_array['airline_icao'] = $row['airline_icao'];
337
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
338
-				else $temp_array['airline_iata'] = 'N/A';
384
+				if (isset($row['airline_iata'])) {
385
+					$temp_array['airline_iata'] = $row['airline_iata'];
386
+				} else {
387
+					$temp_array['airline_iata'] = 'N/A';
388
+				}
339 389
 				$temp_array['airline_name'] = $row['airline_name'];
340 390
 				$temp_array['airline_country'] = $row['airline_country'];
341
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
342
-				else $temp_array['airline_callsign'] = 'N/A';
391
+				if (isset($row['airline_callsign'])) {
392
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
393
+				} else {
394
+					$temp_array['airline_callsign'] = 'N/A';
395
+				}
343 396
 				$temp_array['airline_type'] = $row['airline_type'];
344 397
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
345 398
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -366,7 +419,9 @@  discard block
 block discarded – undo
366 419
 			}
367 420
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
368 421
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
369
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
422
+				if ($owner_info['owner'] != '') {
423
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
424
+				}
370 425
 				$temp_array['aircraft_base'] = $owner_info['base'];
371 426
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
372 427
 			}
@@ -374,9 +429,14 @@  discard block
 block discarded – undo
374 429
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
375 430
 			{
376 431
 				if ($globalIVAO) {
377
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
378
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
379
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
432
+					if (isset($temp_array['airline_icao'])) {
433
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
434
+					} else {
435
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
436
+					}
437
+				} else {
438
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
439
+				}
380 440
 				if (count($image_array) > 0) {
381 441
 					$temp_array['image'] = $image_array[0]['image'];
382 442
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -428,7 +488,9 @@  discard block
 block discarded – undo
428 488
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
429 489
 			if ($row['departure_airport_icao'] != '') {
430 490
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
431
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
491
+				if (!isset($departure_airport_array[0]['name'])) {
492
+					$departure_airport_array = $this->getAllAirportInfo('NA');
493
+				}
432 494
 			/*
433 495
 			} elseif ($row['departure_airport_name'] != '') {
434 496
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -436,7 +498,9 @@  discard block
 block discarded – undo
436 498
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
437 499
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
438 500
 			*/
439
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
501
+			} else {
502
+				$departure_airport_array = $this->getAllAirportInfo('NA');
503
+			}
440 504
 			if (isset($departure_airport_array[0]['name'])) {
441 505
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
442 506
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -456,8 +520,12 @@  discard block
 block discarded – undo
456 520
 			
457 521
 			if ($row['arrival_airport_icao'] != '') {
458 522
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
459
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
460
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
523
+				if (count($arrival_airport_array) == 0) {
524
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
525
+				}
526
+			} else {
527
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
528
+			}
461 529
 			if (isset($arrival_airport_array[0]['name'])) {
462 530
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
463 531
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -473,27 +541,45 @@  discard block
 block discarded – undo
473 541
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
474 542
 			}
475 543
 			*/
476
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
477
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
478
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
479
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
480
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
544
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
545
+				$temp_array['pilot_id'] = $row['pilot_id'];
546
+			}
547
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
548
+				$temp_array['pilot_name'] = $row['pilot_name'];
549
+			}
550
+			if (isset($row['source_name']) && $row['source_name'] != '') {
551
+				$temp_array['source_name'] = $row['source_name'];
552
+			}
553
+			if (isset($row['over_country']) && $row['over_country'] != '') {
554
+				$temp_array['over_country'] = $row['over_country'];
555
+			}
556
+			if (isset($row['distance']) && $row['distance'] != '') {
557
+				$temp_array['distance'] = $row['distance'];
558
+			}
481 559
 			if (isset($row['squawk'])) {
482 560
 				$temp_array['squawk'] = $row['squawk'];
483 561
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
484 562
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
485
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
563
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
564
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
565
+					}
486 566
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
487 567
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
488
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
489
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
568
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
569
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
570
+					}
571
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
572
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
573
+				}
490 574
 			}
491 575
     			
492 576
 			$temp_array['query_number_rows'] = $num_rows;
493 577
 			
494 578
 			$spotter_array[] = $temp_array;
495 579
 		}
496
-		if ($num_rows == 0) return array();
580
+		if ($num_rows == 0) {
581
+			return array();
582
+		}
497 583
 		$spotter_array[0]['query_number_rows'] = $num_rows;
498 584
 		return $spotter_array;
499 585
 	}	
@@ -526,7 +612,9 @@  discard block
 block discarded – undo
526 612
 				foreach ($q_array as $q_item){
527 613
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
528 614
 					$additional_query .= " AND (";
529
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
615
+					if (is_int($q_item)) {
616
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
617
+					}
530 618
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
531 619
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
532 620
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -547,7 +635,9 @@  discard block
 block discarded – undo
547 635
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
548 636
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
549 637
 					$translate = $Translation->ident2icao($q_item);
550
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
638
+					if ($translate != $q_item) {
639
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
640
+					}
551 641
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
552 642
 					$additional_query .= ")";
553 643
 				}
@@ -774,7 +864,9 @@  discard block
 block discarded – undo
774 864
 				date_default_timezone_set($globalTimezone);
775 865
 				$datetime = new DateTime();
776 866
 				$offset = $datetime->format('P');
777
-			} else $offset = '+00:00';
867
+			} else {
868
+				$offset = '+00:00';
869
+			}
778 870
 
779 871
 			if ($date_array[1] != "")
780 872
 			{
@@ -806,8 +898,12 @@  discard block
 block discarded – undo
806 898
 			{
807 899
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
808 900
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
809
-			} else $limit_query = "";
810
-		} else $limit_query = "";
901
+			} else {
902
+				$limit_query = "";
903
+			}
904
+		} else {
905
+			$limit_query = "";
906
+		}
811 907
 
812 908
 
813 909
 		if ($sort != "")
@@ -875,8 +971,12 @@  discard block
 block discarded – undo
875 971
 			{
876 972
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
877 973
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
878
-			} else $limit_query = "";
879
-		} else $limit_query = "";
974
+			} else {
975
+				$limit_query = "";
976
+			}
977
+		} else {
978
+			$limit_query = "";
979
+		}
880 980
 		
881 981
 		if ($sort != "")
882 982
 		{
@@ -1200,7 +1300,9 @@  discard block
 block discarded – undo
1200 1300
 		global $global_query;
1201 1301
 		
1202 1302
 		date_default_timezone_set('UTC');
1203
-		if ($id == '') return array();
1303
+		if ($id == '') {
1304
+			return array();
1305
+		}
1204 1306
 		$additional_query = "spotter_output.spotter_id = :id";
1205 1307
 		$query_values = array(':id' => $id);
1206 1308
 
@@ -1937,7 +2039,9 @@  discard block
 block discarded – undo
1937 2039
 		{
1938 2040
 			$highlight = $row['highlight'];
1939 2041
 		}
1940
-		if (isset($highlight)) return $highlight;
2042
+		if (isset($highlight)) {
2043
+			return $highlight;
2044
+		}
1941 2045
 	}
1942 2046
 
1943 2047
 	
@@ -1965,7 +2069,9 @@  discard block
 block discarded – undo
1965 2069
 		$sth->closeCursor();
1966 2070
 		if (count($row) > 0) {
1967 2071
 			return $row['usage'];
1968
-		} else return '';
2072
+		} else {
2073
+			return '';
2074
+		}
1969 2075
 	}
1970 2076
 
1971 2077
 	/**
@@ -1990,7 +2096,9 @@  discard block
 block discarded – undo
1990 2096
 		$sth->closeCursor();
1991 2097
 		if (count($row) > 0) {
1992 2098
 			return $row['icao'];
1993
-		} else return '';
2099
+		} else {
2100
+			return '';
2101
+		}
1994 2102
 	}
1995 2103
 
1996 2104
 	/**
@@ -2018,7 +2126,9 @@  discard block
 block discarded – undo
2018 2126
 			$airport_longitude = $row['longitude'];
2019 2127
 			$Common = new Common();
2020 2128
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2021
-		} else return '';
2129
+		} else {
2130
+			return '';
2131
+		}
2022 2132
 	}
2023 2133
 	
2024 2134
 	/**
@@ -2130,7 +2240,9 @@  discard block
 block discarded – undo
2130 2240
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2131 2241
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2132 2242
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2133
-		} else return array();
2243
+		} else {
2244
+			return array();
2245
+		}
2134 2246
 		if ($globalDBdriver == 'mysql') {
2135 2247
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2136 2248
 		} else {
@@ -2165,7 +2277,9 @@  discard block
 block discarded – undo
2165 2277
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2166 2278
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2167 2279
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2168
-		} else return array();
2280
+		} else {
2281
+			return array();
2282
+		}
2169 2283
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2170 2284
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2171 2285
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2200,7 +2314,9 @@  discard block
 block discarded – undo
2200 2314
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2201 2315
 	{
2202 2316
 		global $globalUseRealAirlines;
2203
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2317
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2318
+			$fromsource = NULL;
2319
+		}
2204 2320
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2205 2321
 		if ($airline_icao == 'NA') {
2206 2322
 			$airline_array = array();
@@ -2269,7 +2385,9 @@  discard block
 block discarded – undo
2269 2385
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2270 2386
 	{
2271 2387
 		global $globalUseRealAirlines;
2272
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2388
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2389
+			$fromsource = NULL;
2390
+		}
2273 2391
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2274 2392
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2275 2393
 		$sth = $this->db->prepare($query);
@@ -2285,7 +2403,9 @@  discard block
 block discarded – undo
2285 2403
 			$sth->execute(array(':fromsource' => $fromsource));
2286 2404
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2287 2405
 			$sth->closeCursor();
2288
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2406
+			if ($row['nb'] == 0) {
2407
+				$result = $this->getAllAirlineInfoByName($airline_name);
2408
+			}
2289 2409
 		}
2290 2410
 		return $result;
2291 2411
 	}
@@ -2348,15 +2468,20 @@  discard block
 block discarded – undo
2348 2468
 				'A320-211' => 'A320',
2349 2469
 				'747-8i' => 'B748',
2350 2470
 				'A380' => 'A388');
2351
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2471
+		if (isset($all_aircraft[$aircraft_type])) {
2472
+			return $all_aircraft[$aircraft_type];
2473
+		}
2352 2474
 
2353 2475
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2354 2476
 		$aircraft_type = strtoupper($aircraft_type);
2355 2477
 		$sth = $this->db->prepare($query);
2356 2478
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2357 2479
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2358
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2359
-		else return '';
2480
+		if (isset($result[0]['icao'])) {
2481
+			return $result[0]['icao'];
2482
+		} else {
2483
+			return '';
2484
+		}
2360 2485
 	}
2361 2486
 	
2362 2487
 	/**
@@ -2379,9 +2504,13 @@  discard block
 block discarded – undo
2379 2504
 		$sth->closeCursor();
2380 2505
 		if (isset($row['icaotypecode'])) {
2381 2506
 			$icao = $row['icaotypecode'];
2382
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2507
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2508
+				$icao = $this->aircraft_correct_icaotype[$icao];
2509
+			}
2383 2510
 			return $icao;
2384
-		} else return '';
2511
+		} else {
2512
+			return '';
2513
+		}
2385 2514
 	}
2386 2515
 
2387 2516
 	/**
@@ -2404,7 +2533,9 @@  discard block
 block discarded – undo
2404 2533
 		$sth->closeCursor();
2405 2534
 		if (isset($row['icaotypecode'])) {
2406 2535
 			return $row['icaotypecode'];
2407
-		} else return '';
2536
+		} else {
2537
+			return '';
2538
+		}
2408 2539
 	}
2409 2540
 
2410 2541
 	/**
@@ -2450,7 +2581,9 @@  discard block
 block discarded – undo
2450 2581
 		$sth->closeCursor();
2451 2582
 		if (isset($row['operator_correct'])) {
2452 2583
 			return $row['operator_correct'];
2453
-		} else return $operator;
2584
+		} else {
2585
+			return $operator;
2586
+		}
2454 2587
 	}
2455 2588
 
2456 2589
 	/**
@@ -2463,7 +2596,9 @@  discard block
 block discarded – undo
2463 2596
 	public function getRouteInfo($callsign)
2464 2597
 	{
2465 2598
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2466
-                if ($callsign == '') return array();
2599
+                if ($callsign == '') {
2600
+                	return array();
2601
+                }
2467 2602
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2468 2603
 		
2469 2604
 		$sth = $this->db->prepare($query);
@@ -2473,7 +2608,9 @@  discard block
 block discarded – undo
2473 2608
 		$sth->closeCursor();
2474 2609
 		if (count($row) > 0) {
2475 2610
 			return $row;
2476
-		} else return array();
2611
+		} else {
2612
+			return array();
2613
+		}
2477 2614
 	}
2478 2615
 	
2479 2616
 	/**
@@ -2526,7 +2663,9 @@  discard block
 block discarded – undo
2526 2663
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2527 2664
 			$sth->closeCursor();
2528 2665
 			return $result;
2529
-		} else return array();
2666
+		} else {
2667
+			return array();
2668
+		}
2530 2669
 	}
2531 2670
 	
2532 2671
   
@@ -2685,8 +2824,11 @@  discard block
 block discarded – undo
2685 2824
 		$query .= " ORDER BY spotter_output.source_name ASC";
2686 2825
 
2687 2826
 		$sth = $this->db->prepare($query);
2688
-		if (!empty($query_values)) $sth->execute($query_values);
2689
-		else $sth->execute();
2827
+		if (!empty($query_values)) {
2828
+			$sth->execute($query_values);
2829
+		} else {
2830
+			$sth->execute();
2831
+		}
2690 2832
 
2691 2833
 		$source_array = array();
2692 2834
 		$temp_array = array();
@@ -2719,9 +2861,13 @@  discard block
 block discarded – undo
2719 2861
 								WHERE spotter_output.airline_icao <> '' 
2720 2862
 								ORDER BY spotter_output.airline_name ASC";
2721 2863
 			*/
2722
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2723
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2724
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2864
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2865
+				$forsource = $globalAirlinesSource;
2866
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2867
+				$forsource = 'vatsim';
2868
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2869
+				$forsource = 'ivao';
2870
+			}
2725 2871
 			if ($forsource === NULL) {
2726 2872
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2727 2873
 				$query_data = array();
@@ -2764,9 +2910,13 @@  discard block
 block discarded – undo
2764 2910
 	{
2765 2911
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766 2912
 		$filter_query = $this->getFilter($filters,true,true);
2767
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2768
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2769
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2913
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2914
+			$forsource = $globalAirlinesSource;
2915
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2916
+			$forsource = 'vatsim';
2917
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2918
+			$forsource = 'ivao';
2919
+		}
2770 2920
 		if ($forsource === NULL) {
2771 2921
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2772 2922
 			$query_data = array();
@@ -3041,7 +3191,9 @@  discard block
 block discarded – undo
3041 3191
 			date_default_timezone_set($globalTimezone);
3042 3192
 			$datetime = new DateTime();
3043 3193
 			$offset = $datetime->format('P');
3044
-		} else $offset = '+00:00';
3194
+		} else {
3195
+			$offset = '+00:00';
3196
+		}
3045 3197
 		if ($airport_icao == '') {
3046 3198
 			if ($globalDBdriver == 'mysql') {
3047 3199
 				$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";
@@ -3073,7 +3225,9 @@  discard block
 block discarded – undo
3073 3225
 			date_default_timezone_set($globalTimezone);
3074 3226
 			$datetime = new DateTime();
3075 3227
 			$offset = $datetime->format('P');
3076
-		} else $offset = '+00:00';
3228
+		} else {
3229
+			$offset = '+00:00';
3230
+		}
3077 3231
 		if ($airport_icao == '') {
3078 3232
 			if ($globalDBdriver == 'mysql') {
3079 3233
 				$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";
@@ -3106,7 +3260,9 @@  discard block
 block discarded – undo
3106 3260
 			date_default_timezone_set($globalTimezone);
3107 3261
 			$datetime = new DateTime();
3108 3262
 			$offset = $datetime->format('P');
3109
-		} else $offset = '+00:00';
3263
+		} else {
3264
+			$offset = '+00:00';
3265
+		}
3110 3266
 		if ($airport_icao == '') {
3111 3267
 			if ($globalDBdriver == 'mysql') {
3112 3268
 				$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 
@@ -3145,7 +3301,9 @@  discard block
 block discarded – undo
3145 3301
 			date_default_timezone_set($globalTimezone);
3146 3302
 			$datetime = new DateTime();
3147 3303
 			$offset = $datetime->format('P');
3148
-		} else $offset = '+00:00';
3304
+		} else {
3305
+			$offset = '+00:00';
3306
+		}
3149 3307
 		if ($airport_icao == '') {
3150 3308
 			if ($globalDBdriver == 'mysql') {
3151 3309
 				$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 
@@ -3190,7 +3348,9 @@  discard block
 block discarded – undo
3190 3348
 			date_default_timezone_set($globalTimezone);
3191 3349
 			$datetime = new DateTime();
3192 3350
 			$offset = $datetime->format('P');
3193
-		} else $offset = '+00:00';
3351
+		} else {
3352
+			$offset = '+00:00';
3353
+		}
3194 3354
 		if ($airport_icao == '') {
3195 3355
 			if ($globalDBdriver == 'mysql') {
3196 3356
 				$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";
@@ -3225,7 +3385,9 @@  discard block
 block discarded – undo
3225 3385
 			date_default_timezone_set($globalTimezone);
3226 3386
 			$datetime = new DateTime();
3227 3387
 			$offset = $datetime->format('P');
3228
-		} else $offset = '+00:00';
3388
+		} else {
3389
+			$offset = '+00:00';
3390
+		}
3229 3391
 		if ($airport_icao == '') {
3230 3392
 			if ($globalDBdriver == 'mysql') {
3231 3393
 				$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 
@@ -3267,7 +3429,9 @@  discard block
 block discarded – undo
3267 3429
 			date_default_timezone_set($globalTimezone);
3268 3430
 			$datetime = new DateTime();
3269 3431
 			$offset = $datetime->format('P');
3270
-		} else $offset = '+00:00';
3432
+		} else {
3433
+			$offset = '+00:00';
3434
+		}
3271 3435
 		if ($airport_icao == '') {
3272 3436
 			if ($globalDBdriver == 'mysql') {
3273 3437
 				$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";
@@ -3301,7 +3465,9 @@  discard block
 block discarded – undo
3301 3465
 			date_default_timezone_set($globalTimezone);
3302 3466
 			$datetime = new DateTime();
3303 3467
 			$offset = $datetime->format('P');
3304
-		} else $offset = '+00:00';
3468
+		} else {
3469
+			$offset = '+00:00';
3470
+		}
3305 3471
 		if ($airport_icao == '') {
3306 3472
 			if ($globalDBdriver == 'mysql') {
3307 3473
 				$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 
@@ -3349,7 +3515,9 @@  discard block
 block discarded – undo
3349 3515
 			date_default_timezone_set($globalTimezone);
3350 3516
 			$datetime = new DateTime();
3351 3517
 			$offset = $datetime->format('P');
3352
-		} else $offset = '+00:00';
3518
+		} else {
3519
+			$offset = '+00:00';
3520
+		}
3353 3521
 
3354 3522
 		if ($globalDBdriver == 'mysql') {
3355 3523
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3469,7 +3637,9 @@  discard block
 block discarded – undo
3469 3637
 	*/	
3470 3638
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3471 3639
 	{
3472
-		if ($groundspeed == '') $groundspeed = NULL;
3640
+		if ($groundspeed == '') {
3641
+			$groundspeed = NULL;
3642
+		}
3473 3643
 		$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';
3474 3644
                 $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);
3475 3645
 
@@ -3519,10 +3689,18 @@  discard block
 block discarded – undo
3519 3689
 		$Image = new Image($this->db);
3520 3690
 		$Common = new Common();
3521 3691
 		
3522
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3523
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3524
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3525
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3692
+		if (!isset($globalIVAO)) {
3693
+			$globalIVAO = FALSE;
3694
+		}
3695
+		if (!isset($globalVATSIM)) {
3696
+			$globalVATSIM = FALSE;
3697
+		}
3698
+		if (!isset($globalphpVMS)) {
3699
+			$globalphpVMS = FALSE;
3700
+		}
3701
+		if (!isset($globalVAM)) {
3702
+			$globalVAM = FALSE;
3703
+		}
3526 3704
 		date_default_timezone_set('UTC');
3527 3705
 		
3528 3706
 		//getting the registration
@@ -3535,23 +3713,33 @@  discard block
 block discarded – undo
3535 3713
 				if ($ModeS != '') {
3536 3714
 					$timeelapsed = microtime(true);
3537 3715
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3538
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3716
+					if ($globalDebugTimeElapsed) {
3717
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3718
+					}
3539 3719
 				} else {
3540 3720
 					$myhex = explode('-',$flightaware_id);
3541 3721
 					if (count($myhex) > 0) {
3542 3722
 						$timeelapsed = microtime(true);
3543 3723
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3544
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3724
+						if ($globalDebugTimeElapsed) {
3725
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3726
+						}
3545 3727
 					}
3546 3728
 				}
3547 3729
 			}
3548 3730
 		}
3549 3731
 		$fromsource = NULL;
3550
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3551
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3552
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3553
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3554
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3732
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3733
+			$fromsource = $globalAirlinesSource;
3734
+		} elseif ($format_source == 'vatsimtxt') {
3735
+			$fromsource = 'vatsim';
3736
+		} elseif ($format_source == 'whazzup') {
3737
+			$fromsource = 'ivao';
3738
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3739
+			$fromsource = 'vatsim';
3740
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3741
+			$fromsource = 'ivao';
3742
+		}
3555 3743
 		//getting the airline information
3556 3744
 		if ($ident != "")
3557 3745
 		{
@@ -3575,15 +3763,21 @@  discard block
 block discarded – undo
3575 3763
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3576 3764
 						$airline_array = $this->getAllAirlineInfo("NA");
3577 3765
 					}
3578
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3766
+					if ($globalDebugTimeElapsed) {
3767
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3768
+					}
3579 3769
 
3580 3770
 				} else {
3581 3771
 					$timeelapsed = microtime(true);
3582 3772
 					$airline_array = $this->getAllAirlineInfo("NA");
3583
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3773
+					if ($globalDebugTimeElapsed) {
3774
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3775
+					}
3584 3776
 				}
3585 3777
 			}
3586
-		} else $airline_array = array();
3778
+		} else {
3779
+			$airline_array = array();
3780
+		}
3587 3781
 		
3588 3782
 		//getting the aircraft information
3589 3783
 		$aircraft_array = array();
@@ -3597,27 +3791,37 @@  discard block
 block discarded – undo
3597 3791
 				{
3598 3792
 					$timeelapsed = microtime(true);
3599 3793
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3600
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3794
+					if ($globalDebugTimeElapsed) {
3795
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3796
+					}
3601 3797
 				} else {
3602 3798
 					$timeelapsed = microtime(true);
3603 3799
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3604
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3800
+					if ($globalDebugTimeElapsed) {
3801
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3802
+					}
3605 3803
 				}
3606 3804
 			}
3607 3805
 		} else {
3608 3806
 			if ($ModeS != '') {
3609 3807
 				$timeelapsed = microtime(true);
3610 3808
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3611
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3809
+				if ($globalDebugTimeElapsed) {
3810
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3811
+				}
3612 3812
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3613 3813
 				{
3614 3814
 					$timeelapsed = microtime(true);
3615 3815
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3616
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3816
+					if ($globalDebugTimeElapsed) {
3817
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3818
+					}
3617 3819
 				} else {
3618 3820
 					$timeelapsed = microtime(true);
3619 3821
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3620
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3822
+					if ($globalDebugTimeElapsed) {
3823
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3824
+					}
3621 3825
 				}
3622 3826
 			}
3623 3827
 		}
@@ -3633,7 +3837,9 @@  discard block
 block discarded – undo
3633 3837
 			} else {
3634 3838
 				$timeelapsed = microtime(true);
3635 3839
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3636
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3840
+				if ($globalDebugTimeElapsed) {
3841
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3842
+				}
3637 3843
 			}
3638 3844
 		}
3639 3845
 		
@@ -3648,7 +3854,9 @@  discard block
 block discarded – undo
3648 3854
 			} else {
3649 3855
 				$timeelapsed = microtime(true);
3650 3856
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3651
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3857
+				if ($globalDebugTimeElapsed) {
3858
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3859
+				}
3652 3860
 			}
3653 3861
 		}
3654 3862
 
@@ -3682,7 +3890,9 @@  discard block
 block discarded – undo
3682 3890
 			{
3683 3891
 				return false;
3684 3892
 			}
3685
-		} else $altitude = 0;
3893
+		} else {
3894
+			$altitude = 0;
3895
+		}
3686 3896
 		
3687 3897
 		if ($heading != "")
3688 3898
 		{
@@ -3711,7 +3921,9 @@  discard block
 block discarded – undo
3711 3921
 		{
3712 3922
 			$timeelapsed = microtime(true);
3713 3923
 			$image_array = $Image->getSpotterImage($registration);
3714
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3924
+			if ($globalDebugTimeElapsed) {
3925
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3926
+			}
3715 3927
 			if (!isset($image_array[0]['registration']))
3716 3928
 			{
3717 3929
 				//echo "Add image !!!! \n";
@@ -3719,14 +3931,21 @@  discard block
 block discarded – undo
3719 3931
 			}
3720 3932
 			$timeelapsed = microtime(true);
3721 3933
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3722
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3723
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3934
+			if ($globalDebugTimeElapsed) {
3935
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3936
+			}
3937
+			if ($owner_info['owner'] != '') {
3938
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3939
+			}
3724 3940
 		}
3725 3941
     
3726 3942
 		if ($globalIVAO && $aircraft_icao != '')
3727 3943
 		{
3728
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3729
-            		else $airline_icao = '';
3944
+            		if (isset($airline_array[0]['icao'])) {
3945
+            			$airline_icao = $airline_array[0]['icao'];
3946
+            		} else {
3947
+            			$airline_icao = '';
3948
+            		}
3730 3949
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3731 3950
 			if (!isset($image_array[0]['registration']))
3732 3951
 			{
@@ -3771,16 +3990,28 @@  discard block
 block discarded – undo
3771 3990
                 {
3772 3991
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3773 3992
                 }
3774
-                if ($registration == '') $registration = 'NA';
3993
+                if ($registration == '') {
3994
+                	$registration = 'NA';
3995
+                }
3775 3996
                 if ($latitude == '' && $longitude == '') {
3776 3997
             		$latitude = 0;
3777 3998
             		$longitude = 0;
3778 3999
             	}
3779
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3780
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3781
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3782
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3783
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4000
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4001
+                	$squawk = NULL;
4002
+                }
4003
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4004
+                	$verticalrate = NULL;
4005
+                }
4006
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4007
+                	$heading = 0;
4008
+                }
4009
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4010
+                	$groundspeed = 0;
4011
+                }
4012
+                if (!isset($aircraft_owner)) {
4013
+                	$aircraft_owner = NULL;
4014
+                }
3784 4015
                 $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) 
3785 4016
                 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)";
3786 4017
 
@@ -3791,9 +4022,13 @@  discard block
 block discarded – undo
3791 4022
 		if ($airline_type == '') {
3792 4023
 			$timeelapsed = microtime(true);
3793 4024
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3794
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4025
+			if ($globalDebugTimeElapsed) {
4026
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4027
+			}
4028
+		}
4029
+		if ($airline_type == null) {
4030
+			$airline_type = '';
3795 4031
 		}
3796
-		if ($airline_type == null) $airline_type = '';
3797 4032
                 $aircraft_type = $aircraft_array[0]['type'];
3798 4033
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3799 4034
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3957,7 +4192,9 @@  discard block
 block discarded – undo
3957 4192
 			}
3958 4193
 		}
3959 4194
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3960
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4195
+		if ($limit) {
4196
+			$query .= " LIMIT 10 OFFSET 0";
4197
+		}
3961 4198
 
3962 4199
 		$sth = $this->db->prepare($query);
3963 4200
 		$sth->execute($query_values);
@@ -4030,7 +4267,9 @@  discard block
 block discarded – undo
4030 4267
 		}
4031 4268
 		
4032 4269
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4033
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4270
+		if ($limit) {
4271
+			$query .= " LIMIT 10 OFFSET 0";
4272
+		}
4034 4273
       
4035 4274
 		
4036 4275
 		$sth = $this->db->prepare($query);
@@ -4074,7 +4313,9 @@  discard block
 block discarded – undo
4074 4313
 			}
4075 4314
 		}
4076 4315
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4077
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4316
+		if ($limit) {
4317
+			$query .= " LIMIT 10 OFFSET 0";
4318
+		}
4078 4319
       
4079 4320
 		
4080 4321
 		$sth = $this->db->prepare($query);
@@ -4150,7 +4391,9 @@  discard block
 block discarded – undo
4150 4391
 			}
4151 4392
 		}
4152 4393
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4153
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4394
+		if ($limit) {
4395
+			$query .= " LIMIT 10 OFFSET 0";
4396
+		}
4154 4397
 		
4155 4398
 		$sth = $this->db->prepare($query);
4156 4399
 		$sth->execute($query_values);
@@ -4192,7 +4435,9 @@  discard block
 block discarded – undo
4192 4435
 			}
4193 4436
 		}
4194 4437
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4195
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4438
+		if ($limit) {
4439
+			$query .= " LIMIT 10 OFFSET 0";
4440
+		}
4196 4441
       
4197 4442
 		
4198 4443
 		$sth = $this->db->prepare($query);
@@ -4435,7 +4680,9 @@  discard block
 block discarded – undo
4435 4680
 			date_default_timezone_set($globalTimezone);
4436 4681
 			$datetime = new DateTime($date);
4437 4682
 			$offset = $datetime->format('P');
4438
-		} else $offset = '+00:00';
4683
+		} else {
4684
+			$offset = '+00:00';
4685
+		}
4439 4686
 
4440 4687
 		if ($globalDBdriver == 'mysql') {
4441 4688
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4483,7 +4730,9 @@  discard block
 block discarded – undo
4483 4730
 			date_default_timezone_set($globalTimezone);
4484 4731
 			$datetime = new DateTime($date);
4485 4732
 			$offset = $datetime->format('P');
4486
-		} else $offset = '+00:00';
4733
+		} else {
4734
+			$offset = '+00:00';
4735
+		}
4487 4736
 		
4488 4737
 		if ($globalDBdriver == 'mysql') {
4489 4738
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4759,7 +5008,9 @@  discard block
 block discarded – undo
4759 5008
 		}
4760 5009
 		$query .= " GROUP BY spotter_output.airline_country
4761 5010
 					ORDER BY airline_country_count DESC";
4762
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5011
+		if ($limit) {
5012
+			$query .= " LIMIT 10 OFFSET 0";
5013
+		}
4763 5014
       
4764 5015
 		$sth = $this->db->prepare($query);
4765 5016
 		$sth->execute($query_values);
@@ -4787,7 +5038,9 @@  discard block
 block discarded – undo
4787 5038
 		global $globalDBdriver;
4788 5039
 		//$filter_query = $this->getFilter($filters,true,true);
4789 5040
 		$Connection= new Connection($this->db);
4790
-		if (!$Connection->tableExists('countries')) return array();
5041
+		if (!$Connection->tableExists('countries')) {
5042
+			return array();
5043
+		}
4791 5044
 		/*
4792 5045
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4793 5046
 					FROM countries c, spotter_output s
@@ -4819,7 +5072,9 @@  discard block
 block discarded – undo
4819 5072
 		}
4820 5073
 		$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 ";
4821 5074
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4822
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5075
+		if ($limit) {
5076
+			$query .= " LIMIT 10 OFFSET 0";
5077
+		}
4823 5078
       
4824 5079
 		
4825 5080
 		$sth = $this->db->prepare($query);
@@ -4896,7 +5151,9 @@  discard block
 block discarded – undo
4896 5151
 		}
4897 5152
 
4898 5153
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4899
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5154
+		if ($limit) {
5155
+			$query .= " LIMIT 10 OFFSET 0";
5156
+		}
4900 5157
  
4901 5158
 		$sth = $this->db->prepare($query);
4902 5159
 		$sth->execute($query_values);
@@ -4970,7 +5227,9 @@  discard block
 block discarded – undo
4970 5227
 		}
4971 5228
 
4972 5229
 		$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";
4973
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5230
+		if ($limit) {
5231
+			$query .= " LIMIT 10 OFFSET 0";
5232
+		}
4974 5233
  
4975 5234
 		$sth = $this->db->prepare($query);
4976 5235
 		$sth->execute($query_values);
@@ -5017,7 +5276,9 @@  discard block
 block discarded – undo
5017 5276
 		}
5018 5277
 
5019 5278
 		$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";
5020
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5279
+		if ($limit) {
5280
+			$query .= " LIMIT 10 OFFSET 0";
5281
+		}
5021 5282
  
5022 5283
 		$sth = $this->db->prepare($query);
5023 5284
 		$sth->execute();
@@ -5070,7 +5331,9 @@  discard block
 block discarded – undo
5070 5331
 			if($row['registration'] != "")
5071 5332
 			{
5072 5333
 				$image_array = $Image->getSpotterImage($row['registration']);
5073
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5334
+				if (isset($image_array[0]['image_thumbnail'])) {
5335
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5336
+				}
5074 5337
 			}
5075 5338
 			$temp_array['registration_count'] = $row['registration_count'];
5076 5339
 
@@ -5145,7 +5408,9 @@  discard block
 block discarded – undo
5145 5408
 			if($row['registration'] != "")
5146 5409
 			{
5147 5410
 				$image_array = $Image->getSpotterImage($row['registration']);
5148
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5411
+				if (isset($image_array[0]['image_thumbnail'])) {
5412
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5413
+				}
5149 5414
 			}
5150 5415
 			$temp_array['registration_count'] = $row['registration_count'];
5151 5416
 
@@ -5252,7 +5517,9 @@  discard block
 block discarded – undo
5252 5517
 			if($row['registration'] != "")
5253 5518
 			{
5254 5519
 				$image_array = $Image->getSpotterImage($row['registration']);
5255
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5520
+				if (isset($image_array[0]['image_thumbnail'])) {
5521
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5522
+				}
5256 5523
 			}
5257 5524
 			$temp_array['registration_count'] = $row['registration_count'];
5258 5525
 			$aircraft_array[] = $temp_array;
@@ -5377,7 +5644,9 @@  discard block
 block discarded – undo
5377 5644
 			date_default_timezone_set($globalTimezone);
5378 5645
 			$datetime = new DateTime($date);
5379 5646
 			$offset = $datetime->format('P');
5380
-		} else $offset = '+00:00';
5647
+		} else {
5648
+			$offset = '+00:00';
5649
+		}
5381 5650
 
5382 5651
 		if ($globalDBdriver == 'mysql') {
5383 5652
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5424,7 +5693,9 @@  discard block
 block discarded – undo
5424 5693
 			date_default_timezone_set($globalTimezone);
5425 5694
 			$datetime = new DateTime($date);
5426 5695
 			$offset = $datetime->format('P');
5427
-		} else $offset = '+00:00';
5696
+		} else {
5697
+			$offset = '+00:00';
5698
+		}
5428 5699
 
5429 5700
 		if ($globalDBdriver == 'mysql') {
5430 5701
 			$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 
@@ -5453,7 +5724,9 @@  discard block
 block discarded – undo
5453 5724
 			if($row['registration'] != "")
5454 5725
 			{
5455 5726
 				$image_array = $Image->getSpotterImage($row['registration']);
5456
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5727
+				if (isset($image_array[0]['image_thumbnail'])) {
5728
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5729
+				}
5457 5730
 			}
5458 5731
 			$temp_array['registration_count'] = $row['registration_count'];
5459 5732
  
@@ -5478,7 +5751,9 @@  discard block
 block discarded – undo
5478 5751
 			date_default_timezone_set($globalTimezone);
5479 5752
 			$datetime = new DateTime($date);
5480 5753
 			$offset = $datetime->format('P');
5481
-		} else $offset = '+00:00';
5754
+		} else {
5755
+			$offset = '+00:00';
5756
+		}
5482 5757
 
5483 5758
 		if ($globalDBdriver == 'mysql') {
5484 5759
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5616,8 +5891,11 @@  discard block
 block discarded – undo
5616 5891
 			if($row['registration'] != "")
5617 5892
 			{
5618 5893
 				$image_array = $Image->getSpotterImage($row['registration']);
5619
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5620
-				else $temp_array['image_thumbnail'] = '';
5894
+				if (isset($image_array[0]['image_thumbnail'])) {
5895
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5896
+				} else {
5897
+					$temp_array['image_thumbnail'] = '';
5898
+				}
5621 5899
 			}
5622 5900
 			$temp_array['registration_count'] = $row['registration_count'];
5623 5901
 			$aircraft_array[] = $temp_array;
@@ -5660,8 +5938,11 @@  discard block
 block discarded – undo
5660 5938
 			if($row['registration'] != "")
5661 5939
 			{
5662 5940
 				$image_array = $Image->getSpotterImage($row['registration']);
5663
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5664
-				else $temp_array['image_thumbnail'] = '';
5941
+				if (isset($image_array[0]['image_thumbnail'])) {
5942
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5943
+				} else {
5944
+					$temp_array['image_thumbnail'] = '';
5945
+				}
5665 5946
 			}
5666 5947
 			$temp_array['registration_count'] = $row['registration_count'];
5667 5948
 			$aircraft_array[] = $temp_array;
@@ -5704,8 +5985,11 @@  discard block
 block discarded – undo
5704 5985
 			if($row['registration'] != "")
5705 5986
 			{
5706 5987
 				$image_array = $Image->getSpotterImage($row['registration']);
5707
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5708
-				else $temp_array['image_thumbnail'] = '';
5988
+				if (isset($image_array[0]['image_thumbnail'])) {
5989
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5990
+				} else {
5991
+					$temp_array['image_thumbnail'] = '';
5992
+				}
5709 5993
 			}
5710 5994
 			$temp_array['registration_count'] = $row['registration_count'];
5711 5995
 			$aircraft_array[] = $temp_array;
@@ -5854,7 +6138,9 @@  discard block
 block discarded – undo
5854 6138
 			if($row['registration'] != "")
5855 6139
 			{
5856 6140
 				$image_array = $Image->getSpotterImage($row['registration']);
5857
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6141
+				if (isset($image_array[0]['image_thumbnail'])) {
6142
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6143
+				}
5858 6144
 			}
5859 6145
 			$temp_array['registration_count'] = $row['registration_count'];
5860 6146
           
@@ -5971,7 +6257,9 @@  discard block
 block discarded – undo
5971 6257
 			if($row['registration'] != "")
5972 6258
 			{
5973 6259
 				$image_array = $Image->getSpotterImage($row['registration']);
5974
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6260
+				if (isset($image_array[0]['image_thumbnail'])) {
6261
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6262
+				}
5975 6263
 			}
5976 6264
 			$temp_array['registration_count'] = $row['registration_count'];
5977 6265
           
@@ -6137,7 +6425,9 @@  discard block
 block discarded – undo
6137 6425
 			}
6138 6426
 		}
6139 6427
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6140
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6428
+		if ($limit) {
6429
+			$query .= " LIMIT 10 OFFSET 0";
6430
+		}
6141 6431
 		
6142 6432
 		$sth = $this->db->prepare($query);
6143 6433
 		$sth->execute($query_values);
@@ -6156,7 +6446,9 @@  discard block
 block discarded – undo
6156 6446
 			if($row['registration'] != "")
6157 6447
 			{
6158 6448
 				$image_array = $Image->getSpotterImage($row['registration']);
6159
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6449
+				if (isset($image_array[0]['image_thumbnail'])) {
6450
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6451
+				}
6160 6452
 			}
6161 6453
           
6162 6454
 			$aircraft_array[] = $temp_array;
@@ -6197,7 +6489,9 @@  discard block
 block discarded – undo
6197 6489
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6198 6490
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6199 6491
                 $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";
6200
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6492
+		if ($limit) {
6493
+			$query .= " LIMIT 10 OFFSET 0";
6494
+		}
6201 6495
 		
6202 6496
 		$sth = $this->db->prepare($query);
6203 6497
 		$sth->execute();
@@ -6217,7 +6511,9 @@  discard block
 block discarded – undo
6217 6511
 			if($row['registration'] != "")
6218 6512
 			{
6219 6513
 				$image_array = $Image->getSpotterImage($row['registration']);
6220
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6514
+				if (isset($image_array[0]['image_thumbnail'])) {
6515
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6516
+				}
6221 6517
 			}
6222 6518
           
6223 6519
 			$aircraft_array[] = $temp_array;
@@ -6283,7 +6579,9 @@  discard block
 block discarded – undo
6283 6579
 		}
6284 6580
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6285 6581
 				ORDER BY airport_departure_icao_count DESC";
6286
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6582
+		if ($limit) {
6583
+			$query .= " LIMIT 10 OFFSET 0";
6584
+		}
6287 6585
 
6288 6586
 		$sth = $this->db->prepare($query);
6289 6587
 		$sth->execute($query_values);
@@ -6334,7 +6632,9 @@  discard block
 block discarded – undo
6334 6632
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6335 6633
                 $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
6336 6634
 				ORDER BY airport_departure_icao_count DESC";
6337
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6635
+		if ($limit) {
6636
+			$query .= " LIMIT 10 OFFSET 0";
6637
+		}
6338 6638
       
6339 6639
 		$sth = $this->db->prepare($query);
6340 6640
 		$sth->execute();
@@ -6412,7 +6712,9 @@  discard block
 block discarded – undo
6412 6712
 		}
6413 6713
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6414 6714
 				ORDER BY airport_departure_icao_count DESC";
6415
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6715
+		if ($limit) {
6716
+			$query .= " LIMIT 10 OFFSET 0";
6717
+		}
6416 6718
     		//echo $query;
6417 6719
 		$sth = $this->db->prepare($query);
6418 6720
 		$sth->execute($query_values);
@@ -6464,7 +6766,9 @@  discard block
 block discarded – undo
6464 6766
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6465 6767
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6466 6768
 				ORDER BY airport_departure_icao_count DESC";
6467
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6769
+		if ($limit) {
6770
+			$query .= " LIMIT 10 OFFSET 0";
6771
+		}
6468 6772
       
6469 6773
 		$sth = $this->db->prepare($query);
6470 6774
 		$sth->execute();
@@ -6859,7 +7163,9 @@  discard block
 block discarded – undo
6859 7163
 			date_default_timezone_set($globalTimezone);
6860 7164
 			$datetime = new DateTime($date);
6861 7165
 			$offset = $datetime->format('P');
6862
-		} else $offset = '+00:00';
7166
+		} else {
7167
+			$offset = '+00:00';
7168
+		}
6863 7169
 
6864 7170
 		if ($globalDBdriver == 'mysql') {
6865 7171
 			$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 
@@ -6909,7 +7215,9 @@  discard block
 block discarded – undo
6909 7215
 			date_default_timezone_set($globalTimezone);
6910 7216
 			$datetime = new DateTime($date);
6911 7217
 			$offset = $datetime->format('P');
6912
-		} else $offset = '+00:00';
7218
+		} else {
7219
+			$offset = '+00:00';
7220
+		}
6913 7221
 
6914 7222
 		if ($globalDBdriver == 'mysql') {
6915 7223
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7258,7 +7566,9 @@  discard block
 block discarded – undo
7258 7566
 		}
7259 7567
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7260 7568
 					ORDER BY airport_arrival_icao_count DESC";
7261
-		if ($limit) $query .= " LIMIT 10";
7569
+		if ($limit) {
7570
+			$query .= " LIMIT 10";
7571
+		}
7262 7572
       
7263 7573
 		
7264 7574
 		$sth = $this->db->prepare($query);
@@ -7278,7 +7588,9 @@  discard block
 block discarded – undo
7278 7588
 			if ($icaoaskey) {
7279 7589
 				$icao = $row['arrival_airport_icao'];
7280 7590
 				$airport_array[$icao] = $temp_array;
7281
-			} else $airport_array[] = $temp_array;
7591
+			} else {
7592
+				$airport_array[] = $temp_array;
7593
+			}
7282 7594
 		}
7283 7595
 
7284 7596
 		return $airport_array;
@@ -7315,7 +7627,9 @@  discard block
 block discarded – undo
7315 7627
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7316 7628
                 $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
7317 7629
 					ORDER BY airport_arrival_icao_count DESC";
7318
-		if ($limit) $query .= " LIMIT 10";
7630
+		if ($limit) {
7631
+			$query .= " LIMIT 10";
7632
+		}
7319 7633
       
7320 7634
 		
7321 7635
 		$sth = $this->db->prepare($query);
@@ -7336,7 +7650,9 @@  discard block
 block discarded – undo
7336 7650
 			if ($icaoaskey) {
7337 7651
 				$icao = $row['arrival_airport_icao'];
7338 7652
 				$airport_array[$icao] = $temp_array;
7339
-			} else $airport_array[] = $temp_array;
7653
+			} else {
7654
+				$airport_array[] = $temp_array;
7655
+			}
7340 7656
 		}
7341 7657
 
7342 7658
 		return $airport_array;
@@ -7399,7 +7715,9 @@  discard block
 block discarded – undo
7399 7715
 		}
7400 7716
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7401 7717
 					ORDER BY airport_arrival_icao_count DESC";
7402
-		if ($limit) $query .= " LIMIT 10";
7718
+		if ($limit) {
7719
+			$query .= " LIMIT 10";
7720
+		}
7403 7721
       
7404 7722
 		
7405 7723
 		$sth = $this->db->prepare($query);
@@ -7418,7 +7736,9 @@  discard block
 block discarded – undo
7418 7736
 			if ($icaoaskey) {
7419 7737
 				$icao = $row['arrival_airport_icao'];
7420 7738
 				$airport_array[$icao] = $temp_array;
7421
-			} else $airport_array[] = $temp_array;
7739
+			} else {
7740
+				$airport_array[] = $temp_array;
7741
+			}
7422 7742
 		}
7423 7743
 
7424 7744
 		return $airport_array;
@@ -7455,7 +7775,9 @@  discard block
 block discarded – undo
7455 7775
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7456 7776
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7457 7777
 					ORDER BY airport_arrival_icao_count DESC";
7458
-		if ($limit) $query .= " LIMIT 10";
7778
+		if ($limit) {
7779
+			$query .= " LIMIT 10";
7780
+		}
7459 7781
       
7460 7782
 		
7461 7783
 		$sth = $this->db->prepare($query);
@@ -7476,7 +7798,9 @@  discard block
 block discarded – undo
7476 7798
 			if ($icaoaskey) {
7477 7799
 				$icao = $row['arrival_airport_icao'];
7478 7800
 				$airport_array[$icao] = $temp_array;
7479
-			} else $airport_array[] = $temp_array;
7801
+			} else {
7802
+				$airport_array[] = $temp_array;
7803
+			}
7480 7804
 		}
7481 7805
 
7482 7806
 		return $airport_array;
@@ -7857,7 +8181,9 @@  discard block
 block discarded – undo
7857 8181
 			date_default_timezone_set($globalTimezone);
7858 8182
 			$datetime = new DateTime($date);
7859 8183
 			$offset = $datetime->format('P');
7860
-		} else $offset = '+00:00';
8184
+		} else {
8185
+			$offset = '+00:00';
8186
+		}
7861 8187
 
7862 8188
 		if ($globalDBdriver == 'mysql') {
7863 8189
 			$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 
@@ -7907,7 +8233,9 @@  discard block
 block discarded – undo
7907 8233
 			date_default_timezone_set($globalTimezone);
7908 8234
 			$datetime = new DateTime($date);
7909 8235
 			$offset = $datetime->format('P');
7910
-		} else $offset = '+00:00';
8236
+		} else {
8237
+			$offset = '+00:00';
8238
+		}
7911 8239
 
7912 8240
 		if ($globalDBdriver == 'mysql') {
7913 8241
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8278,7 +8606,9 @@  discard block
 block discarded – undo
8278 8606
 		}
8279 8607
 		$query .= " GROUP BY spotter_output.arrival_airport_country
8280 8608
 					ORDER BY airport_arrival_country_count DESC";
8281
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8609
+		if ($limit) {
8610
+			$query .= " LIMIT 10 OFFSET 0";
8611
+		}
8282 8612
       
8283 8613
 		
8284 8614
 		$sth = $this->db->prepare($query);
@@ -8565,7 +8895,9 @@  discard block
 block discarded – undo
8565 8895
 			date_default_timezone_set($globalTimezone);
8566 8896
 			$datetime = new DateTime($date);
8567 8897
 			$offset = $datetime->format('P');
8568
-		} else $offset = '+00:00';
8898
+		} else {
8899
+			$offset = '+00:00';
8900
+		}
8569 8901
 		
8570 8902
 		if ($globalDBdriver == 'mysql') {
8571 8903
 			$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
@@ -8821,12 +9153,18 @@  discard block
 block discarded – undo
8821 9153
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
8822 9154
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
8823 9155
 		 if ($olderthanmonths > 0) {
8824
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8825
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9156
+			if ($globalDBdriver == 'mysql') {
9157
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9158
+			} else {
9159
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9160
+			}
8826 9161
 		}
8827 9162
 		if ($sincedate != '') {
8828
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
8829
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9163
+			if ($globalDBdriver == 'mysql') {
9164
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9165
+			} else {
9166
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9167
+			}
8830 9168
 		}
8831 9169
 		$query_values = array();
8832 9170
 		if ($year != '') {
@@ -8857,7 +9195,9 @@  discard block
 block discarded – undo
8857 9195
 			}
8858 9196
 		}
8859 9197
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
8860
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9198
+		if ($limit) {
9199
+			$query .= " LIMIT 10 OFFSET 0";
9200
+		}
8861 9201
       		
8862 9202
 		$sth = $this->db->prepare($query);
8863 9203
 		$sth->execute($query_values);
@@ -8891,15 +9231,23 @@  discard block
 block discarded – undo
8891 9231
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
8892 9232
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
8893 9233
 		 if ($olderthanmonths > 0) {
8894
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8895
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9234
+			if ($globalDBdriver == 'mysql') {
9235
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9236
+			} else {
9237
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9238
+			}
8896 9239
 		}
8897 9240
 		if ($sincedate != '') {
8898
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
8899
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9241
+			if ($globalDBdriver == 'mysql') {
9242
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9243
+			} else {
9244
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9245
+			}
8900 9246
 		}
8901 9247
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
8902
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9248
+		if ($limit) {
9249
+			$query .= " LIMIT 10 OFFSET 0";
9250
+		}
8903 9251
       		
8904 9252
 		$sth = $this->db->prepare($query);
8905 9253
 		$sth->execute();
@@ -8936,7 +9284,9 @@  discard block
 block discarded – undo
8936 9284
 			date_default_timezone_set($globalTimezone);
8937 9285
 			$datetime = new DateTime();
8938 9286
 			$offset = $datetime->format('P');
8939
-		} else $offset = '+00:00';
9287
+		} else {
9288
+			$offset = '+00:00';
9289
+		}
8940 9290
 
8941 9291
 		if ($globalDBdriver == 'mysql') {
8942 9292
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8985,7 +9335,9 @@  discard block
 block discarded – undo
8985 9335
 			date_default_timezone_set($globalTimezone);
8986 9336
 			$datetime = new DateTime();
8987 9337
 			$offset = $datetime->format('P');
8988
-		} else $offset = '+00:00';
9338
+		} else {
9339
+			$offset = '+00:00';
9340
+		}
8989 9341
 		$filter_query = $this->getFilter($filters,true,true);
8990 9342
 		if ($globalDBdriver == 'mysql') {
8991 9343
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9034,7 +9386,9 @@  discard block
 block discarded – undo
9034 9386
 			date_default_timezone_set($globalTimezone);
9035 9387
 			$datetime = new DateTime();
9036 9388
 			$offset = $datetime->format('P');
9037
-		} else $offset = '+00:00';
9389
+		} else {
9390
+			$offset = '+00:00';
9391
+		}
9038 9392
 		$filter_query = $this->getFilter($filters,true,true);
9039 9393
 		if ($globalDBdriver == 'mysql') {
9040 9394
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9080,7 +9434,9 @@  discard block
 block discarded – undo
9080 9434
 			date_default_timezone_set($globalTimezone);
9081 9435
 			$datetime = new DateTime();
9082 9436
 			$offset = $datetime->format('P');
9083
-		} else $offset = '+00:00';
9437
+		} else {
9438
+			$offset = '+00:00';
9439
+		}
9084 9440
 		$filter_query = $this->getFilter($filters,true,true);
9085 9441
 		if ($globalDBdriver == 'mysql') {
9086 9442
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9128,7 +9484,9 @@  discard block
 block discarded – undo
9128 9484
 			date_default_timezone_set($globalTimezone);
9129 9485
 			$datetime = new DateTime();
9130 9486
 			$offset = $datetime->format('P');
9131
-		} else $offset = '+00:00';
9487
+		} else {
9488
+			$offset = '+00:00';
9489
+		}
9132 9490
 		
9133 9491
 		if ($globalDBdriver == 'mysql') {
9134 9492
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9176,7 +9534,9 @@  discard block
 block discarded – undo
9176 9534
 			date_default_timezone_set($globalTimezone);
9177 9535
 			$datetime = new DateTime();
9178 9536
 			$offset = $datetime->format('P');
9179
-		} else $offset = '+00:00';
9537
+		} else {
9538
+			$offset = '+00:00';
9539
+		}
9180 9540
 
9181 9541
 		if ($globalDBdriver == 'mysql') {
9182 9542
 			$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
@@ -9223,7 +9583,9 @@  discard block
 block discarded – undo
9223 9583
 			date_default_timezone_set($globalTimezone);
9224 9584
 			$datetime = new DateTime();
9225 9585
 			$offset = $datetime->format('P');
9226
-		} else $offset = '+00:00';
9586
+		} else {
9587
+			$offset = '+00:00';
9588
+		}
9227 9589
 
9228 9590
 		if ($globalDBdriver == 'mysql') {
9229 9591
 			$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
@@ -9271,7 +9633,9 @@  discard block
 block discarded – undo
9271 9633
 			date_default_timezone_set($globalTimezone);
9272 9634
 			$datetime = new DateTime();
9273 9635
 			$offset = $datetime->format('P');
9274
-		} else $offset = '+00:00';
9636
+		} else {
9637
+			$offset = '+00:00';
9638
+		}
9275 9639
 		$filter_query = $this->getFilter($filters,true,true);
9276 9640
 		if ($globalDBdriver == 'mysql') {
9277 9641
 			$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
@@ -9316,7 +9680,9 @@  discard block
 block discarded – undo
9316 9680
 			date_default_timezone_set($globalTimezone);
9317 9681
 			$datetime = new DateTime();
9318 9682
 			$offset = $datetime->format('P');
9319
-		} else $offset = '+00:00';
9683
+		} else {
9684
+			$offset = '+00:00';
9685
+		}
9320 9686
 		$filter_query = $this->getFilter($filters,true,true);
9321 9687
 
9322 9688
 		if ($globalDBdriver == 'mysql') {
@@ -9363,7 +9729,9 @@  discard block
 block discarded – undo
9363 9729
 			date_default_timezone_set($globalTimezone);
9364 9730
 			$datetime = new DateTime();
9365 9731
 			$offset = $datetime->format('P');
9366
-		} else $offset = '+00:00';
9732
+		} else {
9733
+			$offset = '+00:00';
9734
+		}
9367 9735
 
9368 9736
 		if ($globalDBdriver == 'mysql') {
9369 9737
 			$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
@@ -9409,7 +9777,9 @@  discard block
 block discarded – undo
9409 9777
 			date_default_timezone_set($globalTimezone);
9410 9778
 			$datetime = new DateTime();
9411 9779
 			$offset = $datetime->format('P');
9412
-		} else $offset = '+00:00';
9780
+		} else {
9781
+			$offset = '+00:00';
9782
+		}
9413 9783
 		$filter_query = $this->getFilter($filters,true,true);
9414 9784
 
9415 9785
 		if ($globalDBdriver == 'mysql') {
@@ -9456,7 +9826,9 @@  discard block
 block discarded – undo
9456 9826
 			date_default_timezone_set($globalTimezone);
9457 9827
 			$datetime = new DateTime();
9458 9828
 			$offset = $datetime->format('P');
9459
-		} else $offset = '+00:00';
9829
+		} else {
9830
+			$offset = '+00:00';
9831
+		}
9460 9832
 
9461 9833
 		if ($globalDBdriver == 'mysql') {
9462 9834
 			$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
@@ -9503,7 +9875,9 @@  discard block
 block discarded – undo
9503 9875
 			date_default_timezone_set($globalTimezone);
9504 9876
 			$datetime = new DateTime();
9505 9877
 			$offset = $datetime->format('P');
9506
-		} else $offset = '+00:00';
9878
+		} else {
9879
+			$offset = '+00:00';
9880
+		}
9507 9881
 
9508 9882
 		if ($globalDBdriver == 'mysql') {
9509 9883
 			$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
@@ -9548,7 +9922,9 @@  discard block
 block discarded – undo
9548 9922
 			date_default_timezone_set($globalTimezone);
9549 9923
 			$datetime = new DateTime();
9550 9924
 			$offset = $datetime->format('P');
9551
-		} else $offset = '+00:00';
9925
+		} else {
9926
+			$offset = '+00:00';
9927
+		}
9552 9928
 		$filter_query = $this->getFilter($filters,true,true);
9553 9929
 
9554 9930
 		if ($globalDBdriver == 'mysql') {
@@ -9596,7 +9972,9 @@  discard block
 block discarded – undo
9596 9972
 			date_default_timezone_set($globalTimezone);
9597 9973
 			$datetime = new DateTime();
9598 9974
 			$offset = $datetime->format('P');
9599
-		} else $offset = '+00:00';
9975
+		} else {
9976
+			$offset = '+00:00';
9977
+		}
9600 9978
 
9601 9979
 		if ($globalDBdriver == 'mysql') {
9602 9980
 			$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
@@ -9642,7 +10020,9 @@  discard block
 block discarded – undo
9642 10020
 			date_default_timezone_set($globalTimezone);
9643 10021
 			$datetime = new DateTime();
9644 10022
 			$offset = $datetime->format('P');
9645
-		} else $offset = '+00:00';
10023
+		} else {
10024
+			$offset = '+00:00';
10025
+		}
9646 10026
 		$filter_query = $this->getFilter($filters,true,true);
9647 10027
 
9648 10028
 		if ($globalDBdriver == 'mysql') {
@@ -9690,7 +10070,9 @@  discard block
 block discarded – undo
9690 10070
 			date_default_timezone_set($globalTimezone);
9691 10071
 			$datetime = new DateTime();
9692 10072
 			$offset = $datetime->format('P');
9693
-		} else $offset = '+00:00';
10073
+		} else {
10074
+			$offset = '+00:00';
10075
+		}
9694 10076
 
9695 10077
 		if ($globalDBdriver == 'mysql') {
9696 10078
 			$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
@@ -9737,7 +10119,9 @@  discard block
 block discarded – undo
9737 10119
 			date_default_timezone_set($globalTimezone);
9738 10120
 			$datetime = new DateTime();
9739 10121
 			$offset = $datetime->format('P');
9740
-		} else $offset = '+00:00';
10122
+		} else {
10123
+			$offset = '+00:00';
10124
+		}
9741 10125
 		$filter_query = $this->getFilter($filters,true,true);
9742 10126
 		if ($globalDBdriver == 'mysql') {
9743 10127
 			$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
@@ -9786,7 +10170,9 @@  discard block
 block discarded – undo
9786 10170
 			date_default_timezone_set($globalTimezone);
9787 10171
 			$datetime = new DateTime();
9788 10172
 			$offset = $datetime->format('P');
9789
-		} else $offset = '+00:00';
10173
+		} else {
10174
+			$offset = '+00:00';
10175
+		}
9790 10176
 
9791 10177
 		$orderby_sql = '';
9792 10178
 		if ($orderby == "hour")
@@ -9852,7 +10238,9 @@  discard block
 block discarded – undo
9852 10238
 			date_default_timezone_set($globalTimezone);
9853 10239
 			$datetime = new DateTime();
9854 10240
 			$offset = $datetime->format('P');
9855
-		} else $offset = '+00:00';
10241
+		} else {
10242
+			$offset = '+00:00';
10243
+		}
9856 10244
 
9857 10245
 		$orderby_sql = '';
9858 10246
 		if ($orderby == "hour")
@@ -9919,7 +10307,9 @@  discard block
 block discarded – undo
9919 10307
 			date_default_timezone_set($globalTimezone);
9920 10308
 			$datetime = new DateTime();
9921 10309
 			$offset = $datetime->format('P');
9922
-		} else $offset = '+00:00';
10310
+		} else {
10311
+			$offset = '+00:00';
10312
+		}
9923 10313
 
9924 10314
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
9925 10315
 
@@ -9970,7 +10360,9 @@  discard block
 block discarded – undo
9970 10360
 			date_default_timezone_set($globalTimezone);
9971 10361
 			$datetime = new DateTime();
9972 10362
 			$offset = $datetime->format('P');
9973
-		} else $offset = '+00:00';
10363
+		} else {
10364
+			$offset = '+00:00';
10365
+		}
9974 10366
 
9975 10367
 		if ($globalDBdriver == 'mysql') {
9976 10368
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10017,7 +10409,9 @@  discard block
 block discarded – undo
10017 10409
 			date_default_timezone_set($globalTimezone);
10018 10410
 			$datetime = new DateTime();
10019 10411
 			$offset = $datetime->format('P');
10020
-		} else $offset = '+00:00';
10412
+		} else {
10413
+			$offset = '+00:00';
10414
+		}
10021 10415
 
10022 10416
 		if ($globalDBdriver == 'mysql') {
10023 10417
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10064,7 +10458,9 @@  discard block
 block discarded – undo
10064 10458
 			date_default_timezone_set($globalTimezone);
10065 10459
 			$datetime = new DateTime();
10066 10460
 			$offset = $datetime->format('P');
10067
-		} else $offset = '+00:00';
10461
+		} else {
10462
+			$offset = '+00:00';
10463
+		}
10068 10464
 
10069 10465
 		if ($globalDBdriver == 'mysql') {
10070 10466
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10112,7 +10508,9 @@  discard block
 block discarded – undo
10112 10508
 			date_default_timezone_set($globalTimezone);
10113 10509
 			$datetime = new DateTime();
10114 10510
 			$offset = $datetime->format('P');
10115
-		} else $offset = '+00:00';
10511
+		} else {
10512
+			$offset = '+00:00';
10513
+		}
10116 10514
 
10117 10515
 		if ($globalDBdriver == 'mysql') {
10118 10516
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10160,7 +10558,9 @@  discard block
 block discarded – undo
10160 10558
 			date_default_timezone_set($globalTimezone);
10161 10559
 			$datetime = new DateTime($date);
10162 10560
 			$offset = $datetime->format('P');
10163
-		} else $offset = '+00:00';
10561
+		} else {
10562
+			$offset = '+00:00';
10563
+		}
10164 10564
 
10165 10565
 		if ($globalDBdriver == 'mysql') {
10166 10566
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10208,7 +10608,9 @@  discard block
 block discarded – undo
10208 10608
 			date_default_timezone_set($globalTimezone);
10209 10609
 			$datetime = new DateTime();
10210 10610
 			$offset = $datetime->format('P');
10211
-		} else $offset = '+00:00';
10611
+		} else {
10612
+			$offset = '+00:00';
10613
+		}
10212 10614
 
10213 10615
 		if ($globalDBdriver == 'mysql') {
10214 10616
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10255,7 +10657,9 @@  discard block
 block discarded – undo
10255 10657
 			date_default_timezone_set($globalTimezone);
10256 10658
 			$datetime = new DateTime();
10257 10659
 			$offset = $datetime->format('P');
10258
-		} else $offset = '+00:00';
10660
+		} else {
10661
+			$offset = '+00:00';
10662
+		}
10259 10663
 
10260 10664
 		if ($globalDBdriver == 'mysql') {
10261 10665
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10302,7 +10706,9 @@  discard block
 block discarded – undo
10302 10706
 			date_default_timezone_set($globalTimezone);
10303 10707
 			$datetime = new DateTime();
10304 10708
 			$offset = $datetime->format('P');
10305
-		} else $offset = '+00:00';
10709
+		} else {
10710
+			$offset = '+00:00';
10711
+		}
10306 10712
 
10307 10713
 		if ($globalDBdriver == 'mysql') {
10308 10714
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10352,7 +10758,9 @@  discard block
 block discarded – undo
10352 10758
 			date_default_timezone_set($globalTimezone);
10353 10759
 			$datetime = new DateTime();
10354 10760
 			$offset = $datetime->format('P');
10355
-		} else $offset = '+00:00';
10761
+		} else {
10762
+			$offset = '+00:00';
10763
+		}
10356 10764
 
10357 10765
 		if ($globalDBdriver == 'mysql') {
10358 10766
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10399,7 +10807,9 @@  discard block
 block discarded – undo
10399 10807
 			date_default_timezone_set($globalTimezone);
10400 10808
 			$datetime = new DateTime();
10401 10809
 			$offset = $datetime->format('P');
10402
-		} else $offset = '+00:00';
10810
+		} else {
10811
+			$offset = '+00:00';
10812
+		}
10403 10813
 
10404 10814
 		if ($globalDBdriver == 'mysql') {
10405 10815
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10610,8 +11020,11 @@  discard block
 block discarded – undo
10610 11020
 				$query_values = array_merge($query_values,array(':month' => $month));
10611 11021
 			}
10612 11022
 		}
10613
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
10614
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11023
+		if (empty($query_values)) {
11024
+			$queryi .= $this->getFilter($filters);
11025
+		} else {
11026
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11027
+		}
10615 11028
 		
10616 11029
 		//echo $query;
10617 11030
 		$sth = $this->db->prepare($queryi);
@@ -10690,8 +11103,11 @@  discard block
 block discarded – undo
10690 11103
 				$query_values = array_merge($query_values,array(':month' => $month));
10691 11104
 			}
10692 11105
 		}
10693
-                if ($query == '') $queryi .= $this->getFilter($filters);
10694
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11106
+                if ($query == '') {
11107
+                	$queryi .= $this->getFilter($filters);
11108
+                } else {
11109
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11110
+                }
10695 11111
 
10696 11112
 
10697 11113
 		$sth = $this->db->prepare($queryi);
@@ -10714,7 +11130,9 @@  discard block
 block discarded – undo
10714 11130
 			date_default_timezone_set($globalTimezone);
10715 11131
 			$datetime = new DateTime();
10716 11132
 			$offset = $datetime->format('P');
10717
-		} else $offset = '+00:00';
11133
+		} else {
11134
+			$offset = '+00:00';
11135
+		}
10718 11136
 
10719 11137
 		if ($globalDBdriver == 'mysql') {
10720 11138
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10900,7 +11318,9 @@  discard block
 block discarded – undo
10900 11318
 	*/
10901 11319
 	public function parseDirection($direction = 0)
10902 11320
 	{
10903
-		if ($direction == '') $direction = 0;
11321
+		if ($direction == '') {
11322
+			$direction = 0;
11323
+		}
10904 11324
 		$direction_array = array();
10905 11325
 		$temp_array = array();
10906 11326
 
@@ -11001,7 +11421,9 @@  discard block
 block discarded – undo
11001 11421
 		if (isset($result->AirlineFlightInfoResult))
11002 11422
 		{
11003 11423
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11004
-		} else return '';
11424
+		} else {
11425
+			return '';
11426
+		}
11005 11427
 		
11006 11428
 		$registration = $this->convertAircraftRegistration($registration);
11007 11429
 		
@@ -11030,7 +11452,9 @@  discard block
 block discarded – undo
11030 11452
 		if (count($row) > 0) {
11031 11453
 		    //return $row['Registration'];
11032 11454
 		    return $row['registration'];
11033
-		} else return '';
11455
+		} else {
11456
+			return '';
11457
+		}
11034 11458
 	
11035 11459
 	}
11036 11460
 
@@ -11053,9 +11477,14 @@  discard block
 block discarded – undo
11053 11477
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11054 11478
 		$sth->closeCursor();
11055 11479
 		if (count($row) > 0) {
11056
-		    if ($row['type_flight'] == null) return '';
11057
-		    else return $row['type_flight'];
11058
-		} else return '';
11480
+		    if ($row['type_flight'] == null) {
11481
+		    	return '';
11482
+		    } else {
11483
+		    	return $row['type_flight'];
11484
+		    }
11485
+		} else {
11486
+			return '';
11487
+		}
11059 11488
 	
11060 11489
 	}
11061 11490
 
@@ -11073,7 +11502,9 @@  discard block
 block discarded – undo
11073 11502
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11074 11503
 	
11075 11504
 		$Connection = new Connection($this->db);
11076
-		if (!$Connection->tableExists('countries')) return '';
11505
+		if (!$Connection->tableExists('countries')) {
11506
+			return '';
11507
+		}
11077 11508
 	
11078 11509
 		try {
11079 11510
 			/*
@@ -11093,9 +11524,13 @@  discard block
 block discarded – undo
11093 11524
 			$sth->closeCursor();
11094 11525
 			if (count($row) > 0) {
11095 11526
 				return $row;
11096
-			} else return '';
11527
+			} else {
11528
+				return '';
11529
+			}
11097 11530
 		} catch (PDOException $e) {
11098
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11531
+			if (isset($globalDebug) && $globalDebug) {
11532
+				echo 'Error : '.$e->getMessage()."\n";
11533
+			}
11099 11534
 			return '';
11100 11535
 		}
11101 11536
 	
@@ -11113,7 +11548,9 @@  discard block
 block discarded – undo
11113 11548
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11114 11549
 	
11115 11550
 		$Connection = new Connection($this->db);
11116
-		if (!$Connection->tableExists('countries')) return '';
11551
+		if (!$Connection->tableExists('countries')) {
11552
+			return '';
11553
+		}
11117 11554
 	
11118 11555
 		try {
11119 11556
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11125,9 +11562,13 @@  discard block
 block discarded – undo
11125 11562
 			$sth->closeCursor();
11126 11563
 			if (count($row) > 0) {
11127 11564
 				return $row;
11128
-			} else return '';
11565
+			} else {
11566
+				return '';
11567
+			}
11129 11568
 		} catch (PDOException $e) {
11130
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11569
+			if (isset($globalDebug) && $globalDebug) {
11570
+				echo 'Error : '.$e->getMessage()."\n";
11571
+			}
11131 11572
 			return '';
11132 11573
 		}
11133 11574
 	
@@ -11377,7 +11818,9 @@  discard block
 block discarded – undo
11377 11818
 	{
11378 11819
 		global $globalBitlyAccessToken;
11379 11820
 		
11380
-		if ($globalBitlyAccessToken == '') return $url;
11821
+		if ($globalBitlyAccessToken == '') {
11822
+			return $url;
11823
+		}
11381 11824
         
11382 11825
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11383 11826
 		
@@ -11526,7 +11969,9 @@  discard block
 block discarded – undo
11526 11969
 		
11527 11970
 
11528 11971
 		// routes
11529
-		if ($globalDebug) print "Routes...\n";
11972
+		if ($globalDebug) {
11973
+			print "Routes...\n";
11974
+		}
11530 11975
 		if ($globalDBdriver == 'mysql') {
11531 11976
 			$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)";
11532 11977
 		} else {
@@ -11545,7 +11990,9 @@  discard block
 block discarded – undo
11545 11990
 			}
11546 11991
 		}
11547 11992
 		
11548
-		if ($globalDebug) print "Airlines...\n";
11993
+		if ($globalDebug) {
11994
+			print "Airlines...\n";
11995
+		}
11549 11996
 		//airlines
11550 11997
 		if ($globalDBdriver == 'mysql') {
11551 11998
 			$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)";
@@ -11559,10 +12006,15 @@  discard block
 block discarded – undo
11559 12006
 			if (is_numeric(substr($row['ident'], -1, 1)))
11560 12007
 			{
11561 12008
 				$fromsource = NULL;
11562
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
11563
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11564
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11565
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12009
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12010
+					$fromsource = 'vatsim';
12011
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12012
+					$fromsource = 'ivao';
12013
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12014
+					$fromsource = 'vatsim';
12015
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12016
+					$fromsource = 'ivao';
12017
+				}
11566 12018
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11567 12019
 				if (isset($airline_array[0]['name'])) {
11568 12020
 					$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";
@@ -11572,13 +12024,17 @@  discard block
 block discarded – undo
11572 12024
 			}
11573 12025
 		}
11574 12026
 
11575
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12027
+		if ($globalDebug) {
12028
+			print "Remove Duplicate in aircraft_modes...\n";
12029
+		}
11576 12030
 		//duplicate modes
11577 12031
 		$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";
11578 12032
 		$sth = $this->db->prepare($query);
11579 12033
 		$sth->execute();
11580 12034
 		
11581
-		if ($globalDebug) print "Aircraft...\n";
12035
+		if ($globalDebug) {
12036
+			print "Aircraft...\n";
12037
+		}
11582 12038
 		//aircraft
11583 12039
 		if ($globalDBdriver == 'mysql') {
11584 12040
 			$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)";
@@ -11621,26 +12077,38 @@  discard block
 block discarded – undo
11621 12077
 				 if (isset($closestAirports[0])) {
11622 12078
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
11623 12079
 						$airport_icao = $closestAirports[0]['icao'];
11624
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12080
+						if ($globalDebug) {
12081
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12082
+						}
11625 12083
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
11626 12084
 						foreach ($closestAirports as $airport) {
11627 12085
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
11628 12086
 								$airport_icao = $airport['icao'];
11629
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12087
+								if ($globalDebug) {
12088
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12089
+								}
11630 12090
 								break;
11631 12091
 							}
11632 12092
 						}
11633 12093
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
11634 12094
 						$airport_icao = $closestAirports[0]['icao'];
11635
-						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";
12095
+						if ($globalDebug) {
12096
+							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";
12097
+						}
11636 12098
 					} else {
11637
-						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";
12099
+						if ($globalDebug) {
12100
+							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";
12101
+						}
11638 12102
 					}
11639 12103
 				} else {
11640
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12104
+					if ($globalDebug) {
12105
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12106
+					}
11641 12107
 				}
11642 12108
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
11643
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12109
+					if ($globalDebug) {
12110
+						echo "Updating airport to ".$airport_icao."...\n";
12111
+					}
11644 12112
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
11645 12113
 					$sthu = $this->db->prepare($update_query);
11646 12114
 					$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.