Completed
Push — master ( d89c41...b8fcbd )
by Yannick
06:01
created
install/class.update_schema.php 2 patches
Indentation   +586 added lines, -586 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 {
@@ -1317,153 +1317,153 @@  discard block
 block discarded – undo
1317 1317
 	}
1318 1318
 
1319 1319
 
1320
-    	public static function check_version($update = false) {
1321
-    	    global $globalDBname;
1322
-    	    $version = 0;
1323
-    	    $Connection = new Connection();
1324
-    	    if ($Connection->tableExists('aircraft')) {
1325
-    		if (!$Connection->tableExists('config')) {
1326
-    		    $version = '1';
1327
-    		    if ($update) return self::update_from_1();
1328
-    		    else return $version;
1320
+		public static function check_version($update = false) {
1321
+			global $globalDBname;
1322
+			$version = 0;
1323
+			$Connection = new Connection();
1324
+			if ($Connection->tableExists('aircraft')) {
1325
+			if (!$Connection->tableExists('config')) {
1326
+				$version = '1';
1327
+				if ($update) return self::update_from_1();
1328
+				else return $version;
1329 1329
 		} else {
1330
-    		    $Connection = new Connection();
1331
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1332
-		    try {
1333
-            		$sth = $Connection->db->prepare($query);
1334
-		        $sth->execute();
1335
-		    } catch(PDOException $e) {
1330
+				$Connection = new Connection();
1331
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1332
+			try {
1333
+					$sth = $Connection->db->prepare($query);
1334
+				$sth->execute();
1335
+			} catch(PDOException $e) {
1336 1336
 			return "error : ".$e->getMessage()."\n";
1337
-    		    }
1338
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
1339
-    		    if ($update) {
1340
-    			if ($result['value'] == '2') {
1341
-    			    $error = self::update_from_2();
1342
-    			    if ($error != '') return $error;
1343
-    			    else return self::check_version(true);
1344
-    			} elseif ($result['value'] == '3') {
1345
-    			    $error = self::update_from_3();
1346
-    			    if ($error != '') return $error;
1347
-    			    else return self::check_version(true);
1348
-    			} elseif ($result['value'] == '4') {
1349
-    			    $error = self::update_from_4();
1350
-    			    if ($error != '') return $error;
1351
-    			    else return self::check_version(true);
1352
-    			} elseif ($result['value'] == '5') {
1353
-    			    $error = self::update_from_5();
1354
-    			    if ($error != '') return $error;
1355
-    			    else return self::check_version(true);
1356
-    			} elseif ($result['value'] == '6') {
1357
-    			    $error = self::update_from_6();
1358
-    			    if ($error != '') return $error;
1359
-    			    else return self::check_version(true);
1360
-    			} elseif ($result['value'] == '7') {
1361
-    			    $error = self::update_from_7();
1362
-    			    if ($error != '') return $error;
1363
-    			    else return self::check_version(true);
1364
-    			} elseif ($result['value'] == '8') {
1365
-    			    $error = self::update_from_8();
1366
-    			    if ($error != '') return $error;
1367
-    			    else return self::check_version(true);
1368
-    			} elseif ($result['value'] == '9') {
1369
-    			    $error = self::update_from_9();
1370
-    			    if ($error != '') return $error;
1371
-    			    else return self::check_version(true);
1372
-    			} elseif ($result['value'] == '10') {
1373
-    			    $error = self::update_from_10();
1374
-    			    if ($error != '') return $error;
1375
-    			    else return self::check_version(true);
1376
-    			} elseif ($result['value'] == '11') {
1377
-    			    $error = self::update_from_11();
1378
-    			    if ($error != '') return $error;
1379
-    			    else return self::check_version(true);
1380
-    			} elseif ($result['value'] == '12') {
1381
-    			    $error = self::update_from_12();
1382
-    			    if ($error != '') return $error;
1383
-    			    else return self::check_version(true);
1384
-    			} elseif ($result['value'] == '13') {
1385
-    			    $error = self::update_from_13();
1386
-    			    if ($error != '') return $error;
1387
-    			    else return self::check_version(true);
1388
-    			} elseif ($result['value'] == '14') {
1389
-    			    $error = self::update_from_14();
1390
-    			    if ($error != '') return $error;
1391
-    			    else return self::check_version(true);
1392
-    			} elseif ($result['value'] == '15') {
1393
-    			    $error = self::update_from_15();
1394
-    			    if ($error != '') return $error;
1395
-    			    else return self::check_version(true);
1396
-    			} elseif ($result['value'] == '16') {
1397
-    			    $error = self::update_from_16();
1398
-    			    if ($error != '') return $error;
1399
-    			    else return self::check_version(true);
1400
-    			} elseif ($result['value'] == '17') {
1401
-    			    $error = self::update_from_17();
1402
-    			    if ($error != '') return $error;
1403
-    			    else return self::check_version(true);
1404
-    			} elseif ($result['value'] == '18') {
1405
-    			    $error = self::update_from_18();
1406
-    			    if ($error != '') return $error;
1407
-    			    else return self::check_version(true);
1408
-    			} elseif ($result['value'] == '19') {
1409
-    			    $error = self::update_from_19();
1410
-    			    if ($error != '') return $error;
1411
-    			    else return self::check_version(true);
1412
-    			} elseif ($result['value'] == '20') {
1413
-    			    $error = self::update_from_20();
1414
-    			    if ($error != '') return $error;
1415
-    			    else return self::check_version(true);
1416
-    			} elseif ($result['value'] == '21') {
1417
-    			    $error = self::update_from_21();
1418
-    			    if ($error != '') return $error;
1419
-    			    else return self::check_version(true);
1420
-    			} elseif ($result['value'] == '22') {
1421
-    			    $error = self::update_from_22();
1422
-    			    if ($error != '') return $error;
1423
-    			    else return self::check_version(true);
1424
-    			} elseif ($result['value'] == '23') {
1425
-    			    $error = self::update_from_23();
1426
-    			    if ($error != '') return $error;
1427
-    			    else return self::check_version(true);
1428
-    			} elseif ($result['value'] == '24') {
1429
-    			    $error = self::update_from_24();
1430
-    			    if ($error != '') return $error;
1431
-    			    else return self::check_version(true);
1432
-    			} elseif ($result['value'] == '25') {
1433
-    			    $error = self::update_from_25();
1434
-    			    if ($error != '') return $error;
1435
-    			    else return self::check_version(true);
1436
-    			} elseif ($result['value'] == '26') {
1437
-    			    $error = self::update_from_26();
1438
-    			    if ($error != '') return $error;
1439
-    			    else return self::check_version(true);
1440
-    			} elseif ($result['value'] == '27') {
1441
-    			    $error = self::update_from_27();
1442
-    			    if ($error != '') return $error;
1443
-    			    else return self::check_version(true);
1444
-    			} elseif ($result['value'] == '28') {
1445
-    			    $error = self::update_from_28();
1446
-    			    if ($error != '') return $error;
1447
-    			    else return self::check_version(true);
1448
-    			} elseif ($result['value'] == '29') {
1449
-    			    $error = self::update_from_29();
1450
-    			    if ($error != '') return $error;
1451
-    			    else return self::check_version(true);
1452
-    			} elseif ($result['value'] == '30') {
1453
-    			    $error = self::update_from_30();
1454
-    			    if ($error != '') return $error;
1455
-    			    else return self::check_version(true);
1456
-    			} elseif ($result['value'] == '31') {
1457
-    			    $error = self::update_from_31();
1458
-    			    if ($error != '') return $error;
1459
-    			    else return self::check_version(true);
1460
-    			} else return '';
1461
-    		    }
1462
-    		    else return $result['value'];
1337
+				}
1338
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
1339
+				if ($update) {
1340
+				if ($result['value'] == '2') {
1341
+					$error = self::update_from_2();
1342
+					if ($error != '') return $error;
1343
+					else return self::check_version(true);
1344
+				} elseif ($result['value'] == '3') {
1345
+					$error = self::update_from_3();
1346
+					if ($error != '') return $error;
1347
+					else return self::check_version(true);
1348
+				} elseif ($result['value'] == '4') {
1349
+					$error = self::update_from_4();
1350
+					if ($error != '') return $error;
1351
+					else return self::check_version(true);
1352
+				} elseif ($result['value'] == '5') {
1353
+					$error = self::update_from_5();
1354
+					if ($error != '') return $error;
1355
+					else return self::check_version(true);
1356
+				} elseif ($result['value'] == '6') {
1357
+					$error = self::update_from_6();
1358
+					if ($error != '') return $error;
1359
+					else return self::check_version(true);
1360
+				} elseif ($result['value'] == '7') {
1361
+					$error = self::update_from_7();
1362
+					if ($error != '') return $error;
1363
+					else return self::check_version(true);
1364
+				} elseif ($result['value'] == '8') {
1365
+					$error = self::update_from_8();
1366
+					if ($error != '') return $error;
1367
+					else return self::check_version(true);
1368
+				} elseif ($result['value'] == '9') {
1369
+					$error = self::update_from_9();
1370
+					if ($error != '') return $error;
1371
+					else return self::check_version(true);
1372
+				} elseif ($result['value'] == '10') {
1373
+					$error = self::update_from_10();
1374
+					if ($error != '') return $error;
1375
+					else return self::check_version(true);
1376
+				} elseif ($result['value'] == '11') {
1377
+					$error = self::update_from_11();
1378
+					if ($error != '') return $error;
1379
+					else return self::check_version(true);
1380
+				} elseif ($result['value'] == '12') {
1381
+					$error = self::update_from_12();
1382
+					if ($error != '') return $error;
1383
+					else return self::check_version(true);
1384
+				} elseif ($result['value'] == '13') {
1385
+					$error = self::update_from_13();
1386
+					if ($error != '') return $error;
1387
+					else return self::check_version(true);
1388
+				} elseif ($result['value'] == '14') {
1389
+					$error = self::update_from_14();
1390
+					if ($error != '') return $error;
1391
+					else return self::check_version(true);
1392
+				} elseif ($result['value'] == '15') {
1393
+					$error = self::update_from_15();
1394
+					if ($error != '') return $error;
1395
+					else return self::check_version(true);
1396
+				} elseif ($result['value'] == '16') {
1397
+					$error = self::update_from_16();
1398
+					if ($error != '') return $error;
1399
+					else return self::check_version(true);
1400
+				} elseif ($result['value'] == '17') {
1401
+					$error = self::update_from_17();
1402
+					if ($error != '') return $error;
1403
+					else return self::check_version(true);
1404
+				} elseif ($result['value'] == '18') {
1405
+					$error = self::update_from_18();
1406
+					if ($error != '') return $error;
1407
+					else return self::check_version(true);
1408
+				} elseif ($result['value'] == '19') {
1409
+					$error = self::update_from_19();
1410
+					if ($error != '') return $error;
1411
+					else return self::check_version(true);
1412
+				} elseif ($result['value'] == '20') {
1413
+					$error = self::update_from_20();
1414
+					if ($error != '') return $error;
1415
+					else return self::check_version(true);
1416
+				} elseif ($result['value'] == '21') {
1417
+					$error = self::update_from_21();
1418
+					if ($error != '') return $error;
1419
+					else return self::check_version(true);
1420
+				} elseif ($result['value'] == '22') {
1421
+					$error = self::update_from_22();
1422
+					if ($error != '') return $error;
1423
+					else return self::check_version(true);
1424
+				} elseif ($result['value'] == '23') {
1425
+					$error = self::update_from_23();
1426
+					if ($error != '') return $error;
1427
+					else return self::check_version(true);
1428
+				} elseif ($result['value'] == '24') {
1429
+					$error = self::update_from_24();
1430
+					if ($error != '') return $error;
1431
+					else return self::check_version(true);
1432
+				} elseif ($result['value'] == '25') {
1433
+					$error = self::update_from_25();
1434
+					if ($error != '') return $error;
1435
+					else return self::check_version(true);
1436
+				} elseif ($result['value'] == '26') {
1437
+					$error = self::update_from_26();
1438
+					if ($error != '') return $error;
1439
+					else return self::check_version(true);
1440
+				} elseif ($result['value'] == '27') {
1441
+					$error = self::update_from_27();
1442
+					if ($error != '') return $error;
1443
+					else return self::check_version(true);
1444
+				} elseif ($result['value'] == '28') {
1445
+					$error = self::update_from_28();
1446
+					if ($error != '') return $error;
1447
+					else return self::check_version(true);
1448
+				} elseif ($result['value'] == '29') {
1449
+					$error = self::update_from_29();
1450
+					if ($error != '') return $error;
1451
+					else return self::check_version(true);
1452
+				} elseif ($result['value'] == '30') {
1453
+					$error = self::update_from_30();
1454
+					if ($error != '') return $error;
1455
+					else return self::check_version(true);
1456
+				} elseif ($result['value'] == '31') {
1457
+					$error = self::update_from_31();
1458
+					if ($error != '') return $error;
1459
+					else return self::check_version(true);
1460
+				} else return '';
1461
+				}
1462
+				else return $result['value'];
1463 1463
 		}
1464 1464
 		
1465
-	    } else return $version;
1466
-    	}
1465
+		} else return $version;
1466
+		}
1467 1467
     	
1468 1468
 }
1469 1469
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Braces   +250 added lines, -94 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";
@@ -1324,8 +1382,11 @@  discard block
 block discarded – undo
1324 1382
     	    if ($Connection->tableExists('aircraft')) {
1325 1383
     		if (!$Connection->tableExists('config')) {
1326 1384
     		    $version = '1';
1327
-    		    if ($update) return self::update_from_1();
1328
-    		    else return $version;
1385
+    		    if ($update) {
1386
+    		    	return self::update_from_1();
1387
+    		    } else {
1388
+    		    	return $version;
1389
+    		    }
1329 1390
 		} else {
1330 1391
     		    $Connection = new Connection();
1331 1392
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -1339,130 +1400,225 @@  discard block
 block discarded – undo
1339 1400
     		    if ($update) {
1340 1401
     			if ($result['value'] == '2') {
1341 1402
     			    $error = self::update_from_2();
1342
-    			    if ($error != '') return $error;
1343
-    			    else return self::check_version(true);
1403
+    			    if ($error != '') {
1404
+    			    	return $error;
1405
+    			    } else {
1406
+    			    	return self::check_version(true);
1407
+    			    }
1344 1408
     			} elseif ($result['value'] == '3') {
1345 1409
     			    $error = self::update_from_3();
1346
-    			    if ($error != '') return $error;
1347
-    			    else return self::check_version(true);
1410
+    			    if ($error != '') {
1411
+    			    	return $error;
1412
+    			    } else {
1413
+    			    	return self::check_version(true);
1414
+    			    }
1348 1415
     			} elseif ($result['value'] == '4') {
1349 1416
     			    $error = self::update_from_4();
1350
-    			    if ($error != '') return $error;
1351
-    			    else return self::check_version(true);
1417
+    			    if ($error != '') {
1418
+    			    	return $error;
1419
+    			    } else {
1420
+    			    	return self::check_version(true);
1421
+    			    }
1352 1422
     			} elseif ($result['value'] == '5') {
1353 1423
     			    $error = self::update_from_5();
1354
-    			    if ($error != '') return $error;
1355
-    			    else return self::check_version(true);
1424
+    			    if ($error != '') {
1425
+    			    	return $error;
1426
+    			    } else {
1427
+    			    	return self::check_version(true);
1428
+    			    }
1356 1429
     			} elseif ($result['value'] == '6') {
1357 1430
     			    $error = self::update_from_6();
1358
-    			    if ($error != '') return $error;
1359
-    			    else return self::check_version(true);
1431
+    			    if ($error != '') {
1432
+    			    	return $error;
1433
+    			    } else {
1434
+    			    	return self::check_version(true);
1435
+    			    }
1360 1436
     			} elseif ($result['value'] == '7') {
1361 1437
     			    $error = self::update_from_7();
1362
-    			    if ($error != '') return $error;
1363
-    			    else return self::check_version(true);
1438
+    			    if ($error != '') {
1439
+    			    	return $error;
1440
+    			    } else {
1441
+    			    	return self::check_version(true);
1442
+    			    }
1364 1443
     			} elseif ($result['value'] == '8') {
1365 1444
     			    $error = self::update_from_8();
1366
-    			    if ($error != '') return $error;
1367
-    			    else return self::check_version(true);
1445
+    			    if ($error != '') {
1446
+    			    	return $error;
1447
+    			    } else {
1448
+    			    	return self::check_version(true);
1449
+    			    }
1368 1450
     			} elseif ($result['value'] == '9') {
1369 1451
     			    $error = self::update_from_9();
1370
-    			    if ($error != '') return $error;
1371
-    			    else return self::check_version(true);
1452
+    			    if ($error != '') {
1453
+    			    	return $error;
1454
+    			    } else {
1455
+    			    	return self::check_version(true);
1456
+    			    }
1372 1457
     			} elseif ($result['value'] == '10') {
1373 1458
     			    $error = self::update_from_10();
1374
-    			    if ($error != '') return $error;
1375
-    			    else return self::check_version(true);
1459
+    			    if ($error != '') {
1460
+    			    	return $error;
1461
+    			    } else {
1462
+    			    	return self::check_version(true);
1463
+    			    }
1376 1464
     			} elseif ($result['value'] == '11') {
1377 1465
     			    $error = self::update_from_11();
1378
-    			    if ($error != '') return $error;
1379
-    			    else return self::check_version(true);
1466
+    			    if ($error != '') {
1467
+    			    	return $error;
1468
+    			    } else {
1469
+    			    	return self::check_version(true);
1470
+    			    }
1380 1471
     			} elseif ($result['value'] == '12') {
1381 1472
     			    $error = self::update_from_12();
1382
-    			    if ($error != '') return $error;
1383
-    			    else return self::check_version(true);
1473
+    			    if ($error != '') {
1474
+    			    	return $error;
1475
+    			    } else {
1476
+    			    	return self::check_version(true);
1477
+    			    }
1384 1478
     			} elseif ($result['value'] == '13') {
1385 1479
     			    $error = self::update_from_13();
1386
-    			    if ($error != '') return $error;
1387
-    			    else return self::check_version(true);
1480
+    			    if ($error != '') {
1481
+    			    	return $error;
1482
+    			    } else {
1483
+    			    	return self::check_version(true);
1484
+    			    }
1388 1485
     			} elseif ($result['value'] == '14') {
1389 1486
     			    $error = self::update_from_14();
1390
-    			    if ($error != '') return $error;
1391
-    			    else return self::check_version(true);
1487
+    			    if ($error != '') {
1488
+    			    	return $error;
1489
+    			    } else {
1490
+    			    	return self::check_version(true);
1491
+    			    }
1392 1492
     			} elseif ($result['value'] == '15') {
1393 1493
     			    $error = self::update_from_15();
1394
-    			    if ($error != '') return $error;
1395
-    			    else return self::check_version(true);
1494
+    			    if ($error != '') {
1495
+    			    	return $error;
1496
+    			    } else {
1497
+    			    	return self::check_version(true);
1498
+    			    }
1396 1499
     			} elseif ($result['value'] == '16') {
1397 1500
     			    $error = self::update_from_16();
1398
-    			    if ($error != '') return $error;
1399
-    			    else return self::check_version(true);
1501
+    			    if ($error != '') {
1502
+    			    	return $error;
1503
+    			    } else {
1504
+    			    	return self::check_version(true);
1505
+    			    }
1400 1506
     			} elseif ($result['value'] == '17') {
1401 1507
     			    $error = self::update_from_17();
1402
-    			    if ($error != '') return $error;
1403
-    			    else return self::check_version(true);
1508
+    			    if ($error != '') {
1509
+    			    	return $error;
1510
+    			    } else {
1511
+    			    	return self::check_version(true);
1512
+    			    }
1404 1513
     			} elseif ($result['value'] == '18') {
1405 1514
     			    $error = self::update_from_18();
1406
-    			    if ($error != '') return $error;
1407
-    			    else return self::check_version(true);
1515
+    			    if ($error != '') {
1516
+    			    	return $error;
1517
+    			    } else {
1518
+    			    	return self::check_version(true);
1519
+    			    }
1408 1520
     			} elseif ($result['value'] == '19') {
1409 1521
     			    $error = self::update_from_19();
1410
-    			    if ($error != '') return $error;
1411
-    			    else return self::check_version(true);
1522
+    			    if ($error != '') {
1523
+    			    	return $error;
1524
+    			    } else {
1525
+    			    	return self::check_version(true);
1526
+    			    }
1412 1527
     			} elseif ($result['value'] == '20') {
1413 1528
     			    $error = self::update_from_20();
1414
-    			    if ($error != '') return $error;
1415
-    			    else return self::check_version(true);
1529
+    			    if ($error != '') {
1530
+    			    	return $error;
1531
+    			    } else {
1532
+    			    	return self::check_version(true);
1533
+    			    }
1416 1534
     			} elseif ($result['value'] == '21') {
1417 1535
     			    $error = self::update_from_21();
1418
-    			    if ($error != '') return $error;
1419
-    			    else return self::check_version(true);
1536
+    			    if ($error != '') {
1537
+    			    	return $error;
1538
+    			    } else {
1539
+    			    	return self::check_version(true);
1540
+    			    }
1420 1541
     			} elseif ($result['value'] == '22') {
1421 1542
     			    $error = self::update_from_22();
1422
-    			    if ($error != '') return $error;
1423
-    			    else return self::check_version(true);
1543
+    			    if ($error != '') {
1544
+    			    	return $error;
1545
+    			    } else {
1546
+    			    	return self::check_version(true);
1547
+    			    }
1424 1548
     			} elseif ($result['value'] == '23') {
1425 1549
     			    $error = self::update_from_23();
1426
-    			    if ($error != '') return $error;
1427
-    			    else return self::check_version(true);
1550
+    			    if ($error != '') {
1551
+    			    	return $error;
1552
+    			    } else {
1553
+    			    	return self::check_version(true);
1554
+    			    }
1428 1555
     			} elseif ($result['value'] == '24') {
1429 1556
     			    $error = self::update_from_24();
1430
-    			    if ($error != '') return $error;
1431
-    			    else return self::check_version(true);
1557
+    			    if ($error != '') {
1558
+    			    	return $error;
1559
+    			    } else {
1560
+    			    	return self::check_version(true);
1561
+    			    }
1432 1562
     			} elseif ($result['value'] == '25') {
1433 1563
     			    $error = self::update_from_25();
1434
-    			    if ($error != '') return $error;
1435
-    			    else return self::check_version(true);
1564
+    			    if ($error != '') {
1565
+    			    	return $error;
1566
+    			    } else {
1567
+    			    	return self::check_version(true);
1568
+    			    }
1436 1569
     			} elseif ($result['value'] == '26') {
1437 1570
     			    $error = self::update_from_26();
1438
-    			    if ($error != '') return $error;
1439
-    			    else return self::check_version(true);
1571
+    			    if ($error != '') {
1572
+    			    	return $error;
1573
+    			    } else {
1574
+    			    	return self::check_version(true);
1575
+    			    }
1440 1576
     			} elseif ($result['value'] == '27') {
1441 1577
     			    $error = self::update_from_27();
1442
-    			    if ($error != '') return $error;
1443
-    			    else return self::check_version(true);
1578
+    			    if ($error != '') {
1579
+    			    	return $error;
1580
+    			    } else {
1581
+    			    	return self::check_version(true);
1582
+    			    }
1444 1583
     			} elseif ($result['value'] == '28') {
1445 1584
     			    $error = self::update_from_28();
1446
-    			    if ($error != '') return $error;
1447
-    			    else return self::check_version(true);
1585
+    			    if ($error != '') {
1586
+    			    	return $error;
1587
+    			    } else {
1588
+    			    	return self::check_version(true);
1589
+    			    }
1448 1590
     			} elseif ($result['value'] == '29') {
1449 1591
     			    $error = self::update_from_29();
1450
-    			    if ($error != '') return $error;
1451
-    			    else return self::check_version(true);
1592
+    			    if ($error != '') {
1593
+    			    	return $error;
1594
+    			    } else {
1595
+    			    	return self::check_version(true);
1596
+    			    }
1452 1597
     			} elseif ($result['value'] == '30') {
1453 1598
     			    $error = self::update_from_30();
1454
-    			    if ($error != '') return $error;
1455
-    			    else return self::check_version(true);
1599
+    			    if ($error != '') {
1600
+    			    	return $error;
1601
+    			    } else {
1602
+    			    	return self::check_version(true);
1603
+    			    }
1456 1604
     			} elseif ($result['value'] == '31') {
1457 1605
     			    $error = self::update_from_31();
1458
-    			    if ($error != '') return $error;
1459
-    			    else return self::check_version(true);
1460
-    			} else return '';
1606
+    			    if ($error != '') {
1607
+    			    	return $error;
1608
+    			    } else {
1609
+    			    	return self::check_version(true);
1610
+    			    }
1611
+    			} else {
1612
+    				return '';
1613
+    			}
1614
+    		    } else {
1615
+    		    	return $result['value'];
1461 1616
     		    }
1462
-    		    else return $result['value'];
1463 1617
 		}
1464 1618
 		
1465
-	    } else return $version;
1619
+	    } else {
1620
+	    	return $version;
1621
+	    }
1466 1622
     	}
1467 1623
     	
1468 1624
 }
Please login to merge, or discard this patch.
require/class.Spotter.php 2 patches
Indentation   +1299 added lines, -1299 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 
86 86
 	/**
87
-	* Executes the SQL statements to get the spotter information
88
-	*
89
-	* @param String $query the SQL query
90
-	* @param Array $params parameter of the query
91
-	* @param String $limitQuery the limit query
92
-	* @return Array the spotter information
93
-	*
94
-	*/
87
+	 * Executes the SQL statements to get the spotter information
88
+	 *
89
+	 * @param String $query the SQL query
90
+	 * @param Array $params parameter of the query
91
+	 * @param String $limitQuery the limit query
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
96 96
 	{
97 97
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
256 256
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
257 257
 					} else $temp_array['aircraft_shadow'] = 'default.png';
258
-                                } else {
259
-                            		$temp_array['aircraft_shadow'] = 'default.png';
258
+								} else {
259
+									$temp_array['aircraft_shadow'] = 'default.png';
260 260
 					$temp_array['aircraft_name'] = 'N/A';
261 261
 					$temp_array['aircraft_manufacturer'] = 'N/A';
262
-                            	}
262
+								}
263 263
 			}
264 264
 			$fromsource = NULL;
265 265
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 	
456 456
 	
457 457
 	/**
458
-	* Gets all the spotter information
459
-	*
460
-	* @return Array the spotter information
461
-	*
462
-	*/
458
+	 * Gets all the spotter information
459
+	 *
460
+	 * @return Array the spotter information
461
+	 *
462
+	 */
463 463
 	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())
464 464
 	{
465 465
 		global $globalTimezone, $globalDBdriver;
@@ -806,11 +806,11 @@  discard block
 block discarded – undo
806 806
 	
807 807
 	
808 808
 	/**
809
-	* Gets all the spotter information based on the latest data entry
810
-	*
811
-	* @return Array the spotter information
812
-	*
813
-	*/
809
+	 * Gets all the spotter information based on the latest data entry
810
+	 *
811
+	 * @return Array the spotter information
812
+	 *
813
+	 */
814 814
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
815 815
 	{
816 816
 		global $global_query;
@@ -849,12 +849,12 @@  discard block
 block discarded – undo
849 849
 	}
850 850
     
851 851
     
852
-    /**
853
-	* Gets all the spotter information based on a user's latitude and longitude
854
-	*
855
-	* @return Array the spotter information
856
-	*
857
-	*/
852
+	/**
853
+	 * Gets all the spotter information based on a user's latitude and longitude
854
+	 *
855
+	 * @return Array the spotter information
856
+	 *
857
+	 */
858 858
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
859 859
 	{
860 860
 		date_default_timezone_set('UTC');
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 				return false;
883 883
 			}
884 884
 		}
885
-    		$additional_query = '';
885
+			$additional_query = '';
886 886
 		if ($interval != "")
887 887
 		{
888 888
 			if (!is_string($interval))
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	}
923 923
     
924 924
     
925
-    /**
926
-	* Gets all the spotter information sorted by the newest aircraft type
927
-	*
928
-	* @return Array the spotter information
929
-	*
930
-	*/
925
+	/**
926
+	 * Gets all the spotter information sorted by the newest aircraft type
927
+	 *
928
+	 * @return Array the spotter information
929
+	 *
930
+	 */
931 931
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
932 932
 	{
933 933
 		global $global_query;
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
     
969 969
     
970 970
 	/**
971
-	* Gets all the spotter information sorted by the newest aircraft registration
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
971
+	 * Gets all the spotter information sorted by the newest aircraft registration
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1012,11 +1012,11 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 
1014 1014
 	/**
1015
-	* Gets all the spotter information sorted by the newest airline
1016
-	*
1017
-	* @return Array the spotter information
1018
-	*
1019
-	*/
1015
+	 * Gets all the spotter information sorted by the newest airline
1016
+	 *
1017
+	 * @return Array the spotter information
1018
+	 *
1019
+	 */
1020 1020
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1021 1021
 	{
1022 1022
 		global $global_query;
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
 	}
1056 1056
     
1057 1057
     
1058
-    /**
1059
-	* Gets all the spotter information sorted by the newest departure airport
1060
-	*
1061
-	* @return Array the spotter information
1062
-	*
1063
-	*/
1058
+	/**
1059
+	 * Gets all the spotter information sorted by the newest departure airport
1060
+	 *
1061
+	 * @return Array the spotter information
1062
+	 *
1063
+	 */
1064 1064
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1065 1065
 	{
1066 1066
 		global $global_query;
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
 
1104 1104
 	/**
1105
-	* Gets all the spotter information sorted by the newest arrival airport
1106
-	*
1107
-	* @return Array the spotter information
1108
-	*
1109
-	*/
1105
+	 * Gets all the spotter information sorted by the newest arrival airport
1106
+	 *
1107
+	 * @return Array the spotter information
1108
+	 *
1109
+	 */
1110 1110
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1111 1111
 	{
1112 1112
 		global $global_query;
@@ -1145,11 +1145,11 @@  discard block
 block discarded – undo
1145 1145
 	
1146 1146
 
1147 1147
 	/**
1148
-	* Gets all the spotter information based on the spotter id
1149
-	*
1150
-	* @return Array the spotter information
1151
-	*
1152
-	*/
1148
+	 * Gets all the spotter information based on the spotter id
1149
+	 *
1150
+	 * @return Array the spotter information
1151
+	 *
1152
+	 */
1153 1153
 	public function getSpotterDataByID($id = '')
1154 1154
 	{
1155 1155
 		global $global_query;
@@ -1171,11 +1171,11 @@  discard block
 block discarded – undo
1171 1171
 	
1172 1172
 	
1173 1173
 	/**
1174
-	* Gets all the spotter information based on the callsign
1175
-	*
1176
-	* @return Array the spotter information
1177
-	*
1178
-	*/
1174
+	 * Gets all the spotter information based on the callsign
1175
+	 *
1176
+	 * @return Array the spotter information
1177
+	 *
1178
+	 */
1179 1179
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1180 1180
 	{
1181 1181
 		global $global_query;
@@ -1228,11 +1228,11 @@  discard block
 block discarded – undo
1228 1228
 	
1229 1229
 	
1230 1230
 	/**
1231
-	* Gets all the spotter information based on the aircraft type
1232
-	*
1233
-	* @return Array the spotter information
1234
-	*
1235
-	*/
1231
+	 * Gets all the spotter information based on the aircraft type
1232
+	 *
1233
+	 * @return Array the spotter information
1234
+	 *
1235
+	 */
1236 1236
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1237 1237
 	{
1238 1238
 		global $global_query;
@@ -1286,11 +1286,11 @@  discard block
 block discarded – undo
1286 1286
 	
1287 1287
 	
1288 1288
 	/**
1289
-	* Gets all the spotter information based on the aircraft registration
1290
-	*
1291
-	* @return Array the spotter information
1292
-	*
1293
-	*/
1289
+	 * Gets all the spotter information based on the aircraft registration
1290
+	 *
1291
+	 * @return Array the spotter information
1292
+	 *
1293
+	 */
1294 1294
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1295 1295
 	{
1296 1296
 		global $global_query;
@@ -1347,11 +1347,11 @@  discard block
 block discarded – undo
1347 1347
 	
1348 1348
 	
1349 1349
 	/**
1350
-	* Gets all the spotter information based on the airline
1351
-	*
1352
-	* @return Array the spotter information
1353
-	*
1354
-	*/
1350
+	 * Gets all the spotter information based on the airline
1351
+	 *
1352
+	 * @return Array the spotter information
1353
+	 *
1354
+	 */
1355 1355
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1356 1356
 	{
1357 1357
 		global $global_query;
@@ -1404,11 +1404,11 @@  discard block
 block discarded – undo
1404 1404
 	
1405 1405
 	
1406 1406
 	/**
1407
-	* Gets all the spotter information based on the airport
1408
-	*
1409
-	* @return Array the spotter information
1410
-	*
1411
-	*/
1407
+	 * Gets all the spotter information based on the airport
1408
+	 *
1409
+	 * @return Array the spotter information
1410
+	 *
1411
+	 */
1412 1412
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1413 1413
 	{
1414 1414
 		global $global_query;
@@ -1462,11 +1462,11 @@  discard block
 block discarded – undo
1462 1462
 
1463 1463
 
1464 1464
 	/**
1465
-	* Gets all the spotter information based on the date
1466
-	*
1467
-	* @return Array the spotter information
1468
-	*
1469
-	*/
1465
+	 * Gets all the spotter information based on the date
1466
+	 *
1467
+	 * @return Array the spotter information
1468
+	 *
1469
+	 */
1470 1470
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1471 1471
 	{
1472 1472
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1530,11 +1530,11 @@  discard block
 block discarded – undo
1530 1530
 
1531 1531
 
1532 1532
 	/**
1533
-	* Gets all the spotter information based on the country name
1534
-	*
1535
-	* @return Array the spotter information
1536
-	*
1537
-	*/
1533
+	 * Gets all the spotter information based on the country name
1534
+	 *
1535
+	 * @return Array the spotter information
1536
+	 *
1537
+	 */
1538 1538
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1539 1539
 	{
1540 1540
 		global $global_query;
@@ -1588,11 +1588,11 @@  discard block
 block discarded – undo
1588 1588
 	
1589 1589
 	
1590 1590
 	/**
1591
-	* Gets all the spotter information based on the manufacturer name
1592
-	*
1593
-	* @return Array the spotter information
1594
-	*
1595
-	*/
1591
+	 * Gets all the spotter information based on the manufacturer name
1592
+	 *
1593
+	 * @return Array the spotter information
1594
+	 *
1595
+	 */
1596 1596
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1597 1597
 	{
1598 1598
 		global $global_query;
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
   
1649 1649
   
1650 1650
 	/**
1651
-	* Gets a list of all aircraft that take a route
1652
-	*
1653
-	* @param String $departure_airport_icao ICAO code of departure airport
1654
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1655
-	* @return Array the spotter information
1656
-	*
1657
-	*/
1651
+	 * Gets a list of all aircraft that take a route
1652
+	 *
1653
+	 * @param String $departure_airport_icao ICAO code of departure airport
1654
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1655
+	 * @return Array the spotter information
1656
+	 *
1657
+	 */
1658 1658
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1659 1659
 	{
1660 1660
 		global $global_query;
@@ -1723,11 +1723,11 @@  discard block
 block discarded – undo
1723 1723
 	
1724 1724
 	
1725 1725
 	/**
1726
-	* Gets all the spotter information based on the special column in the table
1727
-	*
1728
-	* @return Array the spotter information
1729
-	*
1730
-	*/
1726
+	 * Gets all the spotter information based on the special column in the table
1727
+	 *
1728
+	 * @return Array the spotter information
1729
+	 *
1730
+	 */
1731 1731
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1732 1732
 	{
1733 1733
 		global $global_query;
@@ -1766,11 +1766,11 @@  discard block
 block discarded – undo
1766 1766
 	}
1767 1767
 
1768 1768
 	/**
1769
-	* Gets all the highlight based on a aircraft registration
1770
-	*
1771
-	* @return String the highlight text
1772
-	*
1773
-	*/
1769
+	 * Gets all the highlight based on a aircraft registration
1770
+	 *
1771
+	 * @return String the highlight text
1772
+	 *
1773
+	 */
1774 1774
 	public function getHighlightByRegistration($registration,$filter = array())
1775 1775
 	{
1776 1776
 		global $global_query;
@@ -1792,13 +1792,13 @@  discard block
 block discarded – undo
1792 1792
 
1793 1793
 	
1794 1794
 	/**
1795
-	* Gets the squawk usage from squawk code
1796
-	*
1797
-	* @param String $squawk squawk code
1798
-	* @param String $country country
1799
-	* @return String usage
1800
-	*
1801
-	*/
1795
+	 * Gets the squawk usage from squawk code
1796
+	 *
1797
+	 * @param String $squawk squawk code
1798
+	 * @param String $country country
1799
+	 * @return String usage
1800
+	 *
1801
+	 */
1802 1802
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1803 1803
 	{
1804 1804
 		
@@ -1819,12 +1819,12 @@  discard block
 block discarded – undo
1819 1819
 	}
1820 1820
 
1821 1821
 	/**
1822
-	* Gets the airport icao from the iata
1823
-	*
1824
-	* @param String $airport_iata the iata code of the airport
1825
-	* @return String airport iata
1826
-	*
1827
-	*/
1822
+	 * Gets the airport icao from the iata
1823
+	 *
1824
+	 * @param String $airport_iata the iata code of the airport
1825
+	 * @return String airport iata
1826
+	 *
1827
+	 */
1828 1828
 	public function getAirportIcao($airport_iata = '')
1829 1829
 	{
1830 1830
 		
@@ -1844,14 +1844,14 @@  discard block
 block discarded – undo
1844 1844
 	}
1845 1845
 
1846 1846
 	/**
1847
-	* Gets the airport distance
1848
-	*
1849
-	* @param String $airport_icao the icao code of the airport
1850
-	* @param Float $latitude the latitude
1851
-	* @param Float $longitude the longitude
1852
-	* @return Float distance to the airport
1853
-	*
1854
-	*/
1847
+	 * Gets the airport distance
1848
+	 *
1849
+	 * @param String $airport_icao the icao code of the airport
1850
+	 * @param Float $latitude the latitude
1851
+	 * @param Float $longitude the longitude
1852
+	 * @return Float distance to the airport
1853
+	 *
1854
+	 */
1855 1855
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1856 1856
 	{
1857 1857
 		
@@ -1872,12 +1872,12 @@  discard block
 block discarded – undo
1872 1872
 	}
1873 1873
 	
1874 1874
 	/**
1875
-	* Gets the airport info based on the icao
1876
-	*
1877
-	* @param String $airport the icao code of the airport
1878
-	* @return Array airport information
1879
-	*
1880
-	*/
1875
+	 * Gets the airport info based on the icao
1876
+	 *
1877
+	 * @param String $airport the icao code of the airport
1878
+	 * @return Array airport information
1879
+	 *
1880
+	 */
1881 1881
 	public function getAllAirportInfo($airport = '')
1882 1882
 	{
1883 1883
 		
@@ -1923,12 +1923,12 @@  discard block
 block discarded – undo
1923 1923
 	}
1924 1924
 	
1925 1925
 	/**
1926
-	* Gets the airport info based on the country
1927
-	*
1928
-	* @param Array $countries Airports countries
1929
-	* @return Array airport information
1930
-	*
1931
-	*/
1926
+	 * Gets the airport info based on the country
1927
+	 *
1928
+	 * @param Array $countries Airports countries
1929
+	 * @return Array airport information
1930
+	 *
1931
+	 */
1932 1932
 	public function getAllAirportInfobyCountry($countries)
1933 1933
 	{
1934 1934
 		$lst_countries = '';
@@ -1966,12 +1966,12 @@  discard block
 block discarded – undo
1966 1966
 	}
1967 1967
 	
1968 1968
 	/**
1969
-	* Gets airports info based on the coord
1970
-	*
1971
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1972
-	* @return Array airport information
1973
-	*
1974
-	*/
1969
+	 * Gets airports info based on the coord
1970
+	 *
1971
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1972
+	 * @return Array airport information
1973
+	 *
1974
+	 */
1975 1975
 	public function getAllAirportInfobyCoord($coord)
1976 1976
 	{
1977 1977
 		global $globalDBdriver;
@@ -2002,12 +2002,12 @@  discard block
 block discarded – undo
2002 2002
 	}
2003 2003
 
2004 2004
 	/**
2005
-	* Gets waypoints info based on the coord
2006
-	*
2007
-	* @param Array $coord waypoints coord
2008
-	* @return Array airport information
2009
-	*
2010
-	*/
2005
+	 * Gets waypoints info based on the coord
2006
+	 *
2007
+	 * @param Array $coord waypoints coord
2008
+	 * @return Array airport information
2009
+	 *
2010
+	 */
2011 2011
 	public function getAllWaypointsInfobyCoord($coord)
2012 2012
 	{
2013 2013
 		if (is_array($coord)) {
@@ -2041,12 +2041,12 @@  discard block
 block discarded – undo
2041 2041
 	
2042 2042
 	
2043 2043
 	/**
2044
-	* Gets the airline info based on the icao code or iata code
2045
-	*
2046
-	* @param String $airline_icao the iata code of the airport
2047
-	* @return Array airport information
2048
-	*
2049
-	*/
2044
+	 * Gets the airline info based on the icao code or iata code
2045
+	 *
2046
+	 * @param String $airline_icao the iata code of the airport
2047
+	 * @return Array airport information
2048
+	 *
2049
+	 */
2050 2050
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2051 2051
 	{
2052 2052
 		global $globalUseRealAirlines;
@@ -2077,7 +2077,7 @@  discard block
 block discarded – undo
2077 2077
 			} else {
2078 2078
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2079 2079
 			}
2080
-                        /*
2080
+						/*
2081 2081
 			$airline_array = array();
2082 2082
 			$temp_array = array();
2083 2083
 		
@@ -2107,12 +2107,12 @@  discard block
 block discarded – undo
2107 2107
 	}
2108 2108
 	
2109 2109
 	/**
2110
-	* Gets the airline info based on the airline name
2111
-	*
2112
-	* @param String $airline_name the name of the airline
2113
-	* @return Array airline information
2114
-	*
2115
-	*/
2110
+	 * Gets the airline info based on the airline name
2111
+	 *
2112
+	 * @param String $airline_name the name of the airline
2113
+	 * @return Array airline information
2114
+	 *
2115
+	 */
2116 2116
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2117 2117
 	{
2118 2118
 		global $globalUseRealAirlines;
@@ -2140,12 +2140,12 @@  discard block
 block discarded – undo
2140 2140
 	
2141 2141
 	
2142 2142
 	/**
2143
-	* Gets the aircraft info based on the aircraft type
2144
-	*
2145
-	* @param String $aircraft_type the aircraft type
2146
-	* @return Array aircraft information
2147
-	*
2148
-	*/
2143
+	 * Gets the aircraft info based on the aircraft type
2144
+	 *
2145
+	 * @param String $aircraft_type the aircraft type
2146
+	 * @return Array aircraft information
2147
+	 *
2148
+	 */
2149 2149
 	public function getAllAircraftInfo($aircraft_type)
2150 2150
 	{
2151 2151
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2177,12 +2177,12 @@  discard block
 block discarded – undo
2177 2177
 	}
2178 2178
 
2179 2179
 	/**
2180
-	* Gets the aircraft icao based on the aircraft name/type
2181
-	*
2182
-	* @param String $aircraft_type the aircraft type
2183
-	* @return String aircraft information
2184
-	*
2185
-	*/
2180
+	 * Gets the aircraft icao based on the aircraft name/type
2181
+	 *
2182
+	 * @param String $aircraft_type the aircraft type
2183
+	 * @return String aircraft information
2184
+	 *
2185
+	 */
2186 2186
 	public function getAircraftIcao($aircraft_type)
2187 2187
 	{
2188 2188
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2207,12 +2207,12 @@  discard block
 block discarded – undo
2207 2207
 	}
2208 2208
 	
2209 2209
 	/**
2210
-	* Gets the aircraft info based on the aircraft modes
2211
-	*
2212
-	* @param String $aircraft_modes the aircraft ident (hex)
2213
-	* @return String aircraft type
2214
-	*
2215
-	*/
2210
+	 * Gets the aircraft info based on the aircraft modes
2211
+	 *
2212
+	 * @param String $aircraft_modes the aircraft ident (hex)
2213
+	 * @return String aircraft type
2214
+	 *
2215
+	 */
2216 2216
 	public function getAllAircraftType($aircraft_modes)
2217 2217
 	{
2218 2218
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2230,12 +2230,12 @@  discard block
 block discarded – undo
2230 2230
 	}
2231 2231
 
2232 2232
 	/**
2233
-	* Gets the aircraft info based on the aircraft registration
2234
-	*
2235
-	* @param String $registration the aircraft registration
2236
-	* @return String aircraft type
2237
-	*
2238
-	*/
2233
+	 * Gets the aircraft info based on the aircraft registration
2234
+	 *
2235
+	 * @param String $registration the aircraft registration
2236
+	 * @return String aircraft type
2237
+	 *
2238
+	 */
2239 2239
 	public function getAllAircraftTypeByRegistration($registration)
2240 2240
 	{
2241 2241
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2253,12 +2253,12 @@  discard block
 block discarded – undo
2253 2253
 	}
2254 2254
 
2255 2255
 	/**
2256
-	* Gets correct aircraft operator corde
2257
-	*
2258
-	* @param String $operator the aircraft operator code (callsign)
2259
-	* @return String aircraft operator code
2260
-	*
2261
-	*/
2256
+	 * Gets correct aircraft operator corde
2257
+	 *
2258
+	 * @param String $operator the aircraft operator code (callsign)
2259
+	 * @return String aircraft operator code
2260
+	 *
2261
+	 */
2262 2262
 	public function getOperator($operator)
2263 2263
 	{
2264 2264
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2275,16 +2275,16 @@  discard block
 block discarded – undo
2275 2275
 	}
2276 2276
 
2277 2277
 	/**
2278
-	* Gets the aircraft route based on the aircraft callsign
2279
-	*
2280
-	* @param String $callsign the aircraft callsign
2281
-	* @return Array aircraft type
2282
-	*
2283
-	*/
2278
+	 * Gets the aircraft route based on the aircraft callsign
2279
+	 *
2280
+	 * @param String $callsign the aircraft callsign
2281
+	 * @return Array aircraft type
2282
+	 *
2283
+	 */
2284 2284
 	public function getRouteInfo($callsign)
2285 2285
 	{
2286 2286
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2287
-                if ($callsign == '') return array();
2287
+				if ($callsign == '') return array();
2288 2288
 		$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";
2289 2289
 		
2290 2290
 		$sth = $this->db->prepare($query);
@@ -2298,12 +2298,12 @@  discard block
 block discarded – undo
2298 2298
 	}
2299 2299
 	
2300 2300
 	/**
2301
-	* Gets the aircraft info based on the aircraft registration
2302
-	*
2303
-	* @param String $registration the aircraft registration
2304
-	* @return Array aircraft information
2305
-	*
2306
-	*/
2301
+	 * Gets the aircraft info based on the aircraft registration
2302
+	 *
2303
+	 * @param String $registration the aircraft registration
2304
+	 * @return Array aircraft information
2305
+	 *
2306
+	 */
2307 2307
 	public function getAircraftInfoByRegistration($registration)
2308 2308
 	{
2309 2309
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2330,12 +2330,12 @@  discard block
 block discarded – undo
2330 2330
 	}
2331 2331
 	
2332 2332
 	/**
2333
-	* Gets the aircraft owner & base based on the aircraft registration
2334
-	*
2335
-	* @param String $registration the aircraft registration
2336
-	* @return Array aircraft information
2337
-	*
2338
-	*/
2333
+	 * Gets the aircraft owner & base based on the aircraft registration
2334
+	 *
2335
+	 * @param String $registration the aircraft registration
2336
+	 * @return Array aircraft information
2337
+	 *
2338
+	 */
2339 2339
 	public function getAircraftOwnerByRegistration($registration)
2340 2340
 	{
2341 2341
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2352,11 +2352,11 @@  discard block
 block discarded – undo
2352 2352
 	
2353 2353
   
2354 2354
   /**
2355
-	* Gets all flights (but with only little info)
2356
-	*
2357
-	* @return Array basic flight information
2358
-	*
2359
-	*/
2355
+   * Gets all flights (but with only little info)
2356
+   *
2357
+   * @return Array basic flight information
2358
+   *
2359
+   */
2360 2360
 	public function getAllFlightsforSitemap()
2361 2361
 	{
2362 2362
 		//$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 ";
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 		
2365 2365
 		$sth = $this->db->prepare($query);
2366 2366
 		$sth->execute();
2367
-                  /*
2367
+				  /*
2368 2368
 		$flight_array = array();
2369 2369
 		$temp_array = array();
2370 2370
 		
@@ -2386,11 +2386,11 @@  discard block
 block discarded – undo
2386 2386
 	}
2387 2387
   
2388 2388
 	/**
2389
-	* Gets a list of all aircraft manufacturers
2390
-	*
2391
-	* @return Array list of aircraft types
2392
-	*
2393
-	*/
2389
+	 * Gets a list of all aircraft manufacturers
2390
+	 *
2391
+	 * @return Array list of aircraft types
2392
+	 *
2393
+	 */
2394 2394
 	public function getAllManufacturers()
2395 2395
 	{
2396 2396
 		/*
@@ -2419,11 +2419,11 @@  discard block
 block discarded – undo
2419 2419
   
2420 2420
   
2421 2421
   /**
2422
-	* Gets a list of all aircraft types
2423
-	*
2424
-	* @return Array list of aircraft types
2425
-	*
2426
-	*/
2422
+   * Gets a list of all aircraft types
2423
+   *
2424
+   * @return Array list of aircraft types
2425
+   *
2426
+   */
2427 2427
 	public function getAllAircraftTypes($filters = array())
2428 2428
 	{
2429 2429
 		/*
@@ -2458,11 +2458,11 @@  discard block
 block discarded – undo
2458 2458
 	
2459 2459
 	
2460 2460
 	/**
2461
-	* Gets a list of all aircraft registrations
2462
-	*
2463
-	* @return Array list of aircraft registrations
2464
-	*
2465
-	*/
2461
+	 * Gets a list of all aircraft registrations
2462
+	 *
2463
+	 * @return Array list of aircraft registrations
2464
+	 *
2465
+	 */
2466 2466
 	public function getAllAircraftRegistrations($filters = array())
2467 2467
 	{
2468 2468
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2487,12 +2487,12 @@  discard block
 block discarded – undo
2487 2487
 	}
2488 2488
 
2489 2489
 	/**
2490
-	* Gets all source name
2491
-	*
2492
-	* @param String type format of source
2493
-	* @return Array list of source name
2494
-	*
2495
-	*/
2490
+	 * Gets all source name
2491
+	 *
2492
+	 * @param String type format of source
2493
+	 * @return Array list of source name
2494
+	 *
2495
+	 */
2496 2496
 	public function getAllSourceName($type = '',$filters = array())
2497 2497
 	{
2498 2498
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2523,11 +2523,11 @@  discard block
 block discarded – undo
2523 2523
 
2524 2524
 
2525 2525
 	/**
2526
-	* Gets a list of all airline names
2527
-	*
2528
-	* @return Array list of airline names
2529
-	*
2530
-	*/
2526
+	 * Gets a list of all airline names
2527
+	 *
2528
+	 * @return Array list of airline names
2529
+	 *
2530
+	 */
2531 2531
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2532 2532
 	{
2533 2533
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2577,11 +2577,11 @@  discard block
 block discarded – undo
2577 2577
 	
2578 2578
 	
2579 2579
 	/**
2580
-	* Gets a list of all airline countries
2581
-	*
2582
-	* @return Array list of airline countries
2583
-	*
2584
-	*/
2580
+	 * Gets a list of all airline countries
2581
+	 *
2582
+	 * @return Array list of airline countries
2583
+	 *
2584
+	 */
2585 2585
 	public function getAllAirlineCountries($filters = array())
2586 2586
 	{
2587 2587
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2609,11 +2609,11 @@  discard block
 block discarded – undo
2609 2609
 	
2610 2610
 	
2611 2611
 	/**
2612
-	* Gets a list of all departure & arrival names
2613
-	*
2614
-	* @return Array list of airport names
2615
-	*
2616
-	*/
2612
+	 * Gets a list of all departure & arrival names
2613
+	 *
2614
+	 * @return Array list of airport names
2615
+	 *
2616
+	 */
2617 2617
 	public function getAllAirportNames($filters = array())
2618 2618
 	{
2619 2619
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2662,11 +2662,11 @@  discard block
 block discarded – undo
2662 2662
 	
2663 2663
 	
2664 2664
 	/**
2665
-	* Gets a list of all departure & arrival airport countries
2666
-	*
2667
-	* @return Array list of airport countries
2668
-	*
2669
-	*/
2665
+	 * Gets a list of all departure & arrival airport countries
2666
+	 *
2667
+	 * @return Array list of airport countries
2668
+	 *
2669
+	 */
2670 2670
 	public function getAllAirportCountries($filters = array())
2671 2671
 	{
2672 2672
 		$airport_array = array();
@@ -2714,11 +2714,11 @@  discard block
 block discarded – undo
2714 2714
 	
2715 2715
 	
2716 2716
 	/**
2717
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2718
-	*
2719
-	* @return Array list of countries
2720
-	*
2721
-	*/
2717
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2718
+	 *
2719
+	 * @return Array list of countries
2720
+	 *
2721
+	 */
2722 2722
 	public function getAllCountries($filters = array())
2723 2723
 	{
2724 2724
 		$Connection= new Connection($this->db);
@@ -2795,11 +2795,11 @@  discard block
 block discarded – undo
2795 2795
 	
2796 2796
 	
2797 2797
 	/**
2798
-	* Gets a list of all idents/callsigns
2799
-	*
2800
-	* @return Array list of ident/callsign names
2801
-	*
2802
-	*/
2798
+	 * Gets a list of all idents/callsigns
2799
+	 *
2800
+	 * @return Array list of ident/callsign names
2801
+	 *
2802
+	 */
2803 2803
 	public function getAllIdents($filters = array())
2804 2804
 	{
2805 2805
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2823,9 +2823,9 @@  discard block
 block discarded – undo
2823 2823
 	}
2824 2824
 
2825 2825
 	/**
2826
-	* Get a list of flights from airport since 7 days
2827
-	* @return Array number, icao, name and city of airports
2828
-	*/
2826
+	 * Get a list of flights from airport since 7 days
2827
+	 * @return Array number, icao, name and city of airports
2828
+	 */
2829 2829
 
2830 2830
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2831 2831
 		global $globalTimezone, $globalDBdriver;
@@ -2856,9 +2856,9 @@  discard block
 block discarded – undo
2856 2856
 	}
2857 2857
 
2858 2858
 	/**
2859
-	* Get a list of flights from airport since 7 days
2860
-	* @return Array number, icao, name and city of airports
2861
-	*/
2859
+	 * Get a list of flights from airport since 7 days
2860
+	 * @return Array number, icao, name and city of airports
2861
+	 */
2862 2862
 
2863 2863
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2864 2864
 		global $globalTimezone, $globalDBdriver;
@@ -2888,9 +2888,9 @@  discard block
 block discarded – undo
2888 2888
 	}
2889 2889
 
2890 2890
 	/**
2891
-	* Get a list of flights from detected airport since 7 days
2892
-	* @return Array number, icao, name and city of airports
2893
-	*/
2891
+	 * Get a list of flights from detected airport since 7 days
2892
+	 * @return Array number, icao, name and city of airports
2893
+	 */
2894 2894
 
2895 2895
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2896 2896
 		global $globalTimezone, $globalDBdriver;
@@ -2928,9 +2928,9 @@  discard block
 block discarded – undo
2928 2928
 	}
2929 2929
 
2930 2930
 	/**
2931
-	* Get a list of flights from detected airport since 7 days
2932
-	* @return Array number, icao, name and city of airports
2933
-	*/
2931
+	 * Get a list of flights from detected airport since 7 days
2932
+	 * @return Array number, icao, name and city of airports
2933
+	 */
2934 2934
 
2935 2935
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2936 2936
 		global $globalTimezone, $globalDBdriver;
@@ -2972,9 +2972,9 @@  discard block
 block discarded – undo
2972 2972
 
2973 2973
 
2974 2974
 	/**
2975
-	* Get a list of flights to airport since 7 days
2976
-	* @return Array number, icao, name and city of airports
2977
-	*/
2975
+	 * Get a list of flights to airport since 7 days
2976
+	 * @return Array number, icao, name and city of airports
2977
+	 */
2978 2978
 
2979 2979
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2980 2980
 		global $globalTimezone, $globalDBdriver;
@@ -3007,9 +3007,9 @@  discard block
 block discarded – undo
3007 3007
 
3008 3008
 
3009 3009
 	/**
3010
-	* Get a list of flights detected to airport since 7 days
3011
-	* @return Array number, icao, name and city of airports
3012
-	*/
3010
+	 * Get a list of flights detected to airport since 7 days
3011
+	 * @return Array number, icao, name and city of airports
3012
+	 */
3013 3013
 
3014 3014
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3015 3015
 		global $globalTimezone, $globalDBdriver;
@@ -3050,9 +3050,9 @@  discard block
 block discarded – undo
3050 3050
 
3051 3051
 
3052 3052
 	/**
3053
-	* Get a list of flights to airport since 7 days
3054
-	* @return Array number, icao, name and city of airports
3055
-	*/
3053
+	 * Get a list of flights to airport since 7 days
3054
+	 * @return Array number, icao, name and city of airports
3055
+	 */
3056 3056
 
3057 3057
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3058 3058
 		global $globalTimezone, $globalDBdriver;
@@ -3084,9 +3084,9 @@  discard block
 block discarded – undo
3084 3084
 
3085 3085
 
3086 3086
 	/**
3087
-	* Get a list of flights detected to airport since 7 days
3088
-	* @return Array number, icao, name and city of airports
3089
-	*/
3087
+	 * Get a list of flights detected to airport since 7 days
3088
+	 * @return Array number, icao, name and city of airports
3089
+	 */
3090 3090
 
3091 3091
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3092 3092
 		global $globalTimezone, $globalDBdriver;
@@ -3130,11 +3130,11 @@  discard block
 block discarded – undo
3130 3130
 
3131 3131
 
3132 3132
 	/**
3133
-	* Gets a list of all dates
3134
-	*
3135
-	* @return Array list of date names
3136
-	*
3137
-	*/
3133
+	 * Gets a list of all dates
3134
+	 *
3135
+	 * @return Array list of date names
3136
+	 *
3137
+	 */
3138 3138
 	public function getAllDates()
3139 3139
 	{
3140 3140
 		global $globalTimezone, $globalDBdriver;
@@ -3175,11 +3175,11 @@  discard block
 block discarded – undo
3175 3175
 	
3176 3176
 	
3177 3177
 	/**
3178
-	* Gets all route combinations
3179
-	*
3180
-	* @return Array the route list
3181
-	*
3182
-	*/
3178
+	 * Gets all route combinations
3179
+	 *
3180
+	 * @return Array the route list
3181
+	 *
3182
+	 */
3183 3183
 	public function getAllRoutes()
3184 3184
 	{
3185 3185
 		$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 
@@ -3205,13 +3205,13 @@  discard block
 block discarded – undo
3205 3205
 	}
3206 3206
 
3207 3207
 	/**
3208
-	* Update ident spotter data
3209
-	*
3210
-	* @param String $flightaware_id the ID from flightaware
3211
-	* @param String $ident the flight ident
3212
-	* @return String success or false
3213
-	*
3214
-	*/	
3208
+	 * Update ident spotter data
3209
+	 *
3210
+	 * @param String $flightaware_id the ID from flightaware
3211
+	 * @param String $ident the flight ident
3212
+	 * @return String success or false
3213
+	 *
3214
+	 */	
3215 3215
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3216 3216
 	{
3217 3217
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3232,14 +3232,14 @@  discard block
 block discarded – undo
3232 3232
 		} else {
3233 3233
 			$airline_array = $this->getAllAirlineInfo("NA");
3234 3234
 		}
3235
-                $airline_name = $airline_array[0]['name'];
3236
-                $airline_icao = $airline_array[0]['icao'];
3237
-                $airline_country = $airline_array[0]['country'];
3238
-                $airline_type = $airline_array[0]['type'];
3235
+				$airline_name = $airline_array[0]['name'];
3236
+				$airline_icao = $airline_array[0]['icao'];
3237
+				$airline_country = $airline_array[0]['country'];
3238
+				$airline_type = $airline_array[0]['type'];
3239 3239
 
3240 3240
 
3241 3241
 		$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';
3242
-                $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);
3242
+				$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);
3243 3243
 
3244 3244
 		try {
3245 3245
 			$sth = $this->db->prepare($query);
@@ -3252,19 +3252,19 @@  discard block
 block discarded – undo
3252 3252
 
3253 3253
 	}
3254 3254
 	/**
3255
-	* Update latest spotter data
3256
-	*
3257
-	* @param String $flightaware_id the ID from flightaware
3258
-	* @param String $ident the flight ident
3259
-	* @param String $arrival_airport_icao the arrival airport
3260
-	* @return String success or false
3261
-	*
3262
-	*/	
3255
+	 * Update latest spotter data
3256
+	 *
3257
+	 * @param String $flightaware_id the ID from flightaware
3258
+	 * @param String $ident the flight ident
3259
+	 * @param String $arrival_airport_icao the arrival airport
3260
+	 * @return String success or false
3261
+	 *
3262
+	 */	
3263 3263
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3264 3264
 	{
3265 3265
 		if ($groundspeed == '') $groundspeed = NULL;
3266 3266
 		$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';
3267
-                $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);
3267
+				$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);
3268 3268
 
3269 3269
 		try {
3270 3270
 			$sth = $this->db->prepare($query);
@@ -3278,32 +3278,32 @@  discard block
 block discarded – undo
3278 3278
 	}
3279 3279
 
3280 3280
 	/**
3281
-	* Adds a new spotter data
3282
-	*
3283
-	* @param String $flightaware_id the ID from flightaware
3284
-	* @param String $ident the flight ident
3285
-	* @param String $aircraft_icao the aircraft type
3286
-	* @param String $departure_airport_icao the departure airport
3287
-	* @param String $arrival_airport_icao the arrival airport
3288
-	* @param String $latitude latitude of flight
3289
-	* @param String $longitude latitude of flight
3290
-	* @param String $waypoints waypoints of flight
3291
-	* @param String $altitude altitude of flight
3292
-	* @param String $heading heading of flight
3293
-	* @param String $groundspeed speed of flight
3294
-	* @param String $date date of flight
3295
-	* @param String $departure_airport_time departure time of flight
3296
-	* @param String $arrival_airport_time arrival time of flight
3297
-	* @param String $squawk squawk code of flight
3298
-	* @param String $route_stop route stop of flight
3299
-	* @param String $highlight highlight or not
3300
-	* @param String $ModeS ModesS code of flight
3301
-	* @param String $registration registration code of flight
3302
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3303
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3304
-	* @param String $verticalrate vertival rate of flight
3305
-	* @return String success or false
3306
-	*/
3281
+	 * Adds a new spotter data
3282
+	 *
3283
+	 * @param String $flightaware_id the ID from flightaware
3284
+	 * @param String $ident the flight ident
3285
+	 * @param String $aircraft_icao the aircraft type
3286
+	 * @param String $departure_airport_icao the departure airport
3287
+	 * @param String $arrival_airport_icao the arrival airport
3288
+	 * @param String $latitude latitude of flight
3289
+	 * @param String $longitude latitude of flight
3290
+	 * @param String $waypoints waypoints of flight
3291
+	 * @param String $altitude altitude of flight
3292
+	 * @param String $heading heading of flight
3293
+	 * @param String $groundspeed speed of flight
3294
+	 * @param String $date date of flight
3295
+	 * @param String $departure_airport_time departure time of flight
3296
+	 * @param String $arrival_airport_time arrival time of flight
3297
+	 * @param String $squawk squawk code of flight
3298
+	 * @param String $route_stop route stop of flight
3299
+	 * @param String $highlight highlight or not
3300
+	 * @param String $ModeS ModesS code of flight
3301
+	 * @param String $registration registration code of flight
3302
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3303
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3304
+	 * @param String $verticalrate vertival rate of flight
3305
+	 * @return String success or false
3306
+	 */
3307 3307
 	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 = '')
3308 3308
 	{
3309 3309
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3518,8 +3518,8 @@  discard block
 block discarded – undo
3518 3518
     
3519 3519
 		if ($globalIVAO && $aircraft_icao != '')
3520 3520
 		{
3521
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3522
-            		else $airline_icao = '';
3521
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3522
+					else $airline_icao = '';
3523 3523
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3524 3524
 			if (!isset($image_array[0]['registration']))
3525 3525
 			{
@@ -3550,53 +3550,53 @@  discard block
 block discarded – undo
3550 3550
 	
3551 3551
 		if (count($airline_array) == 0) 
3552 3552
 		{
3553
-                        $airline_array = $this->getAllAirlineInfo('NA');
3554
-                }
3555
-                if (count($aircraft_array) == 0) 
3556
-                {
3557
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3558
-                }
3559
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3560
-                {
3561
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3562
-                }
3563
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3564
-                {
3565
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3566
-                }
3567
-                if ($registration == '') $registration = 'NA';
3568
-                if ($latitude == '' && $longitude == '') {
3569
-            		$latitude = 0;
3570
-            		$longitude = 0;
3571
-            	}
3572
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3573
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3574
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3575
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3576
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3577
-                $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) 
3553
+						$airline_array = $this->getAllAirlineInfo('NA');
3554
+				}
3555
+				if (count($aircraft_array) == 0) 
3556
+				{
3557
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3558
+				}
3559
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3560
+				{
3561
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3562
+				}
3563
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3564
+				{
3565
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3566
+				}
3567
+				if ($registration == '') $registration = 'NA';
3568
+				if ($latitude == '' && $longitude == '') {
3569
+					$latitude = 0;
3570
+					$longitude = 0;
3571
+				}
3572
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3573
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3574
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3575
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3576
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3577
+				$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) 
3578 3578
                 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)";
3579 3579
 
3580
-                $airline_name = $airline_array[0]['name'];
3581
-                $airline_icao = $airline_array[0]['icao'];
3582
-                $airline_country = $airline_array[0]['country'];
3583
-                $airline_type = $airline_array[0]['type'];
3580
+				$airline_name = $airline_array[0]['name'];
3581
+				$airline_icao = $airline_array[0]['icao'];
3582
+				$airline_country = $airline_array[0]['country'];
3583
+				$airline_type = $airline_array[0]['type'];
3584 3584
 		if ($airline_type == '') {
3585 3585
 			$timeelapsed = microtime(true);
3586 3586
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3587 3587
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3588 3588
 		}
3589 3589
 		if ($airline_type == null) $airline_type = '';
3590
-                $aircraft_type = $aircraft_array[0]['type'];
3591
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3592
-                $departure_airport_name = $departure_airport_array[0]['name'];
3593
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3594
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3590
+				$aircraft_type = $aircraft_array[0]['type'];
3591
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3592
+				$departure_airport_name = $departure_airport_array[0]['name'];
3593
+			$departure_airport_city = $departure_airport_array[0]['city'];
3594
+				$departure_airport_country = $departure_airport_array[0]['country'];
3595 3595
                 
3596
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3597
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3598
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3599
-                $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);
3596
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3597
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3598
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3599
+				$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);
3600 3600
 
3601 3601
 		try {
3602 3602
 		        
@@ -3604,7 +3604,7 @@  discard block
 block discarded – undo
3604 3604
 			$sth->execute($query_values);
3605 3605
 			$this->db = null;
3606 3606
 		} catch (PDOException $e) {
3607
-		    return "error : ".$e->getMessage();
3607
+			return "error : ".$e->getMessage();
3608 3608
 		}
3609 3609
 		
3610 3610
 		return "success";
@@ -3613,11 +3613,11 @@  discard block
 block discarded – undo
3613 3613
 	
3614 3614
   
3615 3615
 	/**
3616
-	* Gets the aircraft ident within the last hour
3617
-	*
3618
-	* @return String the ident
3619
-	*
3620
-	*/
3616
+	 * Gets the aircraft ident within the last hour
3617
+	 *
3618
+	 * @return String the ident
3619
+	 *
3620
+	 */
3621 3621
 	public function getIdentFromLastHour($ident)
3622 3622
 	{
3623 3623
 		global $globalDBdriver, $globalTimezone;
@@ -3633,11 +3633,11 @@  discard block
 block discarded – undo
3633 3633
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3634 3634
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3635 3635
 			$query_data = array(':ident' => $ident);
3636
-    		}
3636
+			}
3637 3637
 		
3638 3638
 		$sth = $this->db->prepare($query);
3639 3639
 		$sth->execute($query_data);
3640
-    		$ident_result='';
3640
+			$ident_result='';
3641 3641
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3642 3642
 		{
3643 3643
 			$ident_result = $row['ident'];
@@ -3648,11 +3648,11 @@  discard block
 block discarded – undo
3648 3648
 	
3649 3649
 	
3650 3650
 	/**
3651
-	* Gets the aircraft data from the last 20 seconds
3652
-	*
3653
-	* @return Array the spotter data
3654
-	*
3655
-	*/
3651
+	 * Gets the aircraft data from the last 20 seconds
3652
+	 *
3653
+	 * @return Array the spotter data
3654
+	 *
3655
+	 */
3656 3656
 	public function getRealTimeData($q = '')
3657 3657
 	{
3658 3658
 		global $globalDBdriver;
@@ -3696,11 +3696,11 @@  discard block
 block discarded – undo
3696 3696
 	
3697 3697
 	
3698 3698
 	 /**
3699
-	* Gets all airlines that have flown over
3700
-	*
3701
-	* @return Array the airline list
3702
-	*
3703
-	*/
3699
+	  * Gets all airlines that have flown over
3700
+	  *
3701
+	  * @return Array the airline list
3702
+	  *
3703
+	  */
3704 3704
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3705 3705
 	{
3706 3706
 		global $globalDBdriver;
@@ -3714,7 +3714,7 @@  discard block
 block discarded – undo
3714 3714
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3715 3715
 			}
3716 3716
 		}
3717
-                if ($sincedate != '') {
3717
+				if ($sincedate != '') {
3718 3718
 			if ($globalDBdriver == 'mysql') {
3719 3719
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3720 3720
 			} else {
@@ -3741,26 +3741,26 @@  discard block
 block discarded – undo
3741 3741
 	}
3742 3742
 
3743 3743
 	 /**
3744
-	* Gets all pilots that have flown over
3745
-	*
3746
-	* @return Array the pilots list
3747
-	*
3748
-	*/
3744
+	  * Gets all pilots that have flown over
3745
+	  *
3746
+	  * @return Array the pilots list
3747
+	  *
3748
+	  */
3749 3749
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3750 3750
 	{
3751 3751
 		global $globalDBdriver;
3752 3752
 		$filter_query = $this->getFilter($filters,true,true);
3753 3753
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3754 3754
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3755
-                if ($olderthanmonths > 0) {
3756
-            		if ($globalDBdriver == 'mysql') {
3755
+				if ($olderthanmonths > 0) {
3756
+					if ($globalDBdriver == 'mysql') {
3757 3757
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3758 3758
 			} else {
3759 3759
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3760 3760
 			}
3761 3761
 		}
3762
-                if ($sincedate != '') {
3763
-            		if ($globalDBdriver == 'mysql') {
3762
+				if ($sincedate != '') {
3763
+					if ($globalDBdriver == 'mysql') {
3764 3764
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3765 3765
 			} else {
3766 3766
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3788,25 +3788,25 @@  discard block
 block discarded – undo
3788 3788
 	}
3789 3789
 	
3790 3790
 		 /**
3791
-	* Gets all pilots that have flown over
3792
-	*
3793
-	* @return Array the pilots list
3794
-	*
3795
-	*/
3791
+		  * Gets all pilots that have flown over
3792
+		  *
3793
+		  * @return Array the pilots list
3794
+		  *
3795
+		  */
3796 3796
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3797 3797
 	{
3798 3798
 		global $globalDBdriver;
3799 3799
 		$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
3800 3800
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3801
-                if ($olderthanmonths > 0) {
3802
-            		if ($globalDBdriver == 'mysql') {
3801
+				if ($olderthanmonths > 0) {
3802
+					if ($globalDBdriver == 'mysql') {
3803 3803
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3804 3804
 			} else {
3805 3805
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3806 3806
 			}
3807 3807
 		}
3808
-                if ($sincedate != '') {
3809
-            		if ($globalDBdriver == 'mysql') {
3808
+				if ($sincedate != '') {
3809
+					if ($globalDBdriver == 'mysql') {
3810 3810
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3811 3811
 			} else {
3812 3812
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3835,26 +3835,26 @@  discard block
 block discarded – undo
3835 3835
 	}
3836 3836
 	
3837 3837
 	 /**
3838
-	* Gets all owner that have flown over
3839
-	*
3840
-	* @return Array the pilots list
3841
-	*
3842
-	*/
3838
+	  * Gets all owner that have flown over
3839
+	  *
3840
+	  * @return Array the pilots list
3841
+	  *
3842
+	  */
3843 3843
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3844 3844
 	{
3845 3845
 		global $globalDBdriver;
3846 3846
 		$filter_query = $this->getFilter($filters,true,true);
3847 3847
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3848 3848
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3849
-                if ($olderthanmonths > 0) {
3850
-            		if ($globalDBdriver == 'mysql') {
3849
+				if ($olderthanmonths > 0) {
3850
+					if ($globalDBdriver == 'mysql') {
3851 3851
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3852 3852
 			} else {
3853 3853
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3854 3854
 			}
3855 3855
 		}
3856
-                if ($sincedate != '') {
3857
-            		if ($globalDBdriver == 'mysql') {
3856
+				if ($sincedate != '') {
3857
+					if ($globalDBdriver == 'mysql') {
3858 3858
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3859 3859
 			} else {
3860 3860
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3880,26 +3880,26 @@  discard block
 block discarded – undo
3880 3880
 	}
3881 3881
 	
3882 3882
 	 /**
3883
-	* Gets all owner that have flown over
3884
-	*
3885
-	* @return Array the pilots list
3886
-	*
3887
-	*/
3883
+	  * Gets all owner that have flown over
3884
+	  *
3885
+	  * @return Array the pilots list
3886
+	  *
3887
+	  */
3888 3888
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3889 3889
 	{
3890 3890
 		global $globalDBdriver;
3891 3891
 		$filter_query = $this->getFilter($filters,true,true);
3892 3892
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3893 3893
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3894
-                if ($olderthanmonths > 0) {
3895
-            		if ($globalDBdriver == 'mysql') {
3894
+				if ($olderthanmonths > 0) {
3895
+					if ($globalDBdriver == 'mysql') {
3896 3896
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3897 3897
 			} else {
3898 3898
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3899 3899
 			}
3900 3900
 		}
3901
-                if ($sincedate != '') {
3902
-            		if ($globalDBdriver == 'mysql') {
3901
+				if ($sincedate != '') {
3902
+					if ($globalDBdriver == 'mysql') {
3903 3903
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3904 3904
 			} else {
3905 3905
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3926,11 +3926,11 @@  discard block
 block discarded – undo
3926 3926
 	}
3927 3927
 
3928 3928
 	/**
3929
-	* Gets all airlines that have flown over by aircraft
3930
-	*
3931
-	* @return Array the airline list
3932
-	*
3933
-	*/
3929
+	 * Gets all airlines that have flown over by aircraft
3930
+	 *
3931
+	 * @return Array the airline list
3932
+	 *
3933
+	 */
3934 3934
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3935 3935
 	{
3936 3936
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3962,11 +3962,11 @@  discard block
 block discarded – undo
3962 3962
 
3963 3963
 
3964 3964
 	/**
3965
-	* Gets all airline countries that have flown over by aircraft
3966
-	*
3967
-	* @return Array the airline country list
3968
-	*
3969
-	*/
3965
+	 * Gets all airline countries that have flown over by aircraft
3966
+	 *
3967
+	 * @return Array the airline country list
3968
+	 *
3969
+	 */
3970 3970
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3971 3971
 	{
3972 3972
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3998,11 +3998,11 @@  discard block
 block discarded – undo
3998 3998
 	
3999 3999
 	
4000 4000
 	/**
4001
-	* Gets all airlines that have flown over by airport
4002
-	*
4003
-	* @return Array the airline list
4004
-	*
4005
-	*/
4001
+	 * Gets all airlines that have flown over by airport
4002
+	 *
4003
+	 * @return Array the airline list
4004
+	 *
4005
+	 */
4006 4006
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4007 4007
 	{
4008 4008
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4033,11 +4033,11 @@  discard block
 block discarded – undo
4033 4033
 
4034 4034
 
4035 4035
 	/**
4036
-	* Gets all airline countries that have flown over by airport icao
4037
-	*
4038
-	* @return Array the airline country list
4039
-	*
4040
-	*/
4036
+	 * Gets all airline countries that have flown over by airport icao
4037
+	 *
4038
+	 * @return Array the airline country list
4039
+	 *
4040
+	 */
4041 4041
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4042 4042
 	{
4043 4043
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4067,11 +4067,11 @@  discard block
 block discarded – undo
4067 4067
 
4068 4068
 
4069 4069
 	/**
4070
-	* Gets all airlines that have flown over by aircraft manufacturer
4071
-	*
4072
-	* @return Array the airline list
4073
-	*
4074
-	*/
4070
+	 * Gets all airlines that have flown over by aircraft manufacturer
4071
+	 *
4072
+	 * @return Array the airline list
4073
+	 *
4074
+	 */
4075 4075
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4076 4076
 	{
4077 4077
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4102,11 +4102,11 @@  discard block
 block discarded – undo
4102 4102
 
4103 4103
 
4104 4104
 	/**
4105
-	* Gets all airline countries that have flown over by aircraft manufacturer
4106
-	*
4107
-	* @return Array the airline country list
4108
-	*
4109
-	*/
4105
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4106
+	 *
4107
+	 * @return Array the airline country list
4108
+	 *
4109
+	 */
4110 4110
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4111 4111
 	{
4112 4112
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4135,11 +4135,11 @@  discard block
 block discarded – undo
4135 4135
 
4136 4136
 
4137 4137
 	/**
4138
-	* Gets all airlines that have flown over by date
4139
-	*
4140
-	* @return Array the airline list
4141
-	*
4142
-	*/
4138
+	 * Gets all airlines that have flown over by date
4139
+	 *
4140
+	 * @return Array the airline list
4141
+	 *
4142
+	 */
4143 4143
 	public function countAllAirlinesByDate($date,$filters = array())
4144 4144
 	{
4145 4145
 		global $globalTimezone, $globalDBdriver;
@@ -4183,11 +4183,11 @@  discard block
 block discarded – undo
4183 4183
 	
4184 4184
 	
4185 4185
 	/**
4186
-	* Gets all airline countries that have flown over by date
4187
-	*
4188
-	* @return Array the airline country list
4189
-	*
4190
-	*/
4186
+	 * Gets all airline countries that have flown over by date
4187
+	 *
4188
+	 * @return Array the airline country list
4189
+	 *
4190
+	 */
4191 4191
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4192 4192
 	{
4193 4193
 		global $globalTimezone, $globalDBdriver;
@@ -4230,11 +4230,11 @@  discard block
 block discarded – undo
4230 4230
 
4231 4231
 
4232 4232
 	/**
4233
-	* Gets all airlines that have flown over by ident/callsign
4234
-	*
4235
-	* @return Array the airline list
4236
-	*
4237
-	*/
4233
+	 * Gets all airlines that have flown over by ident/callsign
4234
+	 *
4235
+	 * @return Array the airline list
4236
+	 *
4237
+	 */
4238 4238
 	public function countAllAirlinesByIdent($ident,$filters = array())
4239 4239
 	{
4240 4240
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4264,11 +4264,11 @@  discard block
 block discarded – undo
4264 4264
 	}
4265 4265
 
4266 4266
 	/**
4267
-	* Gets all airlines that have flown over by route
4268
-	*
4269
-	* @return Array the airline list
4270
-	*
4271
-	*/
4267
+	 * Gets all airlines that have flown over by route
4268
+	 *
4269
+	 * @return Array the airline list
4270
+	 *
4271
+	 */
4272 4272
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4273 4273
 	{
4274 4274
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4300,11 +4300,11 @@  discard block
 block discarded – undo
4300 4300
 	}
4301 4301
 
4302 4302
 	/**
4303
-	* Gets all airline countries that have flown over by route
4304
-	*
4305
-	* @return Array the airline country list
4306
-	*
4307
-	*/
4303
+	 * Gets all airline countries that have flown over by route
4304
+	 *
4305
+	 * @return Array the airline country list
4306
+	 *
4307
+	 */
4308 4308
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4309 4309
 	{
4310 4310
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4336,11 +4336,11 @@  discard block
 block discarded – undo
4336 4336
 
4337 4337
 
4338 4338
 	/**
4339
-	* Gets all airlines that have flown over by country
4340
-	*
4341
-	* @return Array the airline list
4342
-	*
4343
-	*/
4339
+	 * Gets all airlines that have flown over by country
4340
+	 *
4341
+	 * @return Array the airline list
4342
+	 *
4343
+	 */
4344 4344
 	public function countAllAirlinesByCountry($country,$filters = array())
4345 4345
 	{
4346 4346
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4370,11 +4370,11 @@  discard block
 block discarded – undo
4370 4370
 
4371 4371
 
4372 4372
 	/**
4373
-	* Gets all airline countries that have flown over by country
4374
-	*
4375
-	* @return Array the airline country list
4376
-	*
4377
-	*/
4373
+	 * Gets all airline countries that have flown over by country
4374
+	 *
4375
+	 * @return Array the airline country list
4376
+	 *
4377
+	 */
4378 4378
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4379 4379
 	{
4380 4380
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4403,11 +4403,11 @@  discard block
 block discarded – undo
4403 4403
 
4404 4404
 
4405 4405
 	/**
4406
-	* Gets all airlines countries
4407
-	*
4408
-	* @return Array the airline country list
4409
-	*
4410
-	*/
4406
+	 * Gets all airlines countries
4407
+	 *
4408
+	 * @return Array the airline country list
4409
+	 *
4410
+	 */
4411 4411
 	public function countAllAirlineCountries($limit = true, $filters = array())
4412 4412
 	{
4413 4413
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4433,11 +4433,11 @@  discard block
 block discarded – undo
4433 4433
 	}
4434 4434
 
4435 4435
 	/**
4436
-	* Gets all number of flight over countries
4437
-	*
4438
-	* @return Array the airline country list
4439
-	*
4440
-	*/
4436
+	 * Gets all number of flight over countries
4437
+	 *
4438
+	 * @return Array the airline country list
4439
+	 *
4440
+	 */
4441 4441
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4442 4442
 	{
4443 4443
 		global $globalDBdriver;
@@ -4459,15 +4459,15 @@  discard block
 block discarded – undo
4459 4459
 		$SpotterLive = new SpotterLive();
4460 4460
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4461 4461
 		$filter_query .= ' over_country IS NOT NULL';
4462
-                if ($olderthanmonths > 0) {
4462
+				if ($olderthanmonths > 0) {
4463 4463
 			if ($globalDBdriver == 'mysql') {
4464 4464
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4465 4465
 			} else {
4466 4466
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4467 4467
 			}
4468 4468
 		}
4469
-                if ($sincedate != '') {
4470
-            		if ($globalDBdriver == 'mysql') {
4469
+				if ($sincedate != '') {
4470
+					if ($globalDBdriver == 'mysql') {
4471 4471
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4472 4472
 			} else {
4473 4473
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4497,11 +4497,11 @@  discard block
 block discarded – undo
4497 4497
 	
4498 4498
 	
4499 4499
 	/**
4500
-	* Gets all aircraft types that have flown over
4501
-	*
4502
-	* @return Array the aircraft list
4503
-	*
4504
-	*/
4500
+	 * Gets all aircraft types that have flown over
4501
+	 *
4502
+	 * @return Array the aircraft list
4503
+	 *
4504
+	 */
4505 4505
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4506 4506
 	{
4507 4507
 		global $globalDBdriver;
@@ -4544,11 +4544,11 @@  discard block
 block discarded – undo
4544 4544
 	}
4545 4545
 
4546 4546
 	/**
4547
-	* Gets all aircraft types that have flown over by airline
4548
-	*
4549
-	* @return Array the aircraft list
4550
-	*
4551
-	*/
4547
+	 * Gets all aircraft types that have flown over by airline
4548
+	 *
4549
+	 * @return Array the aircraft list
4550
+	 *
4551
+	 */
4552 4552
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4553 4553
 	{
4554 4554
 		global $globalDBdriver;
@@ -4591,11 +4591,11 @@  discard block
 block discarded – undo
4591 4591
 	}
4592 4592
 
4593 4593
 	/**
4594
-	* Gets all aircraft types that have flown over by months
4595
-	*
4596
-	* @return Array the aircraft list
4597
-	*
4598
-	*/
4594
+	 * Gets all aircraft types that have flown over by months
4595
+	 *
4596
+	 * @return Array the aircraft list
4597
+	 *
4598
+	 */
4599 4599
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4600 4600
 	{
4601 4601
 		global $globalDBdriver;
@@ -4639,11 +4639,11 @@  discard block
 block discarded – undo
4639 4639
 
4640 4640
 
4641 4641
 	/**
4642
-	* Gets all aircraft registration that have flown over by aircaft icao
4643
-	*
4644
-	* @return Array the aircraft list
4645
-	*
4646
-	*/
4642
+	 * Gets all aircraft registration that have flown over by aircaft icao
4643
+	 *
4644
+	 * @return Array the aircraft list
4645
+	 *
4646
+	 */
4647 4647
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4648 4648
 	{
4649 4649
 		$Image = new Image($this->db);
@@ -4682,11 +4682,11 @@  discard block
 block discarded – undo
4682 4682
 
4683 4683
 
4684 4684
 	/**
4685
-	* Gets all aircraft types that have flown over by airline icao
4686
-	*
4687
-	* @return Array the aircraft list
4688
-	*
4689
-	*/
4685
+	 * Gets all aircraft types that have flown over by airline icao
4686
+	 *
4687
+	 * @return Array the aircraft list
4688
+	 *
4689
+	 */
4690 4690
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4691 4691
 	{
4692 4692
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4715,11 +4715,11 @@  discard block
 block discarded – undo
4715 4715
 
4716 4716
 
4717 4717
 	/**
4718
-	* Gets all aircraft registration that have flown over by airline icao
4719
-	*
4720
-	* @return Array the aircraft list
4721
-	*
4722
-	*/
4718
+	 * Gets all aircraft registration that have flown over by airline icao
4719
+	 *
4720
+	 * @return Array the aircraft list
4721
+	 *
4722
+	 */
4723 4723
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4724 4724
 	{
4725 4725
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4757,11 +4757,11 @@  discard block
 block discarded – undo
4757 4757
 
4758 4758
 
4759 4759
 	/**
4760
-	* Gets all aircraft manufacturer that have flown over by airline icao
4761
-	*
4762
-	* @return Array the aircraft list
4763
-	*
4764
-	*/
4760
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4761
+	 *
4762
+	 * @return Array the aircraft list
4763
+	 *
4764
+	 */
4765 4765
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4766 4766
 	{
4767 4767
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4789,11 +4789,11 @@  discard block
 block discarded – undo
4789 4789
 
4790 4790
 
4791 4791
 	/**
4792
-	* Gets all aircraft types that have flown over by airline icao
4793
-	*
4794
-	* @return Array the aircraft list
4795
-	*
4796
-	*/
4792
+	 * Gets all aircraft types that have flown over by airline icao
4793
+	 *
4794
+	 * @return Array the aircraft list
4795
+	 *
4796
+	 */
4797 4797
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4798 4798
 	{
4799 4799
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4822,11 +4822,11 @@  discard block
 block discarded – undo
4822 4822
 
4823 4823
 
4824 4824
 	/**
4825
-	* Gets all aircraft registration that have flown over by airport icao
4826
-	*
4827
-	* @return Array the aircraft list
4828
-	*
4829
-	*/
4825
+	 * Gets all aircraft registration that have flown over by airport icao
4826
+	 *
4827
+	 * @return Array the aircraft list
4828
+	 *
4829
+	 */
4830 4830
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4831 4831
 	{
4832 4832
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4863,11 +4863,11 @@  discard block
 block discarded – undo
4863 4863
 	
4864 4864
 	
4865 4865
 	/**
4866
-	* Gets all aircraft manufacturer that have flown over by airport icao
4867
-	*
4868
-	* @return Array the aircraft list
4869
-	*
4870
-	*/
4866
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4867
+	 *
4868
+	 * @return Array the aircraft list
4869
+	 *
4870
+	 */
4871 4871
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4872 4872
 	{
4873 4873
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4893,11 +4893,11 @@  discard block
 block discarded – undo
4893 4893
 	}
4894 4894
 
4895 4895
 	/**
4896
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4897
-	*
4898
-	* @return Array the aircraft list
4899
-	*
4900
-	*/
4896
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4897
+	 *
4898
+	 * @return Array the aircraft list
4899
+	 *
4900
+	 */
4901 4901
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4902 4902
 	{
4903 4903
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4924,11 +4924,11 @@  discard block
 block discarded – undo
4924 4924
 
4925 4925
 
4926 4926
 	/**
4927
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4928
-	*
4929
-	* @return Array the aircraft list
4930
-	*
4931
-	*/
4927
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4928
+	 *
4929
+	 * @return Array the aircraft list
4930
+	 *
4931
+	 */
4932 4932
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4933 4933
 	{
4934 4934
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4964,11 +4964,11 @@  discard block
 block discarded – undo
4964 4964
 	}
4965 4965
 
4966 4966
 	/**
4967
-	* Gets all aircraft types that have flown over by date
4968
-	*
4969
-	* @return Array the aircraft list
4970
-	*
4971
-	*/
4967
+	 * Gets all aircraft types that have flown over by date
4968
+	 *
4969
+	 * @return Array the aircraft list
4970
+	 *
4971
+	 */
4972 4972
 	public function countAllAircraftTypesByDate($date,$filters = array())
4973 4973
 	{
4974 4974
 		global $globalTimezone, $globalDBdriver;
@@ -5010,11 +5010,11 @@  discard block
 block discarded – undo
5010 5010
 
5011 5011
 
5012 5012
 	/**
5013
-	* Gets all aircraft registration that have flown over by date
5014
-	*
5015
-	* @return Array the aircraft list
5016
-	*
5017
-	*/
5013
+	 * Gets all aircraft registration that have flown over by date
5014
+	 *
5015
+	 * @return Array the aircraft list
5016
+	 *
5017
+	 */
5018 5018
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5019 5019
 	{
5020 5020
 		global $globalTimezone, $globalDBdriver;
@@ -5065,11 +5065,11 @@  discard block
 block discarded – undo
5065 5065
 
5066 5066
 
5067 5067
 	/**
5068
-	* Gets all aircraft manufacturer that have flown over by date
5069
-	*
5070
-	* @return Array the aircraft manufacturer list
5071
-	*
5072
-	*/
5068
+	 * Gets all aircraft manufacturer that have flown over by date
5069
+	 *
5070
+	 * @return Array the aircraft manufacturer list
5071
+	 *
5072
+	 */
5073 5073
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5074 5074
 	{
5075 5075
 		global $globalTimezone, $globalDBdriver;
@@ -5111,11 +5111,11 @@  discard block
 block discarded – undo
5111 5111
 
5112 5112
 
5113 5113
 	/**
5114
-	* Gets all aircraft types that have flown over by ident/callsign
5115
-	*
5116
-	* @return Array the aircraft list
5117
-	*
5118
-	*/
5114
+	 * Gets all aircraft types that have flown over by ident/callsign
5115
+	 *
5116
+	 * @return Array the aircraft list
5117
+	 *
5118
+	 */
5119 5119
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5120 5120
 	{
5121 5121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5144,11 +5144,11 @@  discard block
 block discarded – undo
5144 5144
 
5145 5145
 
5146 5146
 	/**
5147
-	* Gets all aircraft registration that have flown over by ident/callsign
5148
-	*
5149
-	* @return Array the aircraft list
5150
-	*
5151
-	*/
5147
+	 * Gets all aircraft registration that have flown over by ident/callsign
5148
+	 *
5149
+	 * @return Array the aircraft list
5150
+	 *
5151
+	 */
5152 5152
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5153 5153
 	{
5154 5154
 		$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 manufacturer that have flown over by ident/callsign
5192
-	*
5193
-	* @return Array the aircraft manufacturer list
5194
-	*
5195
-	*/
5191
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5192
+	 *
5193
+	 * @return Array the aircraft manufacturer list
5194
+	 *
5195
+	 */
5196 5196
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5197 5197
 	{
5198 5198
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5218,11 +5218,11 @@  discard block
 block discarded – undo
5218 5218
 
5219 5219
 
5220 5220
 	/**
5221
-	* Gets all aircraft types that have flown over by route
5222
-	*
5223
-	* @return Array the aircraft list
5224
-	*
5225
-	*/
5221
+	 * Gets all aircraft types that have flown over by route
5222
+	 *
5223
+	 * @return Array the aircraft list
5224
+	 *
5225
+	 */
5226 5226
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5227 5227
 	{
5228 5228
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5251,11 +5251,11 @@  discard block
 block discarded – undo
5251 5251
 	}
5252 5252
 
5253 5253
 	/**
5254
-	* Gets all aircraft registration that have flown over by route
5255
-	*
5256
-	* @return Array the aircraft list
5257
-	*
5258
-	*/
5254
+	 * Gets all aircraft registration that have flown over by route
5255
+	 *
5256
+	 * @return Array the aircraft list
5257
+	 *
5258
+	 */
5259 5259
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5260 5260
 	{
5261 5261
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5297,11 +5297,11 @@  discard block
 block discarded – undo
5297 5297
 	
5298 5298
 	
5299 5299
 	/**
5300
-	* Gets all aircraft manufacturer that have flown over by route
5301
-	*
5302
-	* @return Array the aircraft manufacturer list
5303
-	*
5304
-	*/
5300
+	 * Gets all aircraft manufacturer that have flown over by route
5301
+	 *
5302
+	 * @return Array the aircraft manufacturer list
5303
+	 *
5304
+	 */
5305 5305
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5306 5306
 	{
5307 5307
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5335,11 +5335,11 @@  discard block
 block discarded – undo
5335 5335
 	
5336 5336
 	
5337 5337
 	/**
5338
-	* Gets all aircraft types that have flown over by country
5339
-	*
5340
-	* @return Array the aircraft list
5341
-	*
5342
-	*/
5338
+	 * Gets all aircraft types that have flown over by country
5339
+	 *
5340
+	 * @return Array the aircraft list
5341
+	 *
5342
+	 */
5343 5343
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5344 5344
 	{
5345 5345
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5370,11 +5370,11 @@  discard block
 block discarded – undo
5370 5370
 
5371 5371
 
5372 5372
 	/**
5373
-	* Gets all aircraft registration that have flown over by country
5374
-	*
5375
-	* @return Array the aircraft list
5376
-	*
5377
-	*/
5373
+	 * Gets all aircraft registration that have flown over by country
5374
+	 *
5375
+	 * @return Array the aircraft list
5376
+	 *
5377
+	 */
5378 5378
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5379 5379
 	{
5380 5380
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5414,11 +5414,11 @@  discard block
 block discarded – undo
5414 5414
 	
5415 5415
 	
5416 5416
 	/**
5417
-	* Gets all aircraft manufacturer that have flown over by country
5418
-	*
5419
-	* @return Array the aircraft manufacturer list
5420
-	*
5421
-	*/
5417
+	 * Gets all aircraft manufacturer that have flown over by country
5418
+	 *
5419
+	 * @return Array the aircraft manufacturer list
5420
+	 *
5421
+	 */
5422 5422
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5423 5423
 	{
5424 5424
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5449,17 +5449,17 @@  discard block
 block discarded – undo
5449 5449
 	
5450 5450
 	
5451 5451
 	/**
5452
-	* Gets all aircraft manufacturers that have flown over
5453
-	*
5454
-	* @return Array the aircraft list
5455
-	*
5456
-	*/
5452
+	 * Gets all aircraft manufacturers that have flown over
5453
+	 *
5454
+	 * @return Array the aircraft list
5455
+	 *
5456
+	 */
5457 5457
 	public function countAllAircraftManufacturers($filters = array())
5458 5458
 	{
5459 5459
 		$filter_query = $this->getFilter($filters,true,true);
5460 5460
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5461 5461
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5462
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5462
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5463 5463
 					ORDER BY aircraft_manufacturer_count DESC
5464 5464
 					LIMIT 10";
5465 5465
       
@@ -5484,11 +5484,11 @@  discard block
 block discarded – undo
5484 5484
 	
5485 5485
 	
5486 5486
 	/**
5487
-	* Gets all aircraft registrations that have flown over
5488
-	*
5489
-	* @return Array the aircraft list
5490
-	*
5491
-	*/
5487
+	 * Gets all aircraft registrations that have flown over
5488
+	 *
5489
+	 * @return Array the aircraft list
5490
+	 *
5491
+	 */
5492 5492
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5493 5493
 	{
5494 5494
 		global $globalDBdriver;
@@ -5496,15 +5496,15 @@  discard block
 block discarded – undo
5496 5496
 		$filter_query = $this->getFilter($filters,true,true);
5497 5497
 		$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    
5498 5498
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5499
-                if ($olderthanmonths > 0) {
5500
-            		if ($globalDBdriver == 'mysql') {
5499
+				if ($olderthanmonths > 0) {
5500
+					if ($globalDBdriver == 'mysql') {
5501 5501
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5502 5502
 			} else {
5503 5503
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5504 5504
 			}
5505 5505
 		}
5506
-                if ($sincedate != '') {
5507
-            		if ($globalDBdriver == 'mysql') {
5506
+				if ($sincedate != '') {
5507
+					if ($globalDBdriver == 'mysql') {
5508 5508
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5509 5509
 			} else {
5510 5510
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5513,7 +5513,7 @@  discard block
 block discarded – undo
5513 5513
 
5514 5514
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5515 5515
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5516
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5516
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5517 5517
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5518 5518
 		
5519 5519
 		$sth = $this->db->prepare($query);
@@ -5544,11 +5544,11 @@  discard block
 block discarded – undo
5544 5544
 
5545 5545
 
5546 5546
 	/**
5547
-	* Gets all aircraft registrations that have flown over
5548
-	*
5549
-	* @return Array the aircraft list
5550
-	*
5551
-	*/
5547
+	 * Gets all aircraft registrations that have flown over
5548
+	 *
5549
+	 * @return Array the aircraft list
5550
+	 *
5551
+	 */
5552 5552
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5553 5553
 	{
5554 5554
 		global $globalDBdriver;
@@ -5556,15 +5556,15 @@  discard block
 block discarded – undo
5556 5556
 		$Image = new Image($this->db);
5557 5557
 		$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    
5558 5558
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5559
-                if ($olderthanmonths > 0) {
5560
-            		if ($globalDBdriver == 'mysql') {
5559
+				if ($olderthanmonths > 0) {
5560
+					if ($globalDBdriver == 'mysql') {
5561 5561
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5562 5562
 			} else {
5563 5563
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5564 5564
 			}
5565 5565
 		}
5566
-                if ($sincedate != '') {
5567
-            		if ($globalDBdriver == 'mysql') {
5566
+				if ($sincedate != '') {
5567
+					if ($globalDBdriver == 'mysql') {
5568 5568
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5569 5569
 			} else {
5570 5570
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5573,7 +5573,7 @@  discard block
 block discarded – undo
5573 5573
 
5574 5574
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5575 5575
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5576
-                $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";
5576
+				$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";
5577 5577
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5578 5578
 		
5579 5579
 		$sth = $this->db->prepare($query);
@@ -5605,35 +5605,35 @@  discard block
 block discarded – undo
5605 5605
 	
5606 5606
 	
5607 5607
 	/**
5608
-	* Gets all departure airports of the airplanes that have flown over
5609
-	*
5610
-	* @return Array the airport list
5611
-	*
5612
-	*/
5608
+	 * Gets all departure airports of the airplanes that have flown over
5609
+	 *
5610
+	 * @return Array the airport list
5611
+	 *
5612
+	 */
5613 5613
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5614 5614
 	{
5615 5615
 		global $globalDBdriver;
5616 5616
 		$filter_query = $this->getFilter($filters,true,true);
5617 5617
 		$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 
5618 5618
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5619
-                if ($olderthanmonths > 0) {
5620
-            		if ($globalDBdriver == 'mysql') {
5619
+				if ($olderthanmonths > 0) {
5620
+					if ($globalDBdriver == 'mysql') {
5621 5621
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5622 5622
 			} else {
5623 5623
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5624 5624
 			}
5625
-                }
5626
-                if ($sincedate != '') {
5627
-            		if ($globalDBdriver == 'mysql') {
5625
+				}
5626
+				if ($sincedate != '') {
5627
+					if ($globalDBdriver == 'mysql') {
5628 5628
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5629 5629
 			} else {
5630 5630
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5631 5631
 			}
5632 5632
 		}
5633 5633
 
5634
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5635
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5636
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5634
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5635
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5636
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5637 5637
 				ORDER BY airport_departure_icao_count DESC";
5638 5638
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5639 5639
       
@@ -5657,35 +5657,35 @@  discard block
 block discarded – undo
5657 5657
 	}
5658 5658
 
5659 5659
 	/**
5660
-	* Gets all departure airports of the airplanes that have flown over
5661
-	*
5662
-	* @return Array the airport list
5663
-	*
5664
-	*/
5660
+	 * Gets all departure airports of the airplanes that have flown over
5661
+	 *
5662
+	 * @return Array the airport list
5663
+	 *
5664
+	 */
5665 5665
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5666 5666
 	{
5667 5667
 		global $globalDBdriver;
5668 5668
 		$filter_query = $this->getFilter($filters,true,true);
5669 5669
 		$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 
5670 5670
 			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 <> '' ";
5671
-                if ($olderthanmonths > 0) {
5672
-            		if ($globalDBdriver == 'mysql') {
5671
+				if ($olderthanmonths > 0) {
5672
+					if ($globalDBdriver == 'mysql') {
5673 5673
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5674 5674
 			} else {
5675 5675
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5676 5676
 			}
5677
-                }
5678
-                if ($sincedate != '') {
5679
-            		if ($globalDBdriver == 'mysql') {
5677
+				}
5678
+				if ($sincedate != '') {
5679
+					if ($globalDBdriver == 'mysql') {
5680 5680
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5681 5681
 			} else {
5682 5682
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5683 5683
 			}
5684 5684
 		}
5685 5685
 
5686
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5687
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5688
-                $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
5686
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5687
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5688
+				$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
5689 5689
 				ORDER BY airport_departure_icao_count DESC";
5690 5690
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5691 5691
       
@@ -5710,37 +5710,37 @@  discard block
 block discarded – undo
5710 5710
 	}
5711 5711
 
5712 5712
 	/**
5713
-	* Gets all detected departure airports of the airplanes that have flown over
5714
-	*
5715
-	* @return Array the airport list
5716
-	*
5717
-	*/
5713
+	 * Gets all detected departure airports of the airplanes that have flown over
5714
+	 *
5715
+	 * @return Array the airport list
5716
+	 *
5717
+	 */
5718 5718
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5719 5719
 	{
5720 5720
 		global $globalDBdriver;
5721 5721
 		$filter_query = $this->getFilter($filters,true,true);
5722 5722
 		$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
5723 5723
 				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";
5724
-                if ($olderthanmonths > 0) {
5725
-            		if ($globalDBdriver == 'mysql') {
5724
+				if ($olderthanmonths > 0) {
5725
+					if ($globalDBdriver == 'mysql') {
5726 5726
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5727 5727
 			} else {
5728 5728
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5729 5729
 			}
5730
-                }
5731
-                if ($sincedate != '') {
5732
-            		if ($globalDBdriver == 'mysql') {
5730
+				}
5731
+				if ($sincedate != '') {
5732
+					if ($globalDBdriver == 'mysql') {
5733 5733
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5734 5734
 			} else {
5735 5735
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5736 5736
 			}
5737 5737
 		}
5738
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5739
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5740
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5738
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5739
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5740
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5741 5741
 				ORDER BY airport_departure_icao_count DESC";
5742 5742
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5743
-    		//echo $query;
5743
+			//echo $query;
5744 5744
 		$sth = $this->db->prepare($query);
5745 5745
 		$sth->execute();
5746 5746
       
@@ -5761,35 +5761,35 @@  discard block
 block discarded – undo
5761 5761
 	}
5762 5762
 	
5763 5763
 	/**
5764
-	* Gets all detected departure airports of the airplanes that have flown over
5765
-	*
5766
-	* @return Array the airport list
5767
-	*
5768
-	*/
5764
+	 * Gets all detected departure airports of the airplanes that have flown over
5765
+	 *
5766
+	 * @return Array the airport list
5767
+	 *
5768
+	 */
5769 5769
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5770 5770
 	{
5771 5771
 		global $globalDBdriver;
5772 5772
 		$filter_query = $this->getFilter($filters,true,true);
5773 5773
 		$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
5774 5774
 				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 ";
5775
-                if ($olderthanmonths > 0) {
5776
-            		if ($globalDBdriver == 'mysql') {
5775
+				if ($olderthanmonths > 0) {
5776
+					if ($globalDBdriver == 'mysql') {
5777 5777
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5778 5778
 			} else {
5779 5779
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5780 5780
 			}
5781
-                }
5782
-                if ($sincedate != '') {
5783
-            		if ($globalDBdriver == 'mysql') {
5781
+				}
5782
+				if ($sincedate != '') {
5783
+					if ($globalDBdriver == 'mysql') {
5784 5784
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5785 5785
 			} else {
5786 5786
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5787 5787
 			}
5788 5788
 		}
5789 5789
 
5790
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5791
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5792
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5790
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5791
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5792
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5793 5793
 				ORDER BY airport_departure_icao_count DESC";
5794 5794
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5795 5795
       
@@ -5814,11 +5814,11 @@  discard block
 block discarded – undo
5814 5814
 	}	
5815 5815
 	
5816 5816
 	/**
5817
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5818
-	*
5819
-	* @return Array the airport list
5820
-	*
5821
-	*/
5817
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5818
+	 *
5819
+	 * @return Array the airport list
5820
+	 *
5821
+	 */
5822 5822
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5823 5823
 	{
5824 5824
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5852,11 +5852,11 @@  discard block
 block discarded – undo
5852 5852
 	
5853 5853
 	
5854 5854
 	/**
5855
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5856
-	*
5857
-	* @return Array the airport list
5858
-	*
5859
-	*/
5855
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5856
+	 *
5857
+	 * @return Array the airport list
5858
+	 *
5859
+	 */
5860 5860
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5861 5861
 	{
5862 5862
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5887,11 +5887,11 @@  discard block
 block discarded – undo
5887 5887
 	
5888 5888
 	
5889 5889
 	/**
5890
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5891
-	*
5892
-	* @return Array the airport list
5893
-	*
5894
-	*/
5890
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5891
+	 *
5892
+	 * @return Array the airport list
5893
+	 *
5894
+	 */
5895 5895
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5896 5896
 	{
5897 5897
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5924,11 +5924,11 @@  discard block
 block discarded – undo
5924 5924
 	
5925 5925
 	
5926 5926
 	/**
5927
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5928
-	*
5929
-	* @return Array the airport list
5930
-	*
5931
-	*/
5927
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5928
+	 *
5929
+	 * @return Array the airport list
5930
+	 *
5931
+	 */
5932 5932
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5933 5933
 	{
5934 5934
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5958,11 +5958,11 @@  discard block
 block discarded – undo
5958 5958
 	
5959 5959
 	
5960 5960
 	/**
5961
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5962
-	*
5963
-	* @return Array the airport list
5964
-	*
5965
-	*/
5961
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5962
+	 *
5963
+	 * @return Array the airport list
5964
+	 *
5965
+	 */
5966 5966
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5967 5967
 	{
5968 5968
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5995,11 +5995,11 @@  discard block
 block discarded – undo
5995 5995
 	
5996 5996
 	
5997 5997
 	/**
5998
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5999
-	*
6000
-	* @return Array the airport list
6001
-	*
6002
-	*/
5998
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5999
+	 *
6000
+	 * @return Array the airport list
6001
+	 *
6002
+	 */
6003 6003
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6004 6004
 	{
6005 6005
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6029,11 +6029,11 @@  discard block
 block discarded – undo
6029 6029
 	
6030 6030
 	
6031 6031
 	/**
6032
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6033
-	*
6034
-	* @return Array the airport list
6035
-	*
6036
-	*/
6032
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6033
+	 *
6034
+	 * @return Array the airport list
6035
+	 *
6036
+	 */
6037 6037
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6038 6038
 	{
6039 6039
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6066,11 +6066,11 @@  discard block
 block discarded – undo
6066 6066
 	
6067 6067
 	
6068 6068
 	/**
6069
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6070
-	*
6071
-	* @return Array the airport list
6072
-	*
6073
-	*/
6069
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6070
+	 *
6071
+	 * @return Array the airport list
6072
+	 *
6073
+	 */
6074 6074
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6075 6075
 	{
6076 6076
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6101,11 +6101,11 @@  discard block
 block discarded – undo
6101 6101
 	
6102 6102
 	
6103 6103
 	/**
6104
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6105
-	*
6106
-	* @return Array the airport list
6107
-	*
6108
-	*/
6104
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6105
+	 *
6106
+	 * @return Array the airport list
6107
+	 *
6108
+	 */
6109 6109
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6110 6110
 	{
6111 6111
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6138,11 +6138,11 @@  discard block
 block discarded – undo
6138 6138
 	
6139 6139
 	
6140 6140
 	/**
6141
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6142
-	*
6143
-	* @return Array the airport list
6144
-	*
6145
-	*/
6141
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6142
+	 *
6143
+	 * @return Array the airport list
6144
+	 *
6145
+	 */
6146 6146
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6147 6147
 	{
6148 6148
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6172,11 +6172,11 @@  discard block
 block discarded – undo
6172 6172
 	
6173 6173
 	
6174 6174
 	/**
6175
-	* Gets all departure airports of the airplanes that have flown over based on a date
6176
-	*
6177
-	* @return Array the airport list
6178
-	*
6179
-	*/
6175
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6176
+	 *
6177
+	 * @return Array the airport list
6178
+	 *
6179
+	 */
6180 6180
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6181 6181
 	{
6182 6182
 		global $globalTimezone, $globalDBdriver;
@@ -6222,11 +6222,11 @@  discard block
 block discarded – undo
6222 6222
 	
6223 6223
 	
6224 6224
 	/**
6225
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6226
-	*
6227
-	* @return Array the airport list
6228
-	*
6229
-	*/
6225
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6226
+	 *
6227
+	 * @return Array the airport list
6228
+	 *
6229
+	 */
6230 6230
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6231 6231
 	{
6232 6232
 		global $globalTimezone, $globalDBdriver;
@@ -6269,11 +6269,11 @@  discard block
 block discarded – undo
6269 6269
 	
6270 6270
 	
6271 6271
 	/**
6272
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6273
-	*
6274
-	* @return Array the airport list
6275
-	*
6276
-	*/
6272
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6273
+	 *
6274
+	 * @return Array the airport list
6275
+	 *
6276
+	 */
6277 6277
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6278 6278
 	{
6279 6279
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6307,11 +6307,11 @@  discard block
 block discarded – undo
6307 6307
 	
6308 6308
 	
6309 6309
 	/**
6310
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6311
-	*
6312
-	* @return Array the airport list
6313
-	*
6314
-	*/
6310
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6311
+	 *
6312
+	 * @return Array the airport list
6313
+	 *
6314
+	 */
6315 6315
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6316 6316
 	{
6317 6317
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6342,11 +6342,11 @@  discard block
 block discarded – undo
6342 6342
 	
6343 6343
 	
6344 6344
 	/**
6345
-	* Gets all departure airports of the airplanes that have flown over based on a country
6346
-	*
6347
-	* @return Array the airport list
6348
-	*
6349
-	*/
6345
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6346
+	 *
6347
+	 * @return Array the airport list
6348
+	 *
6349
+	 */
6350 6350
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6351 6351
 	{
6352 6352
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6380,11 +6380,11 @@  discard block
 block discarded – undo
6380 6380
 
6381 6381
 
6382 6382
 	/**
6383
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6384
-	*
6385
-	* @return Array the airport list
6386
-	*
6387
-	*/
6383
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6384
+	 *
6385
+	 * @return Array the airport list
6386
+	 *
6387
+	 */
6388 6388
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6389 6389
 	{
6390 6390
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6414,40 +6414,40 @@  discard block
 block discarded – undo
6414 6414
 	
6415 6415
 
6416 6416
 	/**
6417
-	* Gets all arrival airports of the airplanes that have flown over
6418
-	*
6419
-	* @param Boolean $limit Limit result to 10 or not
6420
-	* @param Integer $olderthanmonths Only show result older than x months
6421
-	* @param String $sincedate Only show result since x date
6422
-	* @param Boolean $icaoaskey Show result by ICAO
6423
-	* @param Array $filters Filter used here
6424
-	* @return Array the airport list
6425
-	*
6426
-	*/
6417
+	 * Gets all arrival airports of the airplanes that have flown over
6418
+	 *
6419
+	 * @param Boolean $limit Limit result to 10 or not
6420
+	 * @param Integer $olderthanmonths Only show result older than x months
6421
+	 * @param String $sincedate Only show result since x date
6422
+	 * @param Boolean $icaoaskey Show result by ICAO
6423
+	 * @param Array $filters Filter used here
6424
+	 * @return Array the airport list
6425
+	 *
6426
+	 */
6427 6427
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6428 6428
 	{
6429 6429
 		global $globalDBdriver;
6430 6430
 		$filter_query = $this->getFilter($filters,true,true);
6431 6431
 		$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 
6432 6432
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6433
-                if ($olderthanmonths > 0) {
6434
-            		if ($globalDBdriver == 'mysql') {
6433
+				if ($olderthanmonths > 0) {
6434
+					if ($globalDBdriver == 'mysql') {
6435 6435
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6436 6436
 			} else {
6437 6437
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6438 6438
 			}
6439 6439
 		}
6440
-                if ($sincedate != '') {
6441
-            		if ($globalDBdriver == 'mysql') {
6440
+				if ($sincedate != '') {
6441
+					if ($globalDBdriver == 'mysql') {
6442 6442
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6443 6443
 			} else {
6444 6444
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6445 6445
 			}
6446 6446
 		}
6447 6447
 
6448
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6449
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6450
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6448
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6449
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6450
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6451 6451
 					ORDER BY airport_arrival_icao_count DESC";
6452 6452
 		if ($limit) $query .= " LIMIT 10";
6453 6453
       
@@ -6476,35 +6476,35 @@  discard block
 block discarded – undo
6476 6476
 	}
6477 6477
 
6478 6478
 	/**
6479
-	* Gets all arrival airports of the airplanes that have flown over
6480
-	*
6481
-	* @return Array the airport list
6482
-	*
6483
-	*/
6479
+	 * Gets all arrival airports of the airplanes that have flown over
6480
+	 *
6481
+	 * @return Array the airport list
6482
+	 *
6483
+	 */
6484 6484
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6485 6485
 	{
6486 6486
 		global $globalDBdriver;
6487 6487
 		$filter_query = $this->getFilter($filters,true,true);
6488 6488
 		$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 
6489 6489
 			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 <> '' ";
6490
-                if ($olderthanmonths > 0) {
6491
-            		if ($globalDBdriver == 'mysql') {
6490
+				if ($olderthanmonths > 0) {
6491
+					if ($globalDBdriver == 'mysql') {
6492 6492
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6493 6493
 			} else {
6494 6494
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6495 6495
 			}
6496 6496
 		}
6497
-                if ($sincedate != '') {
6498
-            		if ($globalDBdriver == 'mysql') {
6497
+				if ($sincedate != '') {
6498
+					if ($globalDBdriver == 'mysql') {
6499 6499
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6500 6500
 			} else {
6501 6501
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6502 6502
 			}
6503 6503
 		}
6504 6504
 
6505
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6506
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6507
-                $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
6505
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6506
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6507
+				$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
6508 6508
 					ORDER BY airport_arrival_icao_count DESC";
6509 6509
 		if ($limit) $query .= " LIMIT 10";
6510 6510
       
@@ -6535,34 +6535,34 @@  discard block
 block discarded – undo
6535 6535
 
6536 6536
 
6537 6537
 	/**
6538
-	* Gets all detected arrival airports of the airplanes that have flown over
6539
-	*
6540
-	* @return Array the airport list
6541
-	*
6542
-	*/
6538
+	 * Gets all detected arrival airports of the airplanes that have flown over
6539
+	 *
6540
+	 * @return Array the airport list
6541
+	 *
6542
+	 */
6543 6543
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6544 6544
 	{
6545 6545
 		global $globalDBdriver;
6546 6546
 		$filter_query = $this->getFilter($filters,true,true);
6547 6547
 		$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 
6548 6548
 			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";
6549
-                if ($olderthanmonths > 0) {
6550
-            		if ($globalDBdriver == 'mysql') {
6549
+				if ($olderthanmonths > 0) {
6550
+					if ($globalDBdriver == 'mysql') {
6551 6551
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6552 6552
 			} else {
6553 6553
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6554 6554
 			}
6555 6555
 		}
6556
-                if ($sincedate != '') {
6557
-            		if ($globalDBdriver == 'mysql') {
6556
+				if ($sincedate != '') {
6557
+					if ($globalDBdriver == 'mysql') {
6558 6558
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6559 6559
 			} else {
6560 6560
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6561 6561
 			}
6562 6562
 		}
6563
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6564
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6565
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6563
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6564
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6565
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6566 6566
 					ORDER BY airport_arrival_icao_count DESC";
6567 6567
 		if ($limit) $query .= " LIMIT 10";
6568 6568
       
@@ -6591,35 +6591,35 @@  discard block
 block discarded – undo
6591 6591
 	}
6592 6592
 	
6593 6593
 	/**
6594
-	* Gets all detected arrival airports of the airplanes that have flown over
6595
-	*
6596
-	* @return Array the airport list
6597
-	*
6598
-	*/
6594
+	 * Gets all detected arrival airports of the airplanes that have flown over
6595
+	 *
6596
+	 * @return Array the airport list
6597
+	 *
6598
+	 */
6599 6599
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6600 6600
 	{
6601 6601
 		global $globalDBdriver;
6602 6602
 		$filter_query = $this->getFilter($filters,true,true);
6603 6603
 		$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 
6604 6604
 			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 ";
6605
-                if ($olderthanmonths > 0) {
6606
-            		if ($globalDBdriver == 'mysql') {
6605
+				if ($olderthanmonths > 0) {
6606
+					if ($globalDBdriver == 'mysql') {
6607 6607
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6608 6608
 			} else {
6609 6609
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6610 6610
 			}
6611 6611
 		}
6612
-                if ($sincedate != '') {
6613
-            		if ($globalDBdriver == 'mysql') {
6612
+				if ($sincedate != '') {
6613
+					if ($globalDBdriver == 'mysql') {
6614 6614
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6615 6615
 			} else {
6616 6616
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6617 6617
 			}
6618 6618
 		}
6619 6619
 
6620
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6621
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6622
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6620
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6621
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6622
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6623 6623
 					ORDER BY airport_arrival_icao_count DESC";
6624 6624
 		if ($limit) $query .= " LIMIT 10";
6625 6625
       
@@ -6649,11 +6649,11 @@  discard block
 block discarded – undo
6649 6649
 	}	
6650 6650
 	
6651 6651
 	/**
6652
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6653
-	*
6654
-	* @return Array the airport list
6655
-	*
6656
-	*/
6652
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6653
+	 *
6654
+	 * @return Array the airport list
6655
+	 *
6656
+	 */
6657 6657
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6658 6658
 	{
6659 6659
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6685,11 +6685,11 @@  discard block
 block discarded – undo
6685 6685
 	
6686 6686
 	
6687 6687
 	/**
6688
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6689
-	*
6690
-	* @return Array the airport list
6691
-	*
6692
-	*/
6688
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6689
+	 *
6690
+	 * @return Array the airport list
6691
+	 *
6692
+	 */
6693 6693
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6694 6694
 	{
6695 6695
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6720,11 +6720,11 @@  discard block
 block discarded – undo
6720 6720
 	
6721 6721
 	
6722 6722
 	/**
6723
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6724
-	*
6725
-	* @return Array the airport list
6726
-	*
6727
-	*/
6723
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6724
+	 *
6725
+	 * @return Array the airport list
6726
+	 *
6727
+	 */
6728 6728
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6729 6729
 	{
6730 6730
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6758,11 +6758,11 @@  discard block
 block discarded – undo
6758 6758
 	
6759 6759
 	
6760 6760
 	/**
6761
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6762
-	*
6763
-	* @return Array the airport list
6764
-	*
6765
-	*/
6761
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6762
+	 *
6763
+	 * @return Array the airport list
6764
+	 *
6765
+	 */
6766 6766
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6767 6767
 	{
6768 6768
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6792,11 +6792,11 @@  discard block
 block discarded – undo
6792 6792
 	
6793 6793
 	
6794 6794
 	/**
6795
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6796
-	*
6797
-	* @return Array the airport list
6798
-	*
6799
-	*/
6795
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6796
+	 *
6797
+	 * @return Array the airport list
6798
+	 *
6799
+	 */
6800 6800
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6801 6801
 	{
6802 6802
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6830,11 +6830,11 @@  discard block
 block discarded – undo
6830 6830
 	
6831 6831
 	
6832 6832
 	/**
6833
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6834
-	*
6835
-	* @return Array the airport list
6836
-	*
6837
-	*/
6833
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6834
+	 *
6835
+	 * @return Array the airport list
6836
+	 *
6837
+	 */
6838 6838
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6839 6839
 	{
6840 6840
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6865,11 +6865,11 @@  discard block
 block discarded – undo
6865 6865
 	
6866 6866
 	
6867 6867
 	/**
6868
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6869
-	*
6870
-	* @return Array the airport list
6871
-	*
6872
-	*/
6868
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6869
+	 *
6870
+	 * @return Array the airport list
6871
+	 *
6872
+	 */
6873 6873
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6874 6874
 	{
6875 6875
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6902,11 +6902,11 @@  discard block
 block discarded – undo
6902 6902
 	
6903 6903
 	
6904 6904
 	/**
6905
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6906
-	*
6907
-	* @return Array the airport list
6908
-	*
6909
-	*/
6905
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6906
+	 *
6907
+	 * @return Array the airport list
6908
+	 *
6909
+	 */
6910 6910
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6911 6911
 	{
6912 6912
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6936,11 +6936,11 @@  discard block
 block discarded – undo
6936 6936
 	
6937 6937
 	
6938 6938
 	/**
6939
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6940
-	*
6941
-	* @return Array the airport list
6942
-	*
6943
-	*/
6939
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6940
+	 *
6941
+	 * @return Array the airport list
6942
+	 *
6943
+	 */
6944 6944
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6945 6945
 	{
6946 6946
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6974,11 +6974,11 @@  discard block
 block discarded – undo
6974 6974
 	
6975 6975
 	
6976 6976
 	/**
6977
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6978
-	*
6979
-	* @return Array the airport list
6980
-	*
6981
-	*/
6977
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6978
+	 *
6979
+	 * @return Array the airport list
6980
+	 *
6981
+	 */
6982 6982
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6983 6983
 	{
6984 6984
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7009,11 +7009,11 @@  discard block
 block discarded – undo
7009 7009
 	
7010 7010
 	
7011 7011
 	/**
7012
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7013
-	*
7014
-	* @return Array the airport list
7015
-	*
7016
-	*/
7012
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7013
+	 *
7014
+	 * @return Array the airport list
7015
+	 *
7016
+	 */
7017 7017
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7018 7018
 	{
7019 7019
 		global $globalTimezone, $globalDBdriver;
@@ -7059,11 +7059,11 @@  discard block
 block discarded – undo
7059 7059
 	
7060 7060
 	
7061 7061
 	/**
7062
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7063
-	*
7064
-	* @return Array the airport list
7065
-	*
7066
-	*/
7062
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7063
+	 *
7064
+	 * @return Array the airport list
7065
+	 *
7066
+	 */
7067 7067
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7068 7068
 	{
7069 7069
 		global $globalTimezone, $globalDBdriver;
@@ -7106,11 +7106,11 @@  discard block
 block discarded – undo
7106 7106
 	
7107 7107
 	
7108 7108
 	/**
7109
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7110
-	*
7111
-	* @return Array the airport list
7112
-	*
7113
-	*/
7109
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7110
+	 *
7111
+	 * @return Array the airport list
7112
+	 *
7113
+	 */
7114 7114
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7115 7115
 	{
7116 7116
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7143,11 +7143,11 @@  discard block
 block discarded – undo
7143 7143
 	
7144 7144
 	
7145 7145
 	/**
7146
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7147
-	*
7148
-	* @return Array the airport list
7149
-	*
7150
-	*/
7146
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7147
+	 *
7148
+	 * @return Array the airport list
7149
+	 *
7150
+	 */
7151 7151
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7152 7152
 	{
7153 7153
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7178,11 +7178,11 @@  discard block
 block discarded – undo
7178 7178
 	
7179 7179
 	
7180 7180
 	/**
7181
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7182
-	*
7183
-	* @return Array the airport list
7184
-	*
7185
-	*/
7181
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7182
+	 *
7183
+	 * @return Array the airport list
7184
+	 *
7185
+	 */
7186 7186
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7187 7187
 	{
7188 7188
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7215,11 +7215,11 @@  discard block
 block discarded – undo
7215 7215
 	
7216 7216
 	
7217 7217
 	/**
7218
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7219
-	*
7220
-	* @return Array the airport list
7221
-	*
7222
-	*/
7218
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7219
+	 *
7220
+	 * @return Array the airport list
7221
+	 *
7222
+	 */
7223 7223
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7224 7224
 	{
7225 7225
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7250,11 +7250,11 @@  discard block
 block discarded – undo
7250 7250
 
7251 7251
 
7252 7252
 	/**
7253
-	* Counts all airport departure countries
7254
-	*
7255
-	* @return Array the airport departure list
7256
-	*
7257
-	*/
7253
+	 * Counts all airport departure countries
7254
+	 *
7255
+	 * @return Array the airport departure list
7256
+	 *
7257
+	 */
7258 7258
 	public function countAllDepartureCountries($filters = array())
7259 7259
 	{
7260 7260
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7284,11 +7284,11 @@  discard block
 block discarded – undo
7284 7284
 	
7285 7285
 	
7286 7286
 	/**
7287
-	* Counts all airport arrival countries
7288
-	*
7289
-	* @return Array the airport arrival list
7290
-	*
7291
-	*/
7287
+	 * Counts all airport arrival countries
7288
+	 *
7289
+	 * @return Array the airport arrival list
7290
+	 *
7291
+	 */
7292 7292
 	public function countAllArrivalCountries($limit = true,$filters = array())
7293 7293
 	{
7294 7294
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7321,11 +7321,11 @@  discard block
 block discarded – undo
7321 7321
 
7322 7322
 
7323 7323
 	/**
7324
-	* Gets all route combinations
7325
-	*
7326
-	* @return Array the route list
7327
-	*
7328
-	*/
7324
+	 * Gets all route combinations
7325
+	 *
7326
+	 * @return Array the route list
7327
+	 *
7328
+	 */
7329 7329
 	public function countAllRoutes($filters = array())
7330 7330
 	{
7331 7331
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7364,11 +7364,11 @@  discard block
 block discarded – undo
7364 7364
 	
7365 7365
 	
7366 7366
 	/**
7367
-	* Gets all route combinations based on an aircraft
7368
-	*
7369
-	* @return Array the route list
7370
-	*
7371
-	*/
7367
+	 * Gets all route combinations based on an aircraft
7368
+	 *
7369
+	 * @return Array the route list
7370
+	 *
7371
+	 */
7372 7372
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7373 7373
 	{
7374 7374
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7404,11 +7404,11 @@  discard block
 block discarded – undo
7404 7404
 	
7405 7405
 	
7406 7406
 	/**
7407
-	* Gets all route combinations based on an aircraft registration
7408
-	*
7409
-	* @return Array the route list
7410
-	*
7411
-	*/
7407
+	 * Gets all route combinations based on an aircraft registration
7408
+	 *
7409
+	 * @return Array the route list
7410
+	 *
7411
+	 */
7412 7412
 	public function countAllRoutesByRegistration($registration, $filters = array())
7413 7413
 	{
7414 7414
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7446,11 +7446,11 @@  discard block
 block discarded – undo
7446 7446
 	
7447 7447
 	
7448 7448
 	/**
7449
-	* Gets all route combinations based on an airline
7450
-	*
7451
-	* @return Array the route list
7452
-	*
7453
-	*/
7449
+	 * Gets all route combinations based on an airline
7450
+	 *
7451
+	 * @return Array the route list
7452
+	 *
7453
+	 */
7454 7454
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7455 7455
 	{
7456 7456
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7488,11 +7488,11 @@  discard block
 block discarded – undo
7488 7488
 	
7489 7489
 	
7490 7490
 	/**
7491
-	* Gets all route combinations based on an airport
7492
-	*
7493
-	* @return Array the route list
7494
-	*
7495
-	*/
7491
+	 * Gets all route combinations based on an airport
7492
+	 *
7493
+	 * @return Array the route list
7494
+	 *
7495
+	 */
7496 7496
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7497 7497
 	{
7498 7498
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7529,11 +7529,11 @@  discard block
 block discarded – undo
7529 7529
 	
7530 7530
 	
7531 7531
 	/**
7532
-	* Gets all route combinations based on an country
7533
-	*
7534
-	* @return Array the route list
7535
-	*
7536
-	*/
7532
+	 * Gets all route combinations based on an country
7533
+	 *
7534
+	 * @return Array the route list
7535
+	 *
7536
+	 */
7537 7537
 	public function countAllRoutesByCountry($country, $filters = array())
7538 7538
 	{
7539 7539
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7569,11 +7569,11 @@  discard block
 block discarded – undo
7569 7569
 
7570 7570
 
7571 7571
 	/**
7572
-	* Gets all route combinations based on an date
7573
-	*
7574
-	* @return Array the route list
7575
-	*
7576
-	*/
7572
+	 * Gets all route combinations based on an date
7573
+	 *
7574
+	 * @return Array the route list
7575
+	 *
7576
+	 */
7577 7577
 	public function countAllRoutesByDate($date, $filters = array())
7578 7578
 	{
7579 7579
 		global $globalTimezone, $globalDBdriver;
@@ -7623,11 +7623,11 @@  discard block
 block discarded – undo
7623 7623
 	
7624 7624
 	
7625 7625
 	/**
7626
-	* Gets all route combinations based on an ident/callsign
7627
-	*
7628
-	* @return Array the route list
7629
-	*
7630
-	*/
7626
+	 * Gets all route combinations based on an ident/callsign
7627
+	 *
7628
+	 * @return Array the route list
7629
+	 *
7630
+	 */
7631 7631
 	public function countAllRoutesByIdent($ident, $filters = array())
7632 7632
 	{
7633 7633
 		$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 route combinations based on an manufacturer
7668
-	*
7669
-	* @return Array the route list
7670
-	*
7671
-	*/
7667
+	 * Gets all route combinations based on an manufacturer
7668
+	 *
7669
+	 * @return Array the route list
7670
+	 *
7671
+	 */
7672 7672
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7673 7673
 	{
7674 7674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7706,11 +7706,11 @@  discard block
 block discarded – undo
7706 7706
 	
7707 7707
 	
7708 7708
 	/**
7709
-	* Gets all route combinations with waypoints
7710
-	*
7711
-	* @return Array the route list
7712
-	*
7713
-	*/
7709
+	 * Gets all route combinations with waypoints
7710
+	 *
7711
+	 * @return Array the route list
7712
+	 *
7713
+	 */
7714 7714
 	public function countAllRoutesWithWaypoints($filters = array())
7715 7715
 	{
7716 7716
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7747,11 +7747,11 @@  discard block
 block discarded – undo
7747 7747
 	}
7748 7748
 	
7749 7749
 	/**
7750
-	* Gets all callsigns that have flown over
7751
-	*
7752
-	* @return Array the callsign list
7753
-	*
7754
-	*/
7750
+	 * Gets all callsigns that have flown over
7751
+	 *
7752
+	 * @return Array the callsign list
7753
+	 *
7754
+	 */
7755 7755
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7756 7756
 	{
7757 7757
 		global $globalDBdriver;
@@ -7789,11 +7789,11 @@  discard block
 block discarded – undo
7789 7789
 	}
7790 7790
 
7791 7791
 	/**
7792
-	* Gets all callsigns that have flown over
7793
-	*
7794
-	* @return Array the callsign list
7795
-	*
7796
-	*/
7792
+	 * Gets all callsigns that have flown over
7793
+	 *
7794
+	 * @return Array the callsign list
7795
+	 *
7796
+	 */
7797 7797
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7798 7798
 	{
7799 7799
 		global $globalDBdriver;
@@ -7834,11 +7834,11 @@  discard block
 block discarded – undo
7834 7834
 
7835 7835
 
7836 7836
 	/**
7837
-	* Counts all dates
7838
-	*
7839
-	* @return Array the date list
7840
-	*
7841
-	*/
7837
+	 * Counts all dates
7838
+	 *
7839
+	 * @return Array the date list
7840
+	 *
7841
+	 */
7842 7842
 	public function countAllDates($filters = array())
7843 7843
 	{
7844 7844
 		global $globalTimezone, $globalDBdriver;
@@ -7883,11 +7883,11 @@  discard block
 block discarded – undo
7883 7883
 	}
7884 7884
 	
7885 7885
 	/**
7886
-	* Counts all dates
7887
-	*
7888
-	* @return Array the date list
7889
-	*
7890
-	*/
7886
+	 * Counts all dates
7887
+	 *
7888
+	 * @return Array the date list
7889
+	 *
7890
+	 */
7891 7891
 	public function countAllDatesByAirlines($filters = array())
7892 7892
 	{
7893 7893
 		global $globalTimezone, $globalDBdriver;
@@ -7932,11 +7932,11 @@  discard block
 block discarded – undo
7932 7932
 	}	
7933 7933
 	
7934 7934
 	/**
7935
-	* Counts all dates during the last 7 days
7936
-	*
7937
-	* @return Array the date list
7938
-	*
7939
-	*/
7935
+	 * Counts all dates during the last 7 days
7936
+	 *
7937
+	 * @return Array the date list
7938
+	 *
7939
+	 */
7940 7940
 	public function countAllDatesLast7Days($filters = array())
7941 7941
 	{
7942 7942
 		global $globalTimezone, $globalDBdriver;
@@ -7958,7 +7958,7 @@  discard block
 block discarded – undo
7958 7958
 			$query .= " GROUP BY date_name 
7959 7959
 								ORDER BY date_name ASC";
7960 7960
 			$query_data = array(':offset' => $offset);
7961
-    		}
7961
+			}
7962 7962
 		
7963 7963
 		$sth = $this->db->prepare($query);
7964 7964
 		$sth->execute($query_data);
@@ -7978,11 +7978,11 @@  discard block
 block discarded – undo
7978 7978
 	}
7979 7979
 
7980 7980
 	/**
7981
-	* Counts all dates during the last month
7982
-	*
7983
-	* @return Array the date list
7984
-	*
7985
-	*/
7981
+	 * Counts all dates during the last month
7982
+	 *
7983
+	 * @return Array the date list
7984
+	 *
7985
+	 */
7986 7986
 	public function countAllDatesLastMonth($filters = array())
7987 7987
 	{
7988 7988
 		global $globalTimezone, $globalDBdriver;
@@ -8004,7 +8004,7 @@  discard block
 block discarded – undo
8004 8004
 			$query .= " GROUP BY date_name 
8005 8005
 								ORDER BY date_name ASC";
8006 8006
 			$query_data = array(':offset' => $offset);
8007
-    		}
8007
+			}
8008 8008
 		
8009 8009
 		$sth = $this->db->prepare($query);
8010 8010
 		$sth->execute($query_data);
@@ -8025,11 +8025,11 @@  discard block
 block discarded – undo
8025 8025
 
8026 8026
 
8027 8027
 	/**
8028
-	* Counts all dates during the last month
8029
-	*
8030
-	* @return Array the date list
8031
-	*
8032
-	*/
8028
+	 * Counts all dates during the last month
8029
+	 *
8030
+	 * @return Array the date list
8031
+	 *
8032
+	 */
8033 8033
 	public function countAllDatesLastMonthByAirlines($filters = array())
8034 8034
 	{
8035 8035
 		global $globalTimezone, $globalDBdriver;
@@ -8052,7 +8052,7 @@  discard block
 block discarded – undo
8052 8052
 								GROUP BY spotter_output.airline_icao, date_name 
8053 8053
 								ORDER BY date_name ASC";
8054 8054
 			$query_data = array(':offset' => $offset);
8055
-    		}
8055
+			}
8056 8056
 		
8057 8057
 		$sth = $this->db->prepare($query);
8058 8058
 		$sth->execute($query_data);
@@ -8074,11 +8074,11 @@  discard block
 block discarded – undo
8074 8074
 	
8075 8075
 
8076 8076
 	/**
8077
-	* Counts all month
8078
-	*
8079
-	* @return Array the month list
8080
-	*
8081
-	*/
8077
+	 * Counts all month
8078
+	 *
8079
+	 * @return Array the month list
8080
+	 *
8081
+	 */
8082 8082
 	public function countAllMonths($filters = array())
8083 8083
 	{
8084 8084
 		global $globalTimezone, $globalDBdriver;
@@ -8120,11 +8120,11 @@  discard block
 block discarded – undo
8120 8120
 	}
8121 8121
 
8122 8122
 	/**
8123
-	* Counts all month
8124
-	*
8125
-	* @return Array the month list
8126
-	*
8127
-	*/
8123
+	 * Counts all month
8124
+	 *
8125
+	 * @return Array the month list
8126
+	 *
8127
+	 */
8128 8128
 	public function countAllMonthsByAirlines($filters = array())
8129 8129
 	{
8130 8130
 		global $globalTimezone, $globalDBdriver;
@@ -8169,11 +8169,11 @@  discard block
 block discarded – undo
8169 8169
 	}
8170 8170
 
8171 8171
 	/**
8172
-	* Counts all military month
8173
-	*
8174
-	* @return Array the month list
8175
-	*
8176
-	*/
8172
+	 * Counts all military month
8173
+	 *
8174
+	 * @return Array the month list
8175
+	 *
8176
+	 */
8177 8177
 	public function countAllMilitaryMonths($filters = array())
8178 8178
 	{
8179 8179
 		global $globalTimezone, $globalDBdriver;
@@ -8214,11 +8214,11 @@  discard block
 block discarded – undo
8214 8214
 	}
8215 8215
 	
8216 8216
 	/**
8217
-	* Counts all month owners
8218
-	*
8219
-	* @return Array the month list
8220
-	*
8221
-	*/
8217
+	 * Counts all month owners
8218
+	 *
8219
+	 * @return Array the month list
8220
+	 *
8221
+	 */
8222 8222
 	public function countAllMonthsOwners($filters = array())
8223 8223
 	{
8224 8224
 		global $globalTimezone, $globalDBdriver;
@@ -8260,11 +8260,11 @@  discard block
 block discarded – undo
8260 8260
 	}
8261 8261
 	
8262 8262
 	/**
8263
-	* Counts all month owners
8264
-	*
8265
-	* @return Array the month list
8266
-	*
8267
-	*/
8263
+	 * Counts all month owners
8264
+	 *
8265
+	 * @return Array the month list
8266
+	 *
8267
+	 */
8268 8268
 	public function countAllMonthsOwnersByAirlines($filters = array())
8269 8269
 	{
8270 8270
 		global $globalTimezone, $globalDBdriver;
@@ -8307,11 +8307,11 @@  discard block
 block discarded – undo
8307 8307
 	}
8308 8308
 
8309 8309
 	/**
8310
-	* Counts all month pilot
8311
-	*
8312
-	* @return Array the month list
8313
-	*
8314
-	*/
8310
+	 * Counts all month pilot
8311
+	 *
8312
+	 * @return Array the month list
8313
+	 *
8314
+	 */
8315 8315
 	public function countAllMonthsPilots($filters = array())
8316 8316
 	{
8317 8317
 		global $globalTimezone, $globalDBdriver;
@@ -8353,11 +8353,11 @@  discard block
 block discarded – undo
8353 8353
 	}
8354 8354
 	
8355 8355
 	/**
8356
-	* Counts all month pilot
8357
-	*
8358
-	* @return Array the month list
8359
-	*
8360
-	*/
8356
+	 * Counts all month pilot
8357
+	 *
8358
+	 * @return Array the month list
8359
+	 *
8360
+	 */
8361 8361
 	public function countAllMonthsPilotsByAirlines($filters = array())
8362 8362
 	{
8363 8363
 		global $globalTimezone, $globalDBdriver;
@@ -8400,11 +8400,11 @@  discard block
 block discarded – undo
8400 8400
 	}
8401 8401
 
8402 8402
 	/**
8403
-	* Counts all month airline
8404
-	*
8405
-	* @return Array the month list
8406
-	*
8407
-	*/
8403
+	 * Counts all month airline
8404
+	 *
8405
+	 * @return Array the month list
8406
+	 *
8407
+	 */
8408 8408
 	public function countAllMonthsAirlines($filters = array())
8409 8409
 	{
8410 8410
 		global $globalTimezone, $globalDBdriver;
@@ -8446,11 +8446,11 @@  discard block
 block discarded – undo
8446 8446
 	}
8447 8447
 	
8448 8448
 	/**
8449
-	* Counts all month aircraft
8450
-	*
8451
-	* @return Array the month list
8452
-	*
8453
-	*/
8449
+	 * Counts all month aircraft
8450
+	 *
8451
+	 * @return Array the month list
8452
+	 *
8453
+	 */
8454 8454
 	public function countAllMonthsAircrafts($filters = array())
8455 8455
 	{
8456 8456
 		global $globalTimezone, $globalDBdriver;
@@ -8493,11 +8493,11 @@  discard block
 block discarded – undo
8493 8493
 	
8494 8494
 
8495 8495
 	/**
8496
-	* Counts all month aircraft
8497
-	*
8498
-	* @return Array the month list
8499
-	*
8500
-	*/
8496
+	 * Counts all month aircraft
8497
+	 *
8498
+	 * @return Array the month list
8499
+	 *
8500
+	 */
8501 8501
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8502 8502
 	{
8503 8503
 		global $globalTimezone, $globalDBdriver;
@@ -8540,11 +8540,11 @@  discard block
 block discarded – undo
8540 8540
 	}
8541 8541
 
8542 8542
 	/**
8543
-	* Counts all month real arrival
8544
-	*
8545
-	* @return Array the month list
8546
-	*
8547
-	*/
8543
+	 * Counts all month real arrival
8544
+	 *
8545
+	 * @return Array the month list
8546
+	 *
8547
+	 */
8548 8548
 	public function countAllMonthsRealArrivals($filters = array())
8549 8549
 	{
8550 8550
 		global $globalTimezone, $globalDBdriver;
@@ -8587,11 +8587,11 @@  discard block
 block discarded – undo
8587 8587
 	
8588 8588
 
8589 8589
 	/**
8590
-	* Counts all month real arrival
8591
-	*
8592
-	* @return Array the month list
8593
-	*
8594
-	*/
8590
+	 * Counts all month real arrival
8591
+	 *
8592
+	 * @return Array the month list
8593
+	 *
8594
+	 */
8595 8595
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8596 8596
 	{
8597 8597
 		global $globalTimezone, $globalDBdriver;
@@ -8635,11 +8635,11 @@  discard block
 block discarded – undo
8635 8635
 	
8636 8636
 
8637 8637
 	/**
8638
-	* Counts all dates during the last year
8639
-	*
8640
-	* @return Array the date list
8641
-	*
8642
-	*/
8638
+	 * Counts all dates during the last year
8639
+	 *
8640
+	 * @return Array the date list
8641
+	 *
8642
+	 */
8643 8643
 	public function countAllMonthsLastYear($filters)
8644 8644
 	{
8645 8645
 		global $globalTimezone, $globalDBdriver;
@@ -8661,7 +8661,7 @@  discard block
 block discarded – undo
8661 8661
 			$query .= " GROUP BY year_name, month_name
8662 8662
 								ORDER BY year_name, month_name ASC";
8663 8663
 			$query_data = array(':offset' => $offset);
8664
-    		}
8664
+			}
8665 8665
 		
8666 8666
 		$sth = $this->db->prepare($query);
8667 8667
 		$sth->execute($query_data);
@@ -8684,11 +8684,11 @@  discard block
 block discarded – undo
8684 8684
 	
8685 8685
 	
8686 8686
 	/**
8687
-	* Counts all hours
8688
-	*
8689
-	* @return Array the hour list
8690
-	*
8691
-	*/
8687
+	 * Counts all hours
8688
+	 *
8689
+	 * @return Array the hour list
8690
+	 *
8691
+	 */
8692 8692
 	public function countAllHours($orderby,$filters = array())
8693 8693
 	{
8694 8694
 		global $globalTimezone, $globalDBdriver;
@@ -8749,11 +8749,11 @@  discard block
 block discarded – undo
8749 8749
 	}
8750 8750
 	
8751 8751
 	/**
8752
-	* Counts all hours
8753
-	*
8754
-	* @return Array the hour list
8755
-	*
8756
-	*/
8752
+	 * Counts all hours
8753
+	 *
8754
+	 * @return Array the hour list
8755
+	 *
8756
+	 */
8757 8757
 	public function countAllHoursByAirlines($orderby, $filters = array())
8758 8758
 	{
8759 8759
 		global $globalTimezone, $globalDBdriver;
@@ -8816,11 +8816,11 @@  discard block
 block discarded – undo
8816 8816
 
8817 8817
 
8818 8818
 	/**
8819
-	* Counts all hours by airline
8820
-	*
8821
-	* @return Array the hour list
8822
-	*
8823
-	*/
8819
+	 * Counts all hours by airline
8820
+	 *
8821
+	 * @return Array the hour list
8822
+	 *
8823
+	 */
8824 8824
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8825 8825
 	{
8826 8826
 		global $globalTimezone, $globalDBdriver;
@@ -8866,11 +8866,11 @@  discard block
 block discarded – undo
8866 8866
 	
8867 8867
 	
8868 8868
 	/**
8869
-	* Counts all hours by aircraft
8870
-	*
8871
-	* @return Array the hour list
8872
-	*
8873
-	*/
8869
+	 * Counts all hours by aircraft
8870
+	 *
8871
+	 * @return Array the hour list
8872
+	 *
8873
+	 */
8874 8874
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8875 8875
 	{
8876 8876
 		global $globalTimezone, $globalDBdriver;
@@ -8913,11 +8913,11 @@  discard block
 block discarded – undo
8913 8913
 	
8914 8914
 	
8915 8915
 	/**
8916
-	* Counts all hours by aircraft registration
8917
-	*
8918
-	* @return Array the hour list
8919
-	*
8920
-	*/
8916
+	 * Counts all hours by aircraft registration
8917
+	 *
8918
+	 * @return Array the hour list
8919
+	 *
8920
+	 */
8921 8921
 	public function countAllHoursByRegistration($registration, $filters = array())
8922 8922
 	{
8923 8923
 		global $globalTimezone, $globalDBdriver;
@@ -8960,11 +8960,11 @@  discard block
 block discarded – undo
8960 8960
 	
8961 8961
 	
8962 8962
 	/**
8963
-	* Counts all hours by airport
8964
-	*
8965
-	* @return Array the hour list
8966
-	*
8967
-	*/
8963
+	 * Counts all hours by airport
8964
+	 *
8965
+	 * @return Array the hour list
8966
+	 *
8967
+	 */
8968 8968
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8969 8969
 	{
8970 8970
 		global $globalTimezone, $globalDBdriver;
@@ -9008,11 +9008,11 @@  discard block
 block discarded – undo
9008 9008
 	
9009 9009
 	
9010 9010
 	/**
9011
-	* Counts all hours by manufacturer
9012
-	*
9013
-	* @return Array the hour list
9014
-	*
9015
-	*/
9011
+	 * Counts all hours by manufacturer
9012
+	 *
9013
+	 * @return Array the hour list
9014
+	 *
9015
+	 */
9016 9016
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9017 9017
 	{
9018 9018
 		global $globalTimezone, $globalDBdriver;
@@ -9056,11 +9056,11 @@  discard block
 block discarded – undo
9056 9056
 	
9057 9057
 	
9058 9058
 	/**
9059
-	* Counts all hours by date
9060
-	*
9061
-	* @return Array the hour list
9062
-	*
9063
-	*/
9059
+	 * Counts all hours by date
9060
+	 *
9061
+	 * @return Array the hour list
9062
+	 *
9063
+	 */
9064 9064
 	public function countAllHoursByDate($date, $filters = array())
9065 9065
 	{
9066 9066
 		global $globalTimezone, $globalDBdriver;
@@ -9104,11 +9104,11 @@  discard block
 block discarded – undo
9104 9104
 	
9105 9105
 	
9106 9106
 	/**
9107
-	* Counts all hours by a ident/callsign
9108
-	*
9109
-	* @return Array the hour list
9110
-	*
9111
-	*/
9107
+	 * Counts all hours by a ident/callsign
9108
+	 *
9109
+	 * @return Array the hour list
9110
+	 *
9111
+	 */
9112 9112
 	public function countAllHoursByIdent($ident, $filters = array())
9113 9113
 	{
9114 9114
 		global $globalTimezone, $globalDBdriver;
@@ -9153,11 +9153,11 @@  discard block
 block discarded – undo
9153 9153
 	
9154 9154
 	
9155 9155
 	/**
9156
-	* Counts all hours by route
9157
-	*
9158
-	* @return Array the hour list
9159
-	*
9160
-	*/
9156
+	 * Counts all hours by route
9157
+	 *
9158
+	 * @return Array the hour list
9159
+	 *
9160
+	 */
9161 9161
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9162 9162
 	{
9163 9163
 		global $globalTimezone, $globalDBdriver;
@@ -9201,11 +9201,11 @@  discard block
 block discarded – undo
9201 9201
 	
9202 9202
 	
9203 9203
 	/**
9204
-	* Counts all hours by country
9205
-	*
9206
-	* @return Array the hour list
9207
-	*
9208
-	*/
9204
+	 * Counts all hours by country
9205
+	 *
9206
+	 * @return Array the hour list
9207
+	 *
9208
+	 */
9209 9209
 	public function countAllHoursByCountry($country, $filters = array())
9210 9210
 	{
9211 9211
 		global $globalTimezone, $globalDBdriver;
@@ -9250,11 +9250,11 @@  discard block
 block discarded – undo
9250 9250
 
9251 9251
 
9252 9252
 	/**
9253
-	* Counts all aircraft that have flown over
9254
-	*
9255
-	* @return Integer the number of aircrafts
9256
-	*
9257
-	*/
9253
+	 * Counts all aircraft that have flown over
9254
+	 *
9255
+	 * @return Integer the number of aircrafts
9256
+	 *
9257
+	 */
9258 9258
 	public function countOverallAircrafts($filters = array())
9259 9259
 	{
9260 9260
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9266,11 +9266,11 @@  discard block
 block discarded – undo
9266 9266
 	}
9267 9267
 
9268 9268
 	/**
9269
-	* Counts all flight that really arrival
9270
-	*
9271
-	* @return Integer the number of aircrafts
9272
-	*
9273
-	*/
9269
+	 * Counts all flight that really arrival
9270
+	 *
9271
+	 * @return Integer the number of aircrafts
9272
+	 *
9273
+	 */
9274 9274
 	public function countOverallArrival($filters = array())
9275 9275
 	{
9276 9276
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9283,11 +9283,11 @@  discard block
 block discarded – undo
9283 9283
 	}
9284 9284
 
9285 9285
 	/**
9286
-	* Counts all pilots that have flown over
9287
-	*
9288
-	* @return Integer the number of pilots
9289
-	*
9290
-	*/
9286
+	 * Counts all pilots that have flown over
9287
+	 *
9288
+	 * @return Integer the number of pilots
9289
+	 *
9290
+	 */
9291 9291
 	public function countOverallPilots($filters = array())
9292 9292
 	{
9293 9293
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9299,11 +9299,11 @@  discard block
 block discarded – undo
9299 9299
 	}
9300 9300
 
9301 9301
 	/**
9302
-	* Counts all owners that have flown over
9303
-	*
9304
-	* @return Integer the number of owners
9305
-	*
9306
-	*/
9302
+	 * Counts all owners that have flown over
9303
+	 *
9304
+	 * @return Integer the number of owners
9305
+	 *
9306
+	 */
9307 9307
 	public function countOverallOwners($filters = array())
9308 9308
 	{
9309 9309
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9316,11 +9316,11 @@  discard block
 block discarded – undo
9316 9316
 	
9317 9317
 	
9318 9318
 	/**
9319
-	* Counts all flights that have flown over
9320
-	*
9321
-	* @return Integer the number of flights
9322
-	*
9323
-	*/
9319
+	 * Counts all flights that have flown over
9320
+	 *
9321
+	 * @return Integer the number of flights
9322
+	 *
9323
+	 */
9324 9324
 	public function countOverallFlights($filters = array())
9325 9325
 	{
9326 9326
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9333,11 +9333,11 @@  discard block
 block discarded – undo
9333 9333
 	}
9334 9334
 	
9335 9335
 	/**
9336
-	* Counts all military flights that have flown over
9337
-	*
9338
-	* @return Integer the number of flights
9339
-	*
9340
-	*/
9336
+	 * Counts all military flights that have flown over
9337
+	 *
9338
+	 * @return Integer the number of flights
9339
+	 *
9340
+	 */
9341 9341
 	public function countOverallMilitaryFlights($filters = array())
9342 9342
 	{
9343 9343
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9352,11 +9352,11 @@  discard block
 block discarded – undo
9352 9352
 	
9353 9353
 	
9354 9354
 	/**
9355
-	* Counts all airlines that have flown over
9356
-	*
9357
-	* @return Integer the number of airlines
9358
-	*
9359
-	*/
9355
+	 * Counts all airlines that have flown over
9356
+	 *
9357
+	 * @return Integer the number of airlines
9358
+	 *
9359
+	 */
9360 9360
 	public function countOverallAirlines($filters = array())
9361 9361
 	{
9362 9362
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9370,11 +9370,11 @@  discard block
 block discarded – undo
9370 9370
 
9371 9371
   
9372 9372
 	/**
9373
-	* Counts all hours of today
9374
-	*
9375
-	* @return Array the hour list
9376
-	*
9377
-	*/
9373
+	 * Counts all hours of today
9374
+	 *
9375
+	 * @return Array the hour list
9376
+	 *
9377
+	 */
9378 9378
 	public function countAllHoursFromToday($filters = array())
9379 9379
 	{
9380 9380
 		global $globalTimezone, $globalDBdriver;
@@ -9414,11 +9414,11 @@  discard block
 block discarded – undo
9414 9414
 	}
9415 9415
     
9416 9416
 	/**
9417
-	* Gets all the spotter information based on calculated upcoming flights
9418
-	*
9419
-	* @return Array the spotter information
9420
-	*
9421
-	*/
9417
+	 * Gets all the spotter information based on calculated upcoming flights
9418
+	 *
9419
+	 * @return Array the spotter information
9420
+	 *
9421
+	 */
9422 9422
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9423 9423
 	{
9424 9424
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9493,12 +9493,12 @@  discard block
 block discarded – undo
9493 9493
 	}
9494 9494
     
9495 9495
     
9496
-     /**
9497
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9498
-	*
9499
-	* @return Integer the Barrie Spotter ID
9496
+	 /**
9497
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9498
+	  *
9499
+	  * @return Integer the Barrie Spotter ID
9500 9500
 q	*
9501
-	*/
9501
+	  */
9502 9502
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9503 9503
 	{
9504 9504
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9519,13 +9519,13 @@  discard block
 block discarded – undo
9519 9519
   
9520 9520
  
9521 9521
 	/**
9522
-	* Parses a date string
9523
-	*
9524
-	* @param String $dateString the date string
9525
-	* @param String $timezone the timezone of a user
9526
-	* @return Array the time information
9527
-	*
9528
-	*/
9522
+	 * Parses a date string
9523
+	 *
9524
+	 * @param String $dateString the date string
9525
+	 * @param String $timezone the timezone of a user
9526
+	 * @return Array the time information
9527
+	 *
9528
+	 */
9529 9529
 	public function parseDateString($dateString, $timezone = '')
9530 9530
 	{
9531 9531
 		$time_array = array();
@@ -9561,12 +9561,12 @@  discard block
 block discarded – undo
9561 9561
 	
9562 9562
 	
9563 9563
 	/**
9564
-	* Parses the direction degrees to working
9565
-	*
9566
-	* @param Float $direction the direction in degrees
9567
-	* @return Array the direction information
9568
-	*
9569
-	*/
9564
+	 * Parses the direction degrees to working
9565
+	 *
9566
+	 * @param Float $direction the direction in degrees
9567
+	 * @return Array the direction information
9568
+	 *
9569
+	 */
9570 9570
 	public function parseDirection($direction = 0)
9571 9571
 	{
9572 9572
 		if ($direction == '') $direction = 0;
@@ -9645,12 +9645,12 @@  discard block
 block discarded – undo
9645 9645
 	
9646 9646
 	
9647 9647
 	/**
9648
-	* Gets the aircraft registration
9649
-	*
9650
-	* @param String $flightaware_id the flight aware id
9651
-	* @return String the aircraft registration
9652
-	*
9653
-	*/
9648
+	 * Gets the aircraft registration
9649
+	 *
9650
+	 * @param String $flightaware_id the flight aware id
9651
+	 * @return String the aircraft registration
9652
+	 *
9653
+	 */
9654 9654
 	
9655 9655
 	public function getAircraftRegistration($flightaware_id)
9656 9656
 	{
@@ -9679,12 +9679,12 @@  discard block
 block discarded – undo
9679 9679
 
9680 9680
 
9681 9681
 	/**
9682
-	* Gets the aircraft registration from ModeS
9683
-	*
9684
-	* @param String $aircraft_modes the flight ModeS in hex
9685
-	* @return String the aircraft registration
9686
-	*
9687
-	*/
9682
+	 * Gets the aircraft registration from ModeS
9683
+	 *
9684
+	 * @param String $aircraft_modes the flight ModeS in hex
9685
+	 * @return String the aircraft registration
9686
+	 *
9687
+	 */
9688 9688
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9689 9689
 	{
9690 9690
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9697,19 +9697,19 @@  discard block
 block discarded – undo
9697 9697
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9698 9698
 		$sth->closeCursor();
9699 9699
 		if (count($row) > 0) {
9700
-		    //return $row['Registration'];
9701
-		    return $row['registration'];
9700
+			//return $row['Registration'];
9701
+			return $row['registration'];
9702 9702
 		} else return '';
9703 9703
 	
9704 9704
 	}
9705 9705
 
9706 9706
 	/**
9707
-	* Gets the aircraft type from ModeS
9708
-	*
9709
-	* @param String $aircraft_modes the flight ModeS in hex
9710
-	* @return String the aircraft type
9711
-	*
9712
-	*/
9707
+	 * Gets the aircraft type from ModeS
9708
+	 *
9709
+	 * @param String $aircraft_modes the flight ModeS in hex
9710
+	 * @return String the aircraft type
9711
+	 *
9712
+	 */
9713 9713
 	public function getAircraftTypeBymodeS($aircraft_modes)
9714 9714
 	{
9715 9715
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9722,19 +9722,19 @@  discard block
 block discarded – undo
9722 9722
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9723 9723
 		$sth->closeCursor();
9724 9724
 		if (count($row) > 0) {
9725
-		    if ($row['type_flight'] == null) return '';
9726
-		    else return $row['type_flight'];
9725
+			if ($row['type_flight'] == null) return '';
9726
+			else return $row['type_flight'];
9727 9727
 		} else return '';
9728 9728
 	
9729 9729
 	}
9730 9730
 
9731 9731
 	/**
9732
-	* Gets Country from latitude/longitude
9733
-	*
9734
-	* @param Float $latitude latitute of the flight
9735
-	* @param Float $longitude longitute of the flight
9736
-	* @return String the countrie
9737
-	*/
9732
+	 * Gets Country from latitude/longitude
9733
+	 *
9734
+	 * @param Float $latitude latitute of the flight
9735
+	 * @param Float $longitude longitute of the flight
9736
+	 * @return String the countrie
9737
+	 */
9738 9738
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9739 9739
 	{
9740 9740
 		global $globalDBdriver, $globalDebug;
@@ -9771,11 +9771,11 @@  discard block
 block discarded – undo
9771 9771
 	}
9772 9772
 
9773 9773
 	/**
9774
-	* Gets Country from iso2
9775
-	*
9776
-	* @param String $iso2 ISO2 country code
9777
-	* @return String the countrie
9778
-	*/
9774
+	 * Gets Country from iso2
9775
+	 *
9776
+	 * @param String $iso2 ISO2 country code
9777
+	 * @return String the countrie
9778
+	 */
9779 9779
 	public function getCountryFromISO2($iso2)
9780 9780
 	{
9781 9781
 		global $globalDBdriver, $globalDebug;
@@ -9803,12 +9803,12 @@  discard block
 block discarded – undo
9803 9803
 	}
9804 9804
 
9805 9805
 	/**
9806
-	* converts the registration code using the country prefix
9807
-	*
9808
-	* @param String $registration the aircraft registration
9809
-	* @return String the aircraft registration
9810
-	*
9811
-	*/
9806
+	 * converts the registration code using the country prefix
9807
+	 *
9808
+	 * @param String $registration the aircraft registration
9809
+	 * @return String the aircraft registration
9810
+	 *
9811
+	 */
9812 9812
 	public function convertAircraftRegistration($registration)
9813 9813
 	{
9814 9814
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9860,12 +9860,12 @@  discard block
 block discarded – undo
9860 9860
 	}
9861 9861
 
9862 9862
 	/**
9863
-	* Country from the registration code
9864
-	*
9865
-	* @param String $registration the aircraft registration
9866
-	* @return String the country
9867
-	*
9868
-	*/
9863
+	 * Country from the registration code
9864
+	 *
9865
+	 * @param String $registration the aircraft registration
9866
+	 * @return String the country
9867
+	 *
9868
+	 */
9869 9869
 	public function countryFromAircraftRegistration($registration)
9870 9870
 	{
9871 9871
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9884,8 +9884,8 @@  discard block
 block discarded – undo
9884 9884
 				$country = $row['country'];
9885 9885
 			}
9886 9886
 		} else {
9887
-    			$registration_1 = substr($registration, 0, 1);
9888
-		        $registration_2 = substr($registration, 0, 2);
9887
+				$registration_1 = substr($registration, 0, 1);
9888
+				$registration_2 = substr($registration, 0, 2);
9889 9889
 
9890 9890
 			$country = '';
9891 9891
 			//first get the prefix based on two characters
@@ -9921,12 +9921,12 @@  discard block
 block discarded – undo
9921 9921
 	}
9922 9922
 
9923 9923
 	/**
9924
-	* Country from the registration code
9925
-	*
9926
-	* @param String $registration the aircraft registration
9927
-	* @return String the country
9928
-	*
9929
-	*/
9924
+	 * Country from the registration code
9925
+	 *
9926
+	 * @param String $registration the aircraft registration
9927
+	 * @return String the country
9928
+	 *
9929
+	 */
9930 9930
 	public function countryFromAircraftRegistrationCode($registration)
9931 9931
 	{
9932 9932
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9943,11 +9943,11 @@  discard block
 block discarded – undo
9943 9943
 	}
9944 9944
 	
9945 9945
 	/**
9946
-	* Set a new highlight value for a flight
9947
-	*
9948
-	* @param String $flightaware_id flightaware_id from spotter_output table
9949
-	* @param String $highlight New highlight value
9950
-	*/
9946
+	 * Set a new highlight value for a flight
9947
+	 *
9948
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9949
+	 * @param String $highlight New highlight value
9950
+	 */
9951 9951
 	public function setHighlightFlight($flightaware_id,$highlight) {
9952 9952
 		
9953 9953
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9956,12 +9956,12 @@  discard block
 block discarded – undo
9956 9956
 	}
9957 9957
 	
9958 9958
 	/**
9959
-	* Gets the short url from bit.ly
9960
-	*
9961
-	* @param String $url the full url
9962
-	* @return String the bit.ly url
9963
-	*
9964
-	*/
9959
+	 * Gets the short url from bit.ly
9960
+	 *
9961
+	 * @param String $url the full url
9962
+	 * @return String the bit.ly url
9963
+	 *
9964
+	 */
9965 9965
 	public function getBitlyURL($url)
9966 9966
 	{
9967 9967
 		global $globalBitlyAccessToken;
@@ -10250,11 +10250,11 @@  discard block
 block discarded – undo
10250 10250
 			$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 
10251 10251
 	                      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)) 
10252 10252
 	                      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;";
10253
-                } else {
10253
+				} else {
10254 10254
 			$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 
10255 10255
 	                      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)) 
10256 10256
 	                      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;";
10257
-    		}
10257
+			}
10258 10258
 		$sth = $this->db->prepare($query);
10259 10259
 		$sth->execute();
10260 10260
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +685 added lines, -237 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) {
31
+			$filter = array_merge($filter,$globalFilter);
32
+		}
31 33
 		$filter_query_join = '';
32 34
 		$filter_query_where = '';
33 35
 		foreach($filters as $flt) {
@@ -77,8 +79,11 @@  discard block
 block discarded – undo
77 79
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78 80
 			}
79 81
 		}
80
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
81
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
82
+		if ($filter_query_where == '' && $where) {
83
+			$filter_query_where = ' WHERE';
84
+		} elseif ($filter_query_where != '' && $and) {
85
+			$filter_query_where .= ' AND';
86
+		}
82 87
 		$filter_query = $filter_query_join.$filter_query_where;
83 88
 		return $filter_query;
84 89
 	}
@@ -98,10 +103,18 @@  discard block
 block discarded – undo
98 103
 		$Image = new Image($this->db);
99 104
 		$Schedule = new Schedule($this->db);
100 105
 		$ACARS = new ACARS($this->db);
101
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
102
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
103
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
104
-		if (!isset($globalVAM)) $globalVAM = FALSE;
106
+		if (!isset($globalIVAO)) {
107
+			$globalIVAO = FALSE;
108
+		}
109
+		if (!isset($globalVATSIM)) {
110
+			$globalVATSIM = FALSE;
111
+		}
112
+		if (!isset($globalphpVMS)) {
113
+			$globalphpVMS = FALSE;
114
+		}
115
+		if (!isset($globalVAM)) {
116
+			$globalVAM = FALSE;
117
+		}
105 118
 		date_default_timezone_set('UTC');
106 119
 		
107 120
 		if (!is_string($query))
@@ -148,21 +161,35 @@  discard block
 block discarded – undo
148 161
 			} else {
149 162
 				$temp_array['spotter_id'] = '';
150 163
 			}
151
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
152
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
164
+			if (isset($row['flightaware_id'])) {
165
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
166
+			}
167
+			if (isset($row['modes'])) {
168
+				$temp_array['modes'] = $row['modes'];
169
+			}
153 170
 			$temp_array['ident'] = $row['ident'];
154 171
 			if (isset($row['registration']) && $row['registration'] != '') {
155 172
 				$temp_array['registration'] = $row['registration'];
156 173
 			} elseif (isset($temp_array['modes'])) {
157 174
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
158
-			} else $temp_array['registration'] = '';
159
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
175
+			} else {
176
+				$temp_array['registration'] = '';
177
+			}
178
+			if (isset($row['aircraft_icao'])) {
179
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
180
+			}
160 181
 			
161 182
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
162 183
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
163
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
164
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
165
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
184
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
185
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
186
+			}
187
+			if (isset($row['latitude'])) {
188
+				$temp_array['latitude'] = $row['latitude'];
189
+			}
190
+			if (isset($row['longitude'])) {
191
+				$temp_array['longitude'] = $row['longitude'];
192
+			}
166 193
 			/*
167 194
 			if (Connection->tableExists('countries')) {
168 195
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -172,8 +199,12 @@  discard block
 block discarded – undo
172 199
 				}
173 200
 			}
174 201
 			*/
175
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
176
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
202
+			if (isset($row['waypoints'])) {
203
+				$temp_array['waypoints'] = $row['waypoints'];
204
+			}
205
+			if (isset($row['format_source'])) {
206
+				$temp_array['format_source'] = $row['format_source'];
207
+			}
177 208
 			if (isset($row['route_stop'])) {
178 209
 				$temp_array['route_stop'] = $row['route_stop'];
179 210
 				if ($row['route_stop'] != '') {
@@ -192,13 +223,19 @@  discard block
 block discarded – undo
192 223
 					}
193 224
 				}
194 225
 			}
195
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
226
+			if (isset($row['altitude'])) {
227
+				$temp_array['altitude'] = $row['altitude'];
228
+			}
196 229
 			if (isset($row['heading'])) {
197 230
 				$temp_array['heading'] = $row['heading'];
198 231
 				$heading_direction = $this->parseDirection($row['heading']);
199
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
232
+				if (isset($heading_direction[0]['direction_fullname'])) {
233
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
234
+				}
235
+			}
236
+			if (isset($row['ground_speed'])) {
237
+				$temp_array['ground_speed'] = $row['ground_speed'];
200 238
 			}
201
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
202 239
 			$temp_array['image'] = "";
203 240
 			$temp_array['image_thumbnail'] = "";
204 241
 			$temp_array['image_source'] = "";
@@ -206,7 +243,9 @@  discard block
 block discarded – undo
206 243
  
207 244
 			if (isset($row['highlight'])) {
208 245
 				$temp_array['highlight'] = $row['highlight'];
209
-			} else $temp_array['highlight'] = '';
246
+			} else {
247
+				$temp_array['highlight'] = '';
248
+			}
210 249
 			
211 250
 			if (isset($row['date'])) {
212 251
 				$dateArray = $this->parseDateString($row['date']);
@@ -254,7 +293,9 @@  discard block
 block discarded – undo
254 293
 				
255 294
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
256 295
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
257
-					} else $temp_array['aircraft_shadow'] = 'default.png';
296
+					} else {
297
+						$temp_array['aircraft_shadow'] = 'default.png';
298
+					}
258 299
                                 } else {
259 300
                             		$temp_array['aircraft_shadow'] = 'default.png';
260 301
 					$temp_array['aircraft_name'] = 'N/A';
@@ -262,11 +303,17 @@  discard block
 block discarded – undo
262 303
                             	}
263 304
 			}
264 305
 			$fromsource = NULL;
265
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
266
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
267
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
268
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
269
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
306
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
307
+				$fromsource = $globalAirlinesSource;
308
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
309
+				$fromsource = 'vatsim';
310
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
311
+				$fromsource = 'ivao';
312
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
313
+				$fromsource = 'vatsim';
314
+			} elseif (isset($globalIVAO) && $globalIVAO) {
315
+				$fromsource = 'ivao';
316
+			}
270 317
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
271 318
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
272 319
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -289,12 +336,18 @@  discard block
 block discarded – undo
289 336
 				}
290 337
 			} else {
291 338
 				$temp_array['airline_icao'] = $row['airline_icao'];
292
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
293
-				else $temp_array['airline_iata'] = 'N/A';
339
+				if (isset($row['airline_iata'])) {
340
+					$temp_array['airline_iata'] = $row['airline_iata'];
341
+				} else {
342
+					$temp_array['airline_iata'] = 'N/A';
343
+				}
294 344
 				$temp_array['airline_name'] = $row['airline_name'];
295 345
 				$temp_array['airline_country'] = $row['airline_country'];
296
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
297
-				else $temp_array['airline_callsign'] = 'N/A';
346
+				if (isset($row['airline_callsign'])) {
347
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
348
+				} else {
349
+					$temp_array['airline_callsign'] = 'N/A';
350
+				}
298 351
 				$temp_array['airline_type'] = $row['airline_type'];
299 352
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
300 353
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -321,7 +374,9 @@  discard block
 block discarded – undo
321 374
 			}
322 375
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
323 376
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
324
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
377
+				if ($owner_info['owner'] != '') {
378
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
379
+				}
325 380
 				$temp_array['aircraft_base'] = $owner_info['base'];
326 381
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
327 382
 			}
@@ -329,9 +384,14 @@  discard block
 block discarded – undo
329 384
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
330 385
 			{
331 386
 				if ($globalIVAO) {
332
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
333
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
334
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
387
+					if (isset($temp_array['airline_icao'])) {
388
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
389
+					} else {
390
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
391
+					}
392
+				} else {
393
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
394
+				}
335 395
 				if (count($image_array) > 0) {
336 396
 					$temp_array['image'] = $image_array[0]['image'];
337 397
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -383,7 +443,9 @@  discard block
 block discarded – undo
383 443
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
384 444
 			if ($row['departure_airport_icao'] != '') {
385 445
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
386
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
446
+				if (!isset($departure_airport_array[0]['name'])) {
447
+					$departure_airport_array = $this->getAllAirportInfo('NA');
448
+				}
387 449
 			/*
388 450
 			} elseif ($row['departure_airport_name'] != '') {
389 451
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -391,7 +453,9 @@  discard block
 block discarded – undo
391 453
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
392 454
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
393 455
 			*/
394
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
456
+			} else {
457
+				$departure_airport_array = $this->getAllAirportInfo('NA');
458
+			}
395 459
 			if (isset($departure_airport_array[0]['name'])) {
396 460
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
397 461
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -411,8 +475,12 @@  discard block
 block discarded – undo
411 475
 			
412 476
 			if ($row['arrival_airport_icao'] != '') {
413 477
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
414
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
415
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
478
+				if (count($arrival_airport_array) == 0) {
479
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
480
+				}
481
+			} else {
482
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
483
+			}
416 484
 			if (isset($arrival_airport_array[0]['name'])) {
417 485
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
418 486
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -428,27 +496,45 @@  discard block
 block discarded – undo
428 496
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
429 497
 			}
430 498
 			*/
431
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
432
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
433
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
434
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
435
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
499
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
500
+				$temp_array['pilot_id'] = $row['pilot_id'];
501
+			}
502
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
503
+				$temp_array['pilot_name'] = $row['pilot_name'];
504
+			}
505
+			if (isset($row['source_name']) && $row['source_name'] != '') {
506
+				$temp_array['source_name'] = $row['source_name'];
507
+			}
508
+			if (isset($row['over_country']) && $row['over_country'] != '') {
509
+				$temp_array['over_country'] = $row['over_country'];
510
+			}
511
+			if (isset($row['distance']) && $row['distance'] != '') {
512
+				$temp_array['distance'] = $row['distance'];
513
+			}
436 514
 			if (isset($row['squawk'])) {
437 515
 				$temp_array['squawk'] = $row['squawk'];
438 516
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
439 517
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
440
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
518
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
519
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
520
+					}
441 521
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
442 522
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
443
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
444
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
523
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
524
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
525
+					}
526
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
527
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
528
+				}
445 529
 			}
446 530
     			
447 531
 			$temp_array['query_number_rows'] = $num_rows;
448 532
 			
449 533
 			$spotter_array[] = $temp_array;
450 534
 		}
451
-		if ($num_rows == 0) return array();
535
+		if ($num_rows == 0) {
536
+			return array();
537
+		}
452 538
 		$spotter_array[0]['query_number_rows'] = $num_rows;
453 539
 		return $spotter_array;
454 540
 	}	
@@ -481,7 +567,9 @@  discard block
 block discarded – undo
481 567
 				foreach ($q_array as $q_item){
482 568
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
483 569
 					$additional_query .= " AND (";
484
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
570
+					if (is_int($q_item)) {
571
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
572
+					}
485 573
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
486 574
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
487 575
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -502,7 +590,9 @@  discard block
 block discarded – undo
502 590
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
503 591
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
504 592
 					$translate = $Translation->ident2icao($q_item);
505
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
593
+					if ($translate != $q_item) {
594
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
595
+					}
506 596
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
507 597
 					$additional_query .= ")";
508 598
 				}
@@ -729,7 +819,9 @@  discard block
 block discarded – undo
729 819
 				date_default_timezone_set($globalTimezone);
730 820
 				$datetime = new DateTime();
731 821
 				$offset = $datetime->format('P');
732
-			} else $offset = '+00:00';
822
+			} else {
823
+				$offset = '+00:00';
824
+			}
733 825
 
734 826
 			if ($date_array[1] != "")
735 827
 			{
@@ -761,8 +853,12 @@  discard block
 block discarded – undo
761 853
 			{
762 854
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
763 855
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
764
-			} else $limit_query = "";
765
-		} else $limit_query = "";
856
+			} else {
857
+				$limit_query = "";
858
+			}
859
+		} else {
860
+			$limit_query = "";
861
+		}
766 862
 
767 863
 
768 864
 		if ($sort != "")
@@ -830,8 +926,12 @@  discard block
 block discarded – undo
830 926
 			{
831 927
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
832 928
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
833
-			} else $limit_query = "";
834
-		} else $limit_query = "";
929
+			} else {
930
+				$limit_query = "";
931
+			}
932
+		} else {
933
+			$limit_query = "";
934
+		}
835 935
 		
836 936
 		if ($sort != "")
837 937
 		{
@@ -1155,7 +1255,9 @@  discard block
 block discarded – undo
1155 1255
 		global $global_query;
1156 1256
 		
1157 1257
 		date_default_timezone_set('UTC');
1158
-		if ($id == '') return array();
1258
+		if ($id == '') {
1259
+			return array();
1260
+		}
1159 1261
 		$additional_query = "spotter_output.spotter_id = :id";
1160 1262
 		$query_values = array(':id' => $id);
1161 1263
 
@@ -1787,7 +1889,9 @@  discard block
 block discarded – undo
1787 1889
 		{
1788 1890
 			$highlight = $row['highlight'];
1789 1891
 		}
1790
-		if (isset($highlight)) return $highlight;
1892
+		if (isset($highlight)) {
1893
+			return $highlight;
1894
+		}
1791 1895
 	}
1792 1896
 
1793 1897
 	
@@ -1815,7 +1919,9 @@  discard block
 block discarded – undo
1815 1919
 		$sth->closeCursor();
1816 1920
 		if (count($row) > 0) {
1817 1921
 			return $row['usage'];
1818
-		} else return '';
1922
+		} else {
1923
+			return '';
1924
+		}
1819 1925
 	}
1820 1926
 
1821 1927
 	/**
@@ -1840,7 +1946,9 @@  discard block
 block discarded – undo
1840 1946
 		$sth->closeCursor();
1841 1947
 		if (count($row) > 0) {
1842 1948
 			return $row['icao'];
1843
-		} else return '';
1949
+		} else {
1950
+			return '';
1951
+		}
1844 1952
 	}
1845 1953
 
1846 1954
 	/**
@@ -1868,7 +1976,9 @@  discard block
 block discarded – undo
1868 1976
 			$airport_longitude = $row['longitude'];
1869 1977
 			$Common = new Common();
1870 1978
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1871
-		} else return '';
1979
+		} else {
1980
+			return '';
1981
+		}
1872 1982
 	}
1873 1983
 	
1874 1984
 	/**
@@ -1980,7 +2090,9 @@  discard block
 block discarded – undo
1980 2090
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1981 2091
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1982 2092
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1983
-		} else return array();
2093
+		} else {
2094
+			return array();
2095
+		}
1984 2096
 		if ($globalDBdriver == 'mysql') {
1985 2097
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1986 2098
 		} else {
@@ -2015,7 +2127,9 @@  discard block
 block discarded – undo
2015 2127
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2016 2128
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2017 2129
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2018
-		} else return array();
2130
+		} else {
2131
+			return array();
2132
+		}
2019 2133
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2020 2134
 		$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.")";
2021 2135
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2050,7 +2164,9 @@  discard block
 block discarded – undo
2050 2164
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2051 2165
 	{
2052 2166
 		global $globalUseRealAirlines;
2053
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2167
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2168
+			$fromsource = NULL;
2169
+		}
2054 2170
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2055 2171
 		if ($airline_icao == 'NA') {
2056 2172
 			$airline_array = array();
@@ -2100,7 +2216,9 @@  discard block
 block discarded – undo
2100 2216
 				$sth->execute(array(':fromsource' => $fromsource));
2101 2217
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2102 2218
 				$sth->closeCursor();
2103
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2219
+				if ($row['nb'] == 0) {
2220
+					$result = $this->getAllAirlineInfo($airline_icao);
2221
+				}
2104 2222
 			}
2105 2223
 			return $result;
2106 2224
 		}
@@ -2116,7 +2234,9 @@  discard block
 block discarded – undo
2116 2234
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2117 2235
 	{
2118 2236
 		global $globalUseRealAirlines;
2119
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2237
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2238
+			$fromsource = NULL;
2239
+		}
2120 2240
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2121 2241
 		$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";
2122 2242
 		$sth = $this->db->prepare($query);
@@ -2132,7 +2252,9 @@  discard block
 block discarded – undo
2132 2252
 			$sth->execute(array(':fromsource' => $fromsource));
2133 2253
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2134 2254
 			$sth->closeCursor();
2135
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2255
+			if ($row['nb'] == 0) {
2256
+				$result = $this->getAllAirlineInfoByName($airline_name);
2257
+			}
2136 2258
 		}
2137 2259
 		return $result;
2138 2260
 	}
@@ -2195,15 +2317,20 @@  discard block
 block discarded – undo
2195 2317
 				'A320-211' => 'A320',
2196 2318
 				'747-8i' => 'B748',
2197 2319
 				'A380' => 'A388');
2198
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2320
+		if (isset($all_aircraft[$aircraft_type])) {
2321
+			return $all_aircraft[$aircraft_type];
2322
+		}
2199 2323
 
2200 2324
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2201 2325
 		$aircraft_type = strtoupper($aircraft_type);
2202 2326
 		$sth = $this->db->prepare($query);
2203 2327
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2204 2328
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2205
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2206
-		else return '';
2329
+		if (isset($result[0]['icao'])) {
2330
+			return $result[0]['icao'];
2331
+		} else {
2332
+			return '';
2333
+		}
2207 2334
 	}
2208 2335
 	
2209 2336
 	/**
@@ -2226,7 +2353,9 @@  discard block
 block discarded – undo
2226 2353
 		$sth->closeCursor();
2227 2354
 		if (isset($row['icaotypecode'])) {
2228 2355
 			return $row['icaotypecode'];
2229
-		} else return '';
2356
+		} else {
2357
+			return '';
2358
+		}
2230 2359
 	}
2231 2360
 
2232 2361
 	/**
@@ -2249,7 +2378,9 @@  discard block
 block discarded – undo
2249 2378
 		$sth->closeCursor();
2250 2379
 		if (isset($row['icaotypecode'])) {
2251 2380
 			return $row['icaotypecode'];
2252
-		} else return '';
2381
+		} else {
2382
+			return '';
2383
+		}
2253 2384
 	}
2254 2385
 
2255 2386
 	/**
@@ -2271,7 +2402,9 @@  discard block
 block discarded – undo
2271 2402
 		$sth->closeCursor();
2272 2403
 		if (isset($row['operator_correct'])) {
2273 2404
 			return $row['operator_correct'];
2274
-		} else return $operator;
2405
+		} else {
2406
+			return $operator;
2407
+		}
2275 2408
 	}
2276 2409
 
2277 2410
 	/**
@@ -2284,7 +2417,9 @@  discard block
 block discarded – undo
2284 2417
 	public function getRouteInfo($callsign)
2285 2418
 	{
2286 2419
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2287
-                if ($callsign == '') return array();
2420
+                if ($callsign == '') {
2421
+                	return array();
2422
+                }
2288 2423
 		$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";
2289 2424
 		
2290 2425
 		$sth = $this->db->prepare($query);
@@ -2294,7 +2429,9 @@  discard block
 block discarded – undo
2294 2429
 		$sth->closeCursor();
2295 2430
 		if (count($row) > 0) {
2296 2431
 			return $row;
2297
-		} else return array();
2432
+		} else {
2433
+			return array();
2434
+		}
2298 2435
 	}
2299 2436
 	
2300 2437
 	/**
@@ -2347,7 +2484,9 @@  discard block
 block discarded – undo
2347 2484
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2348 2485
 			$sth->closeCursor();
2349 2486
 			return $result;
2350
-		} else return array();
2487
+		} else {
2488
+			return array();
2489
+		}
2351 2490
 	}
2352 2491
 	
2353 2492
   
@@ -2506,8 +2645,11 @@  discard block
 block discarded – undo
2506 2645
 		$query .= " ORDER BY spotter_output.source_name ASC";
2507 2646
 
2508 2647
 		$sth = $this->db->prepare($query);
2509
-		if (!empty($query_values)) $sth->execute($query_values);
2510
-		else $sth->execute();
2648
+		if (!empty($query_values)) {
2649
+			$sth->execute($query_values);
2650
+		} else {
2651
+			$sth->execute();
2652
+		}
2511 2653
 
2512 2654
 		$source_array = array();
2513 2655
 		$temp_array = array();
@@ -2540,9 +2682,13 @@  discard block
 block discarded – undo
2540 2682
 								WHERE spotter_output.airline_icao <> '' 
2541 2683
 								ORDER BY spotter_output.airline_name ASC";
2542 2684
 			*/
2543
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2544
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2545
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2685
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2686
+				$forsource = $globalAirlinesSource;
2687
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2688
+				$forsource = 'vatsim';
2689
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2690
+				$forsource = 'ivao';
2691
+			}
2546 2692
 			if ($forsource === NULL) {
2547 2693
 				$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";
2548 2694
 				$query_data = array();
@@ -2834,7 +2980,9 @@  discard block
 block discarded – undo
2834 2980
 			date_default_timezone_set($globalTimezone);
2835 2981
 			$datetime = new DateTime();
2836 2982
 			$offset = $datetime->format('P');
2837
-		} else $offset = '+00:00';
2983
+		} else {
2984
+			$offset = '+00:00';
2985
+		}
2838 2986
 		if ($airport_icao == '') {
2839 2987
 			if ($globalDBdriver == 'mysql') {
2840 2988
 				$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";
@@ -2866,7 +3014,9 @@  discard block
 block discarded – undo
2866 3014
 			date_default_timezone_set($globalTimezone);
2867 3015
 			$datetime = new DateTime();
2868 3016
 			$offset = $datetime->format('P');
2869
-		} else $offset = '+00:00';
3017
+		} else {
3018
+			$offset = '+00:00';
3019
+		}
2870 3020
 		if ($airport_icao == '') {
2871 3021
 			if ($globalDBdriver == 'mysql') {
2872 3022
 				$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";
@@ -2899,7 +3049,9 @@  discard block
 block discarded – undo
2899 3049
 			date_default_timezone_set($globalTimezone);
2900 3050
 			$datetime = new DateTime();
2901 3051
 			$offset = $datetime->format('P');
2902
-		} else $offset = '+00:00';
3052
+		} else {
3053
+			$offset = '+00:00';
3054
+		}
2903 3055
 		if ($airport_icao == '') {
2904 3056
 			if ($globalDBdriver == 'mysql') {
2905 3057
 				$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 
@@ -2938,7 +3090,9 @@  discard block
 block discarded – undo
2938 3090
 			date_default_timezone_set($globalTimezone);
2939 3091
 			$datetime = new DateTime();
2940 3092
 			$offset = $datetime->format('P');
2941
-		} else $offset = '+00:00';
3093
+		} else {
3094
+			$offset = '+00:00';
3095
+		}
2942 3096
 		if ($airport_icao == '') {
2943 3097
 			if ($globalDBdriver == 'mysql') {
2944 3098
 				$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 
@@ -2983,7 +3137,9 @@  discard block
 block discarded – undo
2983 3137
 			date_default_timezone_set($globalTimezone);
2984 3138
 			$datetime = new DateTime();
2985 3139
 			$offset = $datetime->format('P');
2986
-		} else $offset = '+00:00';
3140
+		} else {
3141
+			$offset = '+00:00';
3142
+		}
2987 3143
 		if ($airport_icao == '') {
2988 3144
 			if ($globalDBdriver == 'mysql') {
2989 3145
 				$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";
@@ -3018,7 +3174,9 @@  discard block
 block discarded – undo
3018 3174
 			date_default_timezone_set($globalTimezone);
3019 3175
 			$datetime = new DateTime();
3020 3176
 			$offset = $datetime->format('P');
3021
-		} else $offset = '+00:00';
3177
+		} else {
3178
+			$offset = '+00:00';
3179
+		}
3022 3180
 		if ($airport_icao == '') {
3023 3181
 			if ($globalDBdriver == 'mysql') {
3024 3182
 				$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 
@@ -3060,7 +3218,9 @@  discard block
 block discarded – undo
3060 3218
 			date_default_timezone_set($globalTimezone);
3061 3219
 			$datetime = new DateTime();
3062 3220
 			$offset = $datetime->format('P');
3063
-		} else $offset = '+00:00';
3221
+		} else {
3222
+			$offset = '+00:00';
3223
+		}
3064 3224
 		if ($airport_icao == '') {
3065 3225
 			if ($globalDBdriver == 'mysql') {
3066 3226
 				$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";
@@ -3094,7 +3254,9 @@  discard block
 block discarded – undo
3094 3254
 			date_default_timezone_set($globalTimezone);
3095 3255
 			$datetime = new DateTime();
3096 3256
 			$offset = $datetime->format('P');
3097
-		} else $offset = '+00:00';
3257
+		} else {
3258
+			$offset = '+00:00';
3259
+		}
3098 3260
 		if ($airport_icao == '') {
3099 3261
 			if ($globalDBdriver == 'mysql') {
3100 3262
 				$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 
@@ -3142,7 +3304,9 @@  discard block
 block discarded – undo
3142 3304
 			date_default_timezone_set($globalTimezone);
3143 3305
 			$datetime = new DateTime();
3144 3306
 			$offset = $datetime->format('P');
3145
-		} else $offset = '+00:00';
3307
+		} else {
3308
+			$offset = '+00:00';
3309
+		}
3146 3310
 
3147 3311
 		if ($globalDBdriver == 'mysql') {
3148 3312
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3262,7 +3426,9 @@  discard block
 block discarded – undo
3262 3426
 	*/	
3263 3427
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3264 3428
 	{
3265
-		if ($groundspeed == '') $groundspeed = NULL;
3429
+		if ($groundspeed == '') {
3430
+			$groundspeed = NULL;
3431
+		}
3266 3432
 		$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';
3267 3433
                 $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);
3268 3434
 
@@ -3312,10 +3478,18 @@  discard block
 block discarded – undo
3312 3478
 		$Image = new Image($this->db);
3313 3479
 		$Common = new Common();
3314 3480
 		
3315
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3316
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3317
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3318
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3481
+		if (!isset($globalIVAO)) {
3482
+			$globalIVAO = FALSE;
3483
+		}
3484
+		if (!isset($globalVATSIM)) {
3485
+			$globalVATSIM = FALSE;
3486
+		}
3487
+		if (!isset($globalphpVMS)) {
3488
+			$globalphpVMS = FALSE;
3489
+		}
3490
+		if (!isset($globalVAM)) {
3491
+			$globalVAM = FALSE;
3492
+		}
3319 3493
 		date_default_timezone_set('UTC');
3320 3494
 		
3321 3495
 		//getting the registration
@@ -3328,23 +3502,33 @@  discard block
 block discarded – undo
3328 3502
 				if ($ModeS != '') {
3329 3503
 					$timeelapsed = microtime(true);
3330 3504
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3331
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3505
+					if ($globalDebugTimeElapsed) {
3506
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3507
+					}
3332 3508
 				} else {
3333 3509
 					$myhex = explode('-',$flightaware_id);
3334 3510
 					if (count($myhex) > 0) {
3335 3511
 						$timeelapsed = microtime(true);
3336 3512
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3337
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3513
+						if ($globalDebugTimeElapsed) {
3514
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3515
+						}
3338 3516
 					}
3339 3517
 				}
3340 3518
 			}
3341 3519
 		}
3342 3520
 		$fromsource = NULL;
3343
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3344
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3345
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3346
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3347
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3521
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3522
+			$fromsource = $globalAirlinesSource;
3523
+		} elseif ($format_source == 'vatsimtxt') {
3524
+			$fromsource = 'vatsim';
3525
+		} elseif ($format_source == 'whazzup') {
3526
+			$fromsource = 'ivao';
3527
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3528
+			$fromsource = 'vatsim';
3529
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3530
+			$fromsource = 'ivao';
3531
+		}
3348 3532
 		//getting the airline information
3349 3533
 		if ($ident != "")
3350 3534
 		{
@@ -3368,15 +3552,21 @@  discard block
 block discarded – undo
3368 3552
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3369 3553
 						$airline_array = $this->getAllAirlineInfo("NA");
3370 3554
 					}
3371
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3555
+					if ($globalDebugTimeElapsed) {
3556
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3557
+					}
3372 3558
 
3373 3559
 				} else {
3374 3560
 					$timeelapsed = microtime(true);
3375 3561
 					$airline_array = $this->getAllAirlineInfo("NA");
3376
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3562
+					if ($globalDebugTimeElapsed) {
3563
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3564
+					}
3377 3565
 				}
3378 3566
 			}
3379
-		} else $airline_array = array();
3567
+		} else {
3568
+			$airline_array = array();
3569
+		}
3380 3570
 		
3381 3571
 		//getting the aircraft information
3382 3572
 		$aircraft_array = array();
@@ -3390,27 +3580,37 @@  discard block
 block discarded – undo
3390 3580
 				{
3391 3581
 					$timeelapsed = microtime(true);
3392 3582
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3393
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3583
+					if ($globalDebugTimeElapsed) {
3584
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3585
+					}
3394 3586
 				} else {
3395 3587
 					$timeelapsed = microtime(true);
3396 3588
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3397
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3589
+					if ($globalDebugTimeElapsed) {
3590
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3591
+					}
3398 3592
 				}
3399 3593
 			}
3400 3594
 		} else {
3401 3595
 			if ($ModeS != '') {
3402 3596
 				$timeelapsed = microtime(true);
3403 3597
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3404
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3598
+				if ($globalDebugTimeElapsed) {
3599
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3600
+				}
3405 3601
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3406 3602
 				{
3407 3603
 					$timeelapsed = microtime(true);
3408 3604
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3409
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3605
+					if ($globalDebugTimeElapsed) {
3606
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3607
+					}
3410 3608
 				} else {
3411 3609
 					$timeelapsed = microtime(true);
3412 3610
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3413
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3611
+					if ($globalDebugTimeElapsed) {
3612
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3613
+					}
3414 3614
 				}
3415 3615
 			}
3416 3616
 		}
@@ -3426,7 +3626,9 @@  discard block
 block discarded – undo
3426 3626
 			} else {
3427 3627
 				$timeelapsed = microtime(true);
3428 3628
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3429
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3629
+				if ($globalDebugTimeElapsed) {
3630
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3631
+				}
3430 3632
 			}
3431 3633
 		}
3432 3634
 		
@@ -3441,7 +3643,9 @@  discard block
 block discarded – undo
3441 3643
 			} else {
3442 3644
 				$timeelapsed = microtime(true);
3443 3645
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3444
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3646
+				if ($globalDebugTimeElapsed) {
3647
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3648
+				}
3445 3649
 			}
3446 3650
 		}
3447 3651
 
@@ -3475,7 +3679,9 @@  discard block
 block discarded – undo
3475 3679
 			{
3476 3680
 				return false;
3477 3681
 			}
3478
-		} else $altitude = 0;
3682
+		} else {
3683
+			$altitude = 0;
3684
+		}
3479 3685
 		
3480 3686
 		if ($heading != "")
3481 3687
 		{
@@ -3504,7 +3710,9 @@  discard block
 block discarded – undo
3504 3710
 		{
3505 3711
 			$timeelapsed = microtime(true);
3506 3712
 			$image_array = $Image->getSpotterImage($registration);
3507
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3713
+			if ($globalDebugTimeElapsed) {
3714
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3715
+			}
3508 3716
 			if (!isset($image_array[0]['registration']))
3509 3717
 			{
3510 3718
 				//echo "Add image !!!! \n";
@@ -3512,14 +3720,21 @@  discard block
 block discarded – undo
3512 3720
 			}
3513 3721
 			$timeelapsed = microtime(true);
3514 3722
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3515
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3516
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3723
+			if ($globalDebugTimeElapsed) {
3724
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3725
+			}
3726
+			if ($owner_info['owner'] != '') {
3727
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3728
+			}
3517 3729
 		}
3518 3730
     
3519 3731
 		if ($globalIVAO && $aircraft_icao != '')
3520 3732
 		{
3521
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3522
-            		else $airline_icao = '';
3733
+            		if (isset($airline_array[0]['icao'])) {
3734
+            			$airline_icao = $airline_array[0]['icao'];
3735
+            		} else {
3736
+            			$airline_icao = '';
3737
+            		}
3523 3738
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3524 3739
 			if (!isset($image_array[0]['registration']))
3525 3740
 			{
@@ -3564,16 +3779,28 @@  discard block
 block discarded – undo
3564 3779
                 {
3565 3780
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3566 3781
                 }
3567
-                if ($registration == '') $registration = 'NA';
3782
+                if ($registration == '') {
3783
+                	$registration = 'NA';
3784
+                }
3568 3785
                 if ($latitude == '' && $longitude == '') {
3569 3786
             		$latitude = 0;
3570 3787
             		$longitude = 0;
3571 3788
             	}
3572
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3573
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3574
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3575
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3576
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3789
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3790
+                	$squawk = NULL;
3791
+                }
3792
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3793
+                	$verticalrate = NULL;
3794
+                }
3795
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3796
+                	$heading = 0;
3797
+                }
3798
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3799
+                	$groundspeed = 0;
3800
+                }
3801
+                if (!isset($aircraft_owner)) {
3802
+                	$aircraft_owner = NULL;
3803
+                }
3577 3804
                 $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) 
3578 3805
                 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)";
3579 3806
 
@@ -3584,9 +3811,13 @@  discard block
 block discarded – undo
3584 3811
 		if ($airline_type == '') {
3585 3812
 			$timeelapsed = microtime(true);
3586 3813
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3587
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3814
+			if ($globalDebugTimeElapsed) {
3815
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3816
+			}
3817
+		}
3818
+		if ($airline_type == null) {
3819
+			$airline_type = '';
3588 3820
 		}
3589
-		if ($airline_type == null) $airline_type = '';
3590 3821
                 $aircraft_type = $aircraft_array[0]['type'];
3591 3822
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3592 3823
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3722,7 +3953,9 @@  discard block
 block discarded – undo
3722 3953
 			}
3723 3954
 		}
3724 3955
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3725
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3956
+		if ($limit) {
3957
+			$query .= " LIMIT 10 OFFSET 0";
3958
+		}
3726 3959
 		
3727 3960
 		$sth = $this->db->prepare($query);
3728 3961
 		$sth->execute();
@@ -3767,7 +4000,9 @@  discard block
 block discarded – undo
3767 4000
 			}
3768 4001
 		}
3769 4002
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3770
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4003
+		if ($limit) {
4004
+			$query .= " LIMIT 10 OFFSET 0";
4005
+		}
3771 4006
       
3772 4007
 		
3773 4008
 		$sth = $this->db->prepare($query);
@@ -3813,7 +4048,9 @@  discard block
 block discarded – undo
3813 4048
 			}
3814 4049
 		}
3815 4050
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3816
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4051
+		if ($limit) {
4052
+			$query .= " LIMIT 10 OFFSET 0";
4053
+		}
3817 4054
       
3818 4055
 		
3819 4056
 		$sth = $this->db->prepare($query);
@@ -3861,7 +4098,9 @@  discard block
 block discarded – undo
3861 4098
 			}
3862 4099
 		}
3863 4100
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3864
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4101
+		if ($limit) {
4102
+			$query .= " LIMIT 10 OFFSET 0";
4103
+		}
3865 4104
       
3866 4105
 		
3867 4106
 		$sth = $this->db->prepare($query);
@@ -3906,7 +4145,9 @@  discard block
 block discarded – undo
3906 4145
 			}
3907 4146
 		}
3908 4147
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3909
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4148
+		if ($limit) {
4149
+			$query .= " LIMIT 10 OFFSET 0";
4150
+		}
3910 4151
       
3911 4152
 		
3912 4153
 		$sth = $this->db->prepare($query);
@@ -4149,7 +4390,9 @@  discard block
 block discarded – undo
4149 4390
 			date_default_timezone_set($globalTimezone);
4150 4391
 			$datetime = new DateTime($date);
4151 4392
 			$offset = $datetime->format('P');
4152
-		} else $offset = '+00:00';
4393
+		} else {
4394
+			$offset = '+00:00';
4395
+		}
4153 4396
 
4154 4397
 		if ($globalDBdriver == 'mysql') {
4155 4398
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4197,7 +4440,9 @@  discard block
 block discarded – undo
4197 4440
 			date_default_timezone_set($globalTimezone);
4198 4441
 			$datetime = new DateTime($date);
4199 4442
 			$offset = $datetime->format('P');
4200
-		} else $offset = '+00:00';
4443
+		} else {
4444
+			$offset = '+00:00';
4445
+		}
4201 4446
 		
4202 4447
 		if ($globalDBdriver == 'mysql') {
4203 4448
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4415,7 +4660,9 @@  discard block
 block discarded – undo
4415 4660
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4416 4661
 					GROUP BY spotter_output.airline_country
4417 4662
 					ORDER BY airline_country_count DESC";
4418
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4663
+		if ($limit) {
4664
+			$query .= " LIMIT 10 OFFSET 0";
4665
+		}
4419 4666
       
4420 4667
 		$sth = $this->db->prepare($query);
4421 4668
 		$sth->execute();
@@ -4443,7 +4690,9 @@  discard block
 block discarded – undo
4443 4690
 		global $globalDBdriver;
4444 4691
 		//$filter_query = $this->getFilter($filters,true,true);
4445 4692
 		$Connection= new Connection($this->db);
4446
-		if (!$Connection->tableExists('countries')) return array();
4693
+		if (!$Connection->tableExists('countries')) {
4694
+			return array();
4695
+		}
4447 4696
 		/*
4448 4697
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4449 4698
 					FROM countries c, spotter_output s
@@ -4475,7 +4724,9 @@  discard block
 block discarded – undo
4475 4724
 		}
4476 4725
 		$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 ";
4477 4726
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4478
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4727
+		if ($limit) {
4728
+			$query .= " LIMIT 10 OFFSET 0";
4729
+		}
4479 4730
       
4480 4731
 		
4481 4732
 		$sth = $this->db->prepare($query);
@@ -4525,7 +4776,9 @@  discard block
 block discarded – undo
4525 4776
 		}
4526 4777
 
4527 4778
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4528
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4779
+		if ($limit) {
4780
+			$query .= " LIMIT 10 OFFSET 0";
4781
+		}
4529 4782
  
4530 4783
 		$sth = $this->db->prepare($query);
4531 4784
 		$sth->execute();
@@ -4571,7 +4824,9 @@  discard block
 block discarded – undo
4571 4824
 		}
4572 4825
 
4573 4826
 		$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";
4574
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4827
+		if ($limit) {
4828
+			$query .= " LIMIT 10 OFFSET 0";
4829
+		}
4575 4830
  
4576 4831
 		$sth = $this->db->prepare($query);
4577 4832
 		$sth->execute();
@@ -4618,7 +4873,9 @@  discard block
 block discarded – undo
4618 4873
 		}
4619 4874
 
4620 4875
 		$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";
4621
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4876
+		if ($limit) {
4877
+			$query .= " LIMIT 10 OFFSET 0";
4878
+		}
4622 4879
  
4623 4880
 		$sth = $this->db->prepare($query);
4624 4881
 		$sth->execute();
@@ -4671,7 +4928,9 @@  discard block
 block discarded – undo
4671 4928
 			if($row['registration'] != "")
4672 4929
 			{
4673 4930
 				$image_array = $Image->getSpotterImage($row['registration']);
4674
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4931
+				if (isset($image_array[0]['image_thumbnail'])) {
4932
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4933
+				}
4675 4934
 			}
4676 4935
 			$temp_array['registration_count'] = $row['registration_count'];
4677 4936
 
@@ -4746,7 +5005,9 @@  discard block
 block discarded – undo
4746 5005
 			if($row['registration'] != "")
4747 5006
 			{
4748 5007
 				$image_array = $Image->getSpotterImage($row['registration']);
4749
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5008
+				if (isset($image_array[0]['image_thumbnail'])) {
5009
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5010
+				}
4750 5011
 			}
4751 5012
 			$temp_array['registration_count'] = $row['registration_count'];
4752 5013
 
@@ -4853,7 +5114,9 @@  discard block
 block discarded – undo
4853 5114
 			if($row['registration'] != "")
4854 5115
 			{
4855 5116
 				$image_array = $Image->getSpotterImage($row['registration']);
4856
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5117
+				if (isset($image_array[0]['image_thumbnail'])) {
5118
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5119
+				}
4857 5120
 			}
4858 5121
 			$temp_array['registration_count'] = $row['registration_count'];
4859 5122
 			$aircraft_array[] = $temp_array;
@@ -4978,7 +5241,9 @@  discard block
 block discarded – undo
4978 5241
 			date_default_timezone_set($globalTimezone);
4979 5242
 			$datetime = new DateTime($date);
4980 5243
 			$offset = $datetime->format('P');
4981
-		} else $offset = '+00:00';
5244
+		} else {
5245
+			$offset = '+00:00';
5246
+		}
4982 5247
 
4983 5248
 		if ($globalDBdriver == 'mysql') {
4984 5249
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5025,7 +5290,9 @@  discard block
 block discarded – undo
5025 5290
 			date_default_timezone_set($globalTimezone);
5026 5291
 			$datetime = new DateTime($date);
5027 5292
 			$offset = $datetime->format('P');
5028
-		} else $offset = '+00:00';
5293
+		} else {
5294
+			$offset = '+00:00';
5295
+		}
5029 5296
 
5030 5297
 		if ($globalDBdriver == 'mysql') {
5031 5298
 			$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 
@@ -5054,7 +5321,9 @@  discard block
 block discarded – undo
5054 5321
 			if($row['registration'] != "")
5055 5322
 			{
5056 5323
 				$image_array = $Image->getSpotterImage($row['registration']);
5057
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5324
+				if (isset($image_array[0]['image_thumbnail'])) {
5325
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5326
+				}
5058 5327
 			}
5059 5328
 			$temp_array['registration_count'] = $row['registration_count'];
5060 5329
  
@@ -5079,7 +5348,9 @@  discard block
 block discarded – undo
5079 5348
 			date_default_timezone_set($globalTimezone);
5080 5349
 			$datetime = new DateTime($date);
5081 5350
 			$offset = $datetime->format('P');
5082
-		} else $offset = '+00:00';
5351
+		} else {
5352
+			$offset = '+00:00';
5353
+		}
5083 5354
 
5084 5355
 		if ($globalDBdriver == 'mysql') {
5085 5356
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5177,8 +5448,11 @@  discard block
 block discarded – undo
5177 5448
 			if($row['registration'] != "")
5178 5449
 			{
5179 5450
 				$image_array = $Image->getSpotterImage($row['registration']);
5180
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5181
-				else $temp_array['image_thumbnail'] = '';
5451
+				if (isset($image_array[0]['image_thumbnail'])) {
5452
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5453
+				} else {
5454
+					$temp_array['image_thumbnail'] = '';
5455
+				}
5182 5456
 			}
5183 5457
 			$temp_array['registration_count'] = $row['registration_count'];
5184 5458
 			$aircraft_array[] = $temp_array;
@@ -5285,7 +5559,9 @@  discard block
 block discarded – undo
5285 5559
 			if($row['registration'] != "")
5286 5560
 			{
5287 5561
 				$image_array = $Image->getSpotterImage($row['registration']);
5288
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5562
+				if (isset($image_array[0]['image_thumbnail'])) {
5563
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5564
+				}
5289 5565
 			}
5290 5566
 			$temp_array['registration_count'] = $row['registration_count'];
5291 5567
           
@@ -5402,7 +5678,9 @@  discard block
 block discarded – undo
5402 5678
 			if($row['registration'] != "")
5403 5679
 			{
5404 5680
 				$image_array = $Image->getSpotterImage($row['registration']);
5405
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5681
+				if (isset($image_array[0]['image_thumbnail'])) {
5682
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5683
+				}
5406 5684
 			}
5407 5685
 			$temp_array['registration_count'] = $row['registration_count'];
5408 5686
           
@@ -5514,7 +5792,9 @@  discard block
 block discarded – undo
5514 5792
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5515 5793
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5516 5794
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5517
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5795
+		if ($limit) {
5796
+			$query .= " LIMIT 10 OFFSET 0";
5797
+		}
5518 5798
 		
5519 5799
 		$sth = $this->db->prepare($query);
5520 5800
 		$sth->execute();
@@ -5533,7 +5813,9 @@  discard block
 block discarded – undo
5533 5813
 			if($row['registration'] != "")
5534 5814
 			{
5535 5815
 				$image_array = $Image->getSpotterImage($row['registration']);
5536
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5816
+				if (isset($image_array[0]['image_thumbnail'])) {
5817
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5818
+				}
5537 5819
 			}
5538 5820
           
5539 5821
 			$aircraft_array[] = $temp_array;
@@ -5574,7 +5856,9 @@  discard block
 block discarded – undo
5574 5856
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5575 5857
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5576 5858
                 $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";
5577
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5859
+		if ($limit) {
5860
+			$query .= " LIMIT 10 OFFSET 0";
5861
+		}
5578 5862
 		
5579 5863
 		$sth = $this->db->prepare($query);
5580 5864
 		$sth->execute();
@@ -5594,7 +5878,9 @@  discard block
 block discarded – undo
5594 5878
 			if($row['registration'] != "")
5595 5879
 			{
5596 5880
 				$image_array = $Image->getSpotterImage($row['registration']);
5597
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5881
+				if (isset($image_array[0]['image_thumbnail'])) {
5882
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5883
+				}
5598 5884
 			}
5599 5885
           
5600 5886
 			$aircraft_array[] = $temp_array;
@@ -5635,7 +5921,9 @@  discard block
 block discarded – undo
5635 5921
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5636 5922
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5637 5923
 				ORDER BY airport_departure_icao_count DESC";
5638
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5924
+		if ($limit) {
5925
+			$query .= " LIMIT 10 OFFSET 0";
5926
+		}
5639 5927
       
5640 5928
 		$sth = $this->db->prepare($query);
5641 5929
 		$sth->execute();
@@ -5687,7 +5975,9 @@  discard block
 block discarded – undo
5687 5975
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5688 5976
                 $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
5689 5977
 				ORDER BY airport_departure_icao_count DESC";
5690
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5978
+		if ($limit) {
5979
+			$query .= " LIMIT 10 OFFSET 0";
5980
+		}
5691 5981
       
5692 5982
 		$sth = $this->db->prepare($query);
5693 5983
 		$sth->execute();
@@ -5739,7 +6029,9 @@  discard block
 block discarded – undo
5739 6029
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5740 6030
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5741 6031
 				ORDER BY airport_departure_icao_count DESC";
5742
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6032
+		if ($limit) {
6033
+			$query .= " LIMIT 10 OFFSET 0";
6034
+		}
5743 6035
     		//echo $query;
5744 6036
 		$sth = $this->db->prepare($query);
5745 6037
 		$sth->execute();
@@ -5791,7 +6083,9 @@  discard block
 block discarded – undo
5791 6083
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5792 6084
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5793 6085
 				ORDER BY airport_departure_icao_count DESC";
5794
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6086
+		if ($limit) {
6087
+			$query .= " LIMIT 10 OFFSET 0";
6088
+		}
5795 6089
       
5796 6090
 		$sth = $this->db->prepare($query);
5797 6091
 		$sth->execute();
@@ -6186,7 +6480,9 @@  discard block
 block discarded – undo
6186 6480
 			date_default_timezone_set($globalTimezone);
6187 6481
 			$datetime = new DateTime($date);
6188 6482
 			$offset = $datetime->format('P');
6189
-		} else $offset = '+00:00';
6483
+		} else {
6484
+			$offset = '+00:00';
6485
+		}
6190 6486
 
6191 6487
 		if ($globalDBdriver == 'mysql') {
6192 6488
 			$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 
@@ -6236,7 +6532,9 @@  discard block
 block discarded – undo
6236 6532
 			date_default_timezone_set($globalTimezone);
6237 6533
 			$datetime = new DateTime($date);
6238 6534
 			$offset = $datetime->format('P');
6239
-		} else $offset = '+00:00';
6535
+		} else {
6536
+			$offset = '+00:00';
6537
+		}
6240 6538
 
6241 6539
 		if ($globalDBdriver == 'mysql') {
6242 6540
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6449,7 +6747,9 @@  discard block
 block discarded – undo
6449 6747
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6450 6748
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6451 6749
 					ORDER BY airport_arrival_icao_count DESC";
6452
-		if ($limit) $query .= " LIMIT 10";
6750
+		if ($limit) {
6751
+			$query .= " LIMIT 10";
6752
+		}
6453 6753
       
6454 6754
 		
6455 6755
 		$sth = $this->db->prepare($query);
@@ -6469,7 +6769,9 @@  discard block
 block discarded – undo
6469 6769
 			if ($icaoaskey) {
6470 6770
 				$icao = $row['arrival_airport_icao'];
6471 6771
 				$airport_array[$icao] = $temp_array;
6472
-			} else $airport_array[] = $temp_array;
6772
+			} else {
6773
+				$airport_array[] = $temp_array;
6774
+			}
6473 6775
 		}
6474 6776
 
6475 6777
 		return $airport_array;
@@ -6506,7 +6808,9 @@  discard block
 block discarded – undo
6506 6808
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6507 6809
                 $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
6508 6810
 					ORDER BY airport_arrival_icao_count DESC";
6509
-		if ($limit) $query .= " LIMIT 10";
6811
+		if ($limit) {
6812
+			$query .= " LIMIT 10";
6813
+		}
6510 6814
       
6511 6815
 		
6512 6816
 		$sth = $this->db->prepare($query);
@@ -6527,7 +6831,9 @@  discard block
 block discarded – undo
6527 6831
 			if ($icaoaskey) {
6528 6832
 				$icao = $row['arrival_airport_icao'];
6529 6833
 				$airport_array[$icao] = $temp_array;
6530
-			} else $airport_array[] = $temp_array;
6834
+			} else {
6835
+				$airport_array[] = $temp_array;
6836
+			}
6531 6837
 		}
6532 6838
 
6533 6839
 		return $airport_array;
@@ -6564,7 +6870,9 @@  discard block
 block discarded – undo
6564 6870
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6565 6871
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6566 6872
 					ORDER BY airport_arrival_icao_count DESC";
6567
-		if ($limit) $query .= " LIMIT 10";
6873
+		if ($limit) {
6874
+			$query .= " LIMIT 10";
6875
+		}
6568 6876
       
6569 6877
 		
6570 6878
 		$sth = $this->db->prepare($query);
@@ -6584,7 +6892,9 @@  discard block
 block discarded – undo
6584 6892
 			if ($icaoaskey) {
6585 6893
 				$icao = $row['arrival_airport_icao'];
6586 6894
 				$airport_array[$icao] = $temp_array;
6587
-			} else $airport_array[] = $temp_array;
6895
+			} else {
6896
+				$airport_array[] = $temp_array;
6897
+			}
6588 6898
 		}
6589 6899
 
6590 6900
 		return $airport_array;
@@ -6621,7 +6931,9 @@  discard block
 block discarded – undo
6621 6931
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6622 6932
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6623 6933
 					ORDER BY airport_arrival_icao_count DESC";
6624
-		if ($limit) $query .= " LIMIT 10";
6934
+		if ($limit) {
6935
+			$query .= " LIMIT 10";
6936
+		}
6625 6937
       
6626 6938
 		
6627 6939
 		$sth = $this->db->prepare($query);
@@ -6642,7 +6954,9 @@  discard block
 block discarded – undo
6642 6954
 			if ($icaoaskey) {
6643 6955
 				$icao = $row['arrival_airport_icao'];
6644 6956
 				$airport_array[$icao] = $temp_array;
6645
-			} else $airport_array[] = $temp_array;
6957
+			} else {
6958
+				$airport_array[] = $temp_array;
6959
+			}
6646 6960
 		}
6647 6961
 
6648 6962
 		return $airport_array;
@@ -7023,7 +7337,9 @@  discard block
 block discarded – undo
7023 7337
 			date_default_timezone_set($globalTimezone);
7024 7338
 			$datetime = new DateTime($date);
7025 7339
 			$offset = $datetime->format('P');
7026
-		} else $offset = '+00:00';
7340
+		} else {
7341
+			$offset = '+00:00';
7342
+		}
7027 7343
 
7028 7344
 		if ($globalDBdriver == 'mysql') {
7029 7345
 			$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 
@@ -7073,7 +7389,9 @@  discard block
 block discarded – undo
7073 7389
 			date_default_timezone_set($globalTimezone);
7074 7390
 			$datetime = new DateTime($date);
7075 7391
 			$offset = $datetime->format('P');
7076
-		} else $offset = '+00:00';
7392
+		} else {
7393
+			$offset = '+00:00';
7394
+		}
7077 7395
 
7078 7396
 		if ($globalDBdriver == 'mysql') {
7079 7397
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7296,7 +7614,9 @@  discard block
 block discarded – undo
7296 7614
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7297 7615
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7298 7616
 					ORDER BY airport_arrival_country_count DESC";
7299
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7617
+		if ($limit) {
7618
+			$query .= " LIMIT 10 OFFSET 0";
7619
+		}
7300 7620
       
7301 7621
 		
7302 7622
 		$sth = $this->db->prepare($query);
@@ -7583,7 +7903,9 @@  discard block
 block discarded – undo
7583 7903
 			date_default_timezone_set($globalTimezone);
7584 7904
 			$datetime = new DateTime($date);
7585 7905
 			$offset = $datetime->format('P');
7586
-		} else $offset = '+00:00';
7906
+		} else {
7907
+			$offset = '+00:00';
7908
+		}
7587 7909
 		
7588 7910
 		if ($globalDBdriver == 'mysql') {
7589 7911
 			$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
@@ -7759,15 +8081,23 @@  discard block
 block discarded – undo
7759 8081
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7760 8082
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7761 8083
 		 if ($olderthanmonths > 0) {
7762
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7763
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8084
+			if ($globalDBdriver == 'mysql') {
8085
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8086
+			} else {
8087
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8088
+			}
7764 8089
 		}
7765 8090
 		if ($sincedate != '') {
7766
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7767
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8091
+			if ($globalDBdriver == 'mysql') {
8092
+				$query .= " AND spotter_output.date > '".$sincedate."'";
8093
+			} else {
8094
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8095
+			}
7768 8096
 		}
7769 8097
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7770
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8098
+		if ($limit) {
8099
+			$query .= " LIMIT 10 OFFSET 0";
8100
+		}
7771 8101
       		
7772 8102
 		$sth = $this->db->prepare($query);
7773 8103
 		$sth->execute();
@@ -7801,15 +8131,23 @@  discard block
 block discarded – undo
7801 8131
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7802 8132
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7803 8133
 		 if ($olderthanmonths > 0) {
7804
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7805
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8134
+			if ($globalDBdriver == 'mysql') {
8135
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8136
+			} else {
8137
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8138
+			}
7806 8139
 		}
7807 8140
 		if ($sincedate != '') {
7808
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7809
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8141
+			if ($globalDBdriver == 'mysql') {
8142
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8143
+			} else {
8144
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8145
+			}
7810 8146
 		}
7811 8147
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7812
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8148
+		if ($limit) {
8149
+			$query .= " LIMIT 10 OFFSET 0";
8150
+		}
7813 8151
       		
7814 8152
 		$sth = $this->db->prepare($query);
7815 8153
 		$sth->execute();
@@ -7846,7 +8184,9 @@  discard block
 block discarded – undo
7846 8184
 			date_default_timezone_set($globalTimezone);
7847 8185
 			$datetime = new DateTime();
7848 8186
 			$offset = $datetime->format('P');
7849
-		} else $offset = '+00:00';
8187
+		} else {
8188
+			$offset = '+00:00';
8189
+		}
7850 8190
 
7851 8191
 		if ($globalDBdriver == 'mysql') {
7852 8192
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7895,7 +8235,9 @@  discard block
 block discarded – undo
7895 8235
 			date_default_timezone_set($globalTimezone);
7896 8236
 			$datetime = new DateTime();
7897 8237
 			$offset = $datetime->format('P');
7898
-		} else $offset = '+00:00';
8238
+		} else {
8239
+			$offset = '+00:00';
8240
+		}
7899 8241
 		$filter_query = $this->getFilter($filters,true,true);
7900 8242
 		if ($globalDBdriver == 'mysql') {
7901 8243
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7944,7 +8286,9 @@  discard block
 block discarded – undo
7944 8286
 			date_default_timezone_set($globalTimezone);
7945 8287
 			$datetime = new DateTime();
7946 8288
 			$offset = $datetime->format('P');
7947
-		} else $offset = '+00:00';
8289
+		} else {
8290
+			$offset = '+00:00';
8291
+		}
7948 8292
 		$filter_query = $this->getFilter($filters,true,true);
7949 8293
 		if ($globalDBdriver == 'mysql') {
7950 8294
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7990,7 +8334,9 @@  discard block
 block discarded – undo
7990 8334
 			date_default_timezone_set($globalTimezone);
7991 8335
 			$datetime = new DateTime();
7992 8336
 			$offset = $datetime->format('P');
7993
-		} else $offset = '+00:00';
8337
+		} else {
8338
+			$offset = '+00:00';
8339
+		}
7994 8340
 		$filter_query = $this->getFilter($filters,true,true);
7995 8341
 		if ($globalDBdriver == 'mysql') {
7996 8342
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8038,7 +8384,9 @@  discard block
 block discarded – undo
8038 8384
 			date_default_timezone_set($globalTimezone);
8039 8385
 			$datetime = new DateTime();
8040 8386
 			$offset = $datetime->format('P');
8041
-		} else $offset = '+00:00';
8387
+		} else {
8388
+			$offset = '+00:00';
8389
+		}
8042 8390
 		
8043 8391
 		if ($globalDBdriver == 'mysql') {
8044 8392
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8086,7 +8434,9 @@  discard block
 block discarded – undo
8086 8434
 			date_default_timezone_set($globalTimezone);
8087 8435
 			$datetime = new DateTime();
8088 8436
 			$offset = $datetime->format('P');
8089
-		} else $offset = '+00:00';
8437
+		} else {
8438
+			$offset = '+00:00';
8439
+		}
8090 8440
 
8091 8441
 		if ($globalDBdriver == 'mysql') {
8092 8442
 			$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
@@ -8133,7 +8483,9 @@  discard block
 block discarded – undo
8133 8483
 			date_default_timezone_set($globalTimezone);
8134 8484
 			$datetime = new DateTime();
8135 8485
 			$offset = $datetime->format('P');
8136
-		} else $offset = '+00:00';
8486
+		} else {
8487
+			$offset = '+00:00';
8488
+		}
8137 8489
 
8138 8490
 		if ($globalDBdriver == 'mysql') {
8139 8491
 			$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
@@ -8181,7 +8533,9 @@  discard block
 block discarded – undo
8181 8533
 			date_default_timezone_set($globalTimezone);
8182 8534
 			$datetime = new DateTime();
8183 8535
 			$offset = $datetime->format('P');
8184
-		} else $offset = '+00:00';
8536
+		} else {
8537
+			$offset = '+00:00';
8538
+		}
8185 8539
 		$filter_query = $this->getFilter($filters,true,true);
8186 8540
 		if ($globalDBdriver == 'mysql') {
8187 8541
 			$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
@@ -8226,7 +8580,9 @@  discard block
 block discarded – undo
8226 8580
 			date_default_timezone_set($globalTimezone);
8227 8581
 			$datetime = new DateTime();
8228 8582
 			$offset = $datetime->format('P');
8229
-		} else $offset = '+00:00';
8583
+		} else {
8584
+			$offset = '+00:00';
8585
+		}
8230 8586
 		$filter_query = $this->getFilter($filters,true,true);
8231 8587
 
8232 8588
 		if ($globalDBdriver == 'mysql') {
@@ -8273,7 +8629,9 @@  discard block
 block discarded – undo
8273 8629
 			date_default_timezone_set($globalTimezone);
8274 8630
 			$datetime = new DateTime();
8275 8631
 			$offset = $datetime->format('P');
8276
-		} else $offset = '+00:00';
8632
+		} else {
8633
+			$offset = '+00:00';
8634
+		}
8277 8635
 
8278 8636
 		if ($globalDBdriver == 'mysql') {
8279 8637
 			$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
@@ -8319,7 +8677,9 @@  discard block
 block discarded – undo
8319 8677
 			date_default_timezone_set($globalTimezone);
8320 8678
 			$datetime = new DateTime();
8321 8679
 			$offset = $datetime->format('P');
8322
-		} else $offset = '+00:00';
8680
+		} else {
8681
+			$offset = '+00:00';
8682
+		}
8323 8683
 		$filter_query = $this->getFilter($filters,true,true);
8324 8684
 
8325 8685
 		if ($globalDBdriver == 'mysql') {
@@ -8366,7 +8726,9 @@  discard block
 block discarded – undo
8366 8726
 			date_default_timezone_set($globalTimezone);
8367 8727
 			$datetime = new DateTime();
8368 8728
 			$offset = $datetime->format('P');
8369
-		} else $offset = '+00:00';
8729
+		} else {
8730
+			$offset = '+00:00';
8731
+		}
8370 8732
 
8371 8733
 		if ($globalDBdriver == 'mysql') {
8372 8734
 			$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
@@ -8413,7 +8775,9 @@  discard block
 block discarded – undo
8413 8775
 			date_default_timezone_set($globalTimezone);
8414 8776
 			$datetime = new DateTime();
8415 8777
 			$offset = $datetime->format('P');
8416
-		} else $offset = '+00:00';
8778
+		} else {
8779
+			$offset = '+00:00';
8780
+		}
8417 8781
 
8418 8782
 		if ($globalDBdriver == 'mysql') {
8419 8783
 			$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
@@ -8458,7 +8822,9 @@  discard block
 block discarded – undo
8458 8822
 			date_default_timezone_set($globalTimezone);
8459 8823
 			$datetime = new DateTime();
8460 8824
 			$offset = $datetime->format('P');
8461
-		} else $offset = '+00:00';
8825
+		} else {
8826
+			$offset = '+00:00';
8827
+		}
8462 8828
 		$filter_query = $this->getFilter($filters,true,true);
8463 8829
 
8464 8830
 		if ($globalDBdriver == 'mysql') {
@@ -8506,7 +8872,9 @@  discard block
 block discarded – undo
8506 8872
 			date_default_timezone_set($globalTimezone);
8507 8873
 			$datetime = new DateTime();
8508 8874
 			$offset = $datetime->format('P');
8509
-		} else $offset = '+00:00';
8875
+		} else {
8876
+			$offset = '+00:00';
8877
+		}
8510 8878
 
8511 8879
 		if ($globalDBdriver == 'mysql') {
8512 8880
 			$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
@@ -8552,7 +8920,9 @@  discard block
 block discarded – undo
8552 8920
 			date_default_timezone_set($globalTimezone);
8553 8921
 			$datetime = new DateTime();
8554 8922
 			$offset = $datetime->format('P');
8555
-		} else $offset = '+00:00';
8923
+		} else {
8924
+			$offset = '+00:00';
8925
+		}
8556 8926
 		$filter_query = $this->getFilter($filters,true,true);
8557 8927
 
8558 8928
 		if ($globalDBdriver == 'mysql') {
@@ -8600,7 +8970,9 @@  discard block
 block discarded – undo
8600 8970
 			date_default_timezone_set($globalTimezone);
8601 8971
 			$datetime = new DateTime();
8602 8972
 			$offset = $datetime->format('P');
8603
-		} else $offset = '+00:00';
8973
+		} else {
8974
+			$offset = '+00:00';
8975
+		}
8604 8976
 
8605 8977
 		if ($globalDBdriver == 'mysql') {
8606 8978
 			$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
@@ -8647,7 +9019,9 @@  discard block
 block discarded – undo
8647 9019
 			date_default_timezone_set($globalTimezone);
8648 9020
 			$datetime = new DateTime();
8649 9021
 			$offset = $datetime->format('P');
8650
-		} else $offset = '+00:00';
9022
+		} else {
9023
+			$offset = '+00:00';
9024
+		}
8651 9025
 		$filter_query = $this->getFilter($filters,true,true);
8652 9026
 		if ($globalDBdriver == 'mysql') {
8653 9027
 			$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
@@ -8696,7 +9070,9 @@  discard block
 block discarded – undo
8696 9070
 			date_default_timezone_set($globalTimezone);
8697 9071
 			$datetime = new DateTime();
8698 9072
 			$offset = $datetime->format('P');
8699
-		} else $offset = '+00:00';
9073
+		} else {
9074
+			$offset = '+00:00';
9075
+		}
8700 9076
 
8701 9077
 		$orderby_sql = '';
8702 9078
 		if ($orderby == "hour")
@@ -8762,7 +9138,9 @@  discard block
 block discarded – undo
8762 9138
 			date_default_timezone_set($globalTimezone);
8763 9139
 			$datetime = new DateTime();
8764 9140
 			$offset = $datetime->format('P');
8765
-		} else $offset = '+00:00';
9141
+		} else {
9142
+			$offset = '+00:00';
9143
+		}
8766 9144
 
8767 9145
 		$orderby_sql = '';
8768 9146
 		if ($orderby == "hour")
@@ -8829,7 +9207,9 @@  discard block
 block discarded – undo
8829 9207
 			date_default_timezone_set($globalTimezone);
8830 9208
 			$datetime = new DateTime();
8831 9209
 			$offset = $datetime->format('P');
8832
-		} else $offset = '+00:00';
9210
+		} else {
9211
+			$offset = '+00:00';
9212
+		}
8833 9213
 
8834 9214
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8835 9215
 
@@ -8880,7 +9260,9 @@  discard block
 block discarded – undo
8880 9260
 			date_default_timezone_set($globalTimezone);
8881 9261
 			$datetime = new DateTime();
8882 9262
 			$offset = $datetime->format('P');
8883
-		} else $offset = '+00:00';
9263
+		} else {
9264
+			$offset = '+00:00';
9265
+		}
8884 9266
 
8885 9267
 		if ($globalDBdriver == 'mysql') {
8886 9268
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8927,7 +9309,9 @@  discard block
 block discarded – undo
8927 9309
 			date_default_timezone_set($globalTimezone);
8928 9310
 			$datetime = new DateTime();
8929 9311
 			$offset = $datetime->format('P');
8930
-		} else $offset = '+00:00';
9312
+		} else {
9313
+			$offset = '+00:00';
9314
+		}
8931 9315
 
8932 9316
 		if ($globalDBdriver == 'mysql') {
8933 9317
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8974,7 +9358,9 @@  discard block
 block discarded – undo
8974 9358
 			date_default_timezone_set($globalTimezone);
8975 9359
 			$datetime = new DateTime();
8976 9360
 			$offset = $datetime->format('P');
8977
-		} else $offset = '+00:00';
9361
+		} else {
9362
+			$offset = '+00:00';
9363
+		}
8978 9364
 
8979 9365
 		if ($globalDBdriver == 'mysql') {
8980 9366
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9022,7 +9408,9 @@  discard block
 block discarded – undo
9022 9408
 			date_default_timezone_set($globalTimezone);
9023 9409
 			$datetime = new DateTime();
9024 9410
 			$offset = $datetime->format('P');
9025
-		} else $offset = '+00:00';
9411
+		} else {
9412
+			$offset = '+00:00';
9413
+		}
9026 9414
 
9027 9415
 		if ($globalDBdriver == 'mysql') {
9028 9416
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9070,7 +9458,9 @@  discard block
 block discarded – undo
9070 9458
 			date_default_timezone_set($globalTimezone);
9071 9459
 			$datetime = new DateTime($date);
9072 9460
 			$offset = $datetime->format('P');
9073
-		} else $offset = '+00:00';
9461
+		} else {
9462
+			$offset = '+00:00';
9463
+		}
9074 9464
 
9075 9465
 		if ($globalDBdriver == 'mysql') {
9076 9466
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9118,7 +9508,9 @@  discard block
 block discarded – undo
9118 9508
 			date_default_timezone_set($globalTimezone);
9119 9509
 			$datetime = new DateTime();
9120 9510
 			$offset = $datetime->format('P');
9121
-		} else $offset = '+00:00';
9511
+		} else {
9512
+			$offset = '+00:00';
9513
+		}
9122 9514
 
9123 9515
 		if ($globalDBdriver == 'mysql') {
9124 9516
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9168,7 +9560,9 @@  discard block
 block discarded – undo
9168 9560
 			date_default_timezone_set($globalTimezone);
9169 9561
 			$datetime = new DateTime();
9170 9562
 			$offset = $datetime->format('P');
9171
-		} else $offset = '+00:00';
9563
+		} else {
9564
+			$offset = '+00:00';
9565
+		}
9172 9566
 
9173 9567
 		if ($globalDBdriver == 'mysql') {
9174 9568
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9215,7 +9609,9 @@  discard block
 block discarded – undo
9215 9609
 			date_default_timezone_set($globalTimezone);
9216 9610
 			$datetime = new DateTime();
9217 9611
 			$offset = $datetime->format('P');
9218
-		} else $offset = '+00:00';
9612
+		} else {
9613
+			$offset = '+00:00';
9614
+		}
9219 9615
 
9220 9616
 		if ($globalDBdriver == 'mysql') {
9221 9617
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9383,7 +9779,9 @@  discard block
 block discarded – undo
9383 9779
 			date_default_timezone_set($globalTimezone);
9384 9780
 			$datetime = new DateTime();
9385 9781
 			$offset = $datetime->format('P');
9386
-		} else $offset = '+00:00';
9782
+		} else {
9783
+			$offset = '+00:00';
9784
+		}
9387 9785
 
9388 9786
 		if ($globalDBdriver == 'mysql') {
9389 9787
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9569,7 +9967,9 @@  discard block
 block discarded – undo
9569 9967
 	*/
9570 9968
 	public function parseDirection($direction = 0)
9571 9969
 	{
9572
-		if ($direction == '') $direction = 0;
9970
+		if ($direction == '') {
9971
+			$direction = 0;
9972
+		}
9573 9973
 		$direction_array = array();
9574 9974
 		$temp_array = array();
9575 9975
 
@@ -9670,7 +10070,9 @@  discard block
 block discarded – undo
9670 10070
 		if (isset($result->AirlineFlightInfoResult))
9671 10071
 		{
9672 10072
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9673
-		} else return '';
10073
+		} else {
10074
+			return '';
10075
+		}
9674 10076
 		
9675 10077
 		$registration = $this->convertAircraftRegistration($registration);
9676 10078
 		
@@ -9699,7 +10101,9 @@  discard block
 block discarded – undo
9699 10101
 		if (count($row) > 0) {
9700 10102
 		    //return $row['Registration'];
9701 10103
 		    return $row['registration'];
9702
-		} else return '';
10104
+		} else {
10105
+			return '';
10106
+		}
9703 10107
 	
9704 10108
 	}
9705 10109
 
@@ -9722,9 +10126,14 @@  discard block
 block discarded – undo
9722 10126
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9723 10127
 		$sth->closeCursor();
9724 10128
 		if (count($row) > 0) {
9725
-		    if ($row['type_flight'] == null) return '';
9726
-		    else return $row['type_flight'];
9727
-		} else return '';
10129
+		    if ($row['type_flight'] == null) {
10130
+		    	return '';
10131
+		    } else {
10132
+		    	return $row['type_flight'];
10133
+		    }
10134
+		} else {
10135
+			return '';
10136
+		}
9728 10137
 	
9729 10138
 	}
9730 10139
 
@@ -9742,7 +10151,9 @@  discard block
 block discarded – undo
9742 10151
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9743 10152
 	
9744 10153
 		$Connection = new Connection($this->db);
9745
-		if (!$Connection->tableExists('countries')) return '';
10154
+		if (!$Connection->tableExists('countries')) {
10155
+			return '';
10156
+		}
9746 10157
 	
9747 10158
 		try {
9748 10159
 			/*
@@ -9762,9 +10173,13 @@  discard block
 block discarded – undo
9762 10173
 			$sth->closeCursor();
9763 10174
 			if (count($row) > 0) {
9764 10175
 				return $row;
9765
-			} else return '';
10176
+			} else {
10177
+				return '';
10178
+			}
9766 10179
 		} catch (PDOException $e) {
9767
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10180
+			if (isset($globalDebug) && $globalDebug) {
10181
+				echo 'Error : '.$e->getMessage()."\n";
10182
+			}
9768 10183
 			return '';
9769 10184
 		}
9770 10185
 	
@@ -9782,7 +10197,9 @@  discard block
 block discarded – undo
9782 10197
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9783 10198
 	
9784 10199
 		$Connection = new Connection($this->db);
9785
-		if (!$Connection->tableExists('countries')) return '';
10200
+		if (!$Connection->tableExists('countries')) {
10201
+			return '';
10202
+		}
9786 10203
 	
9787 10204
 		try {
9788 10205
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -9794,9 +10211,13 @@  discard block
 block discarded – undo
9794 10211
 			$sth->closeCursor();
9795 10212
 			if (count($row) > 0) {
9796 10213
 				return $row;
9797
-			} else return '';
10214
+			} else {
10215
+				return '';
10216
+			}
9798 10217
 		} catch (PDOException $e) {
9799
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10218
+			if (isset($globalDebug) && $globalDebug) {
10219
+				echo 'Error : '.$e->getMessage()."\n";
10220
+			}
9800 10221
 			return '';
9801 10222
 		}
9802 10223
 	
@@ -9966,7 +10387,9 @@  discard block
 block discarded – undo
9966 10387
 	{
9967 10388
 		global $globalBitlyAccessToken;
9968 10389
 		
9969
-		if ($globalBitlyAccessToken == '') return $url;
10390
+		if ($globalBitlyAccessToken == '') {
10391
+			return $url;
10392
+		}
9970 10393
         
9971 10394
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9972 10395
 		
@@ -10115,7 +10538,9 @@  discard block
 block discarded – undo
10115 10538
 		
10116 10539
 
10117 10540
 		// routes
10118
-		if ($globalDebug) print "Routes...\n";
10541
+		if ($globalDebug) {
10542
+			print "Routes...\n";
10543
+		}
10119 10544
 		if ($globalDBdriver == 'mysql') {
10120 10545
 			$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)";
10121 10546
 		} else {
@@ -10134,7 +10559,9 @@  discard block
 block discarded – undo
10134 10559
 			}
10135 10560
 		}
10136 10561
 		
10137
-		if ($globalDebug) print "Airlines...\n";
10562
+		if ($globalDebug) {
10563
+			print "Airlines...\n";
10564
+		}
10138 10565
 		//airlines
10139 10566
 		if ($globalDBdriver == 'mysql') {
10140 10567
 			$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)";
@@ -10148,10 +10575,15 @@  discard block
 block discarded – undo
10148 10575
 			if (is_numeric(substr($row['ident'], -1, 1)))
10149 10576
 			{
10150 10577
 				$fromsource = NULL;
10151
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10152
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10153
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10154
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10578
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10579
+					$fromsource = 'vatsim';
10580
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10581
+					$fromsource = 'ivao';
10582
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10583
+					$fromsource = 'vatsim';
10584
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10585
+					$fromsource = 'ivao';
10586
+				}
10155 10587
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10156 10588
 				if (isset($airline_array[0]['name'])) {
10157 10589
 					$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";
@@ -10161,13 +10593,17 @@  discard block
 block discarded – undo
10161 10593
 			}
10162 10594
 		}
10163 10595
 
10164
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10596
+		if ($globalDebug) {
10597
+			print "Remove Duplicate in aircraft_modes...\n";
10598
+		}
10165 10599
 		//duplicate modes
10166 10600
 		$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";
10167 10601
 		$sth = $this->db->prepare($query);
10168 10602
 		$sth->execute();
10169 10603
 		
10170
-		if ($globalDebug) print "Aircraft...\n";
10604
+		if ($globalDebug) {
10605
+			print "Aircraft...\n";
10606
+		}
10171 10607
 		//aircraft
10172 10608
 		if ($globalDBdriver == 'mysql') {
10173 10609
 			$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)";
@@ -10210,26 +10646,38 @@  discard block
 block discarded – undo
10210 10646
 				 if (isset($closestAirports[0])) {
10211 10647
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10212 10648
 						$airport_icao = $closestAirports[0]['icao'];
10213
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10649
+						if ($globalDebug) {
10650
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10651
+						}
10214 10652
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10215 10653
 						foreach ($closestAirports as $airport) {
10216 10654
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10217 10655
 								$airport_icao = $airport['icao'];
10218
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10656
+								if ($globalDebug) {
10657
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10658
+								}
10219 10659
 								break;
10220 10660
 							}
10221 10661
 						}
10222 10662
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10223 10663
 						$airport_icao = $closestAirports[0]['icao'];
10224
-						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";
10664
+						if ($globalDebug) {
10665
+							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";
10666
+						}
10225 10667
 					} else {
10226
-						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";
10668
+						if ($globalDebug) {
10669
+							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";
10670
+						}
10227 10671
 					}
10228 10672
 				} else {
10229
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10673
+					if ($globalDebug) {
10674
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10675
+					}
10230 10676
 				}
10231 10677
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10232
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10678
+					if ($globalDebug) {
10679
+						echo "Updating airport to ".$airport_icao."...\n";
10680
+					}
10233 10681
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10234 10682
 					$sthu = $this->db->prepare($update_query);
10235 10683
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.