Completed
Push — master ( 79cbb4...2c41c0 )
by Yannick
30:50
created
require/class.Connection.php 2 patches
Doc Comments   +20 added lines patch added patch discarded remove patch
@@ -6,6 +6,9 @@  discard block
 block discarded – undo
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 48;
8 8
 
9
+	/**
10
+	 * @param string $dbname
11
+	 */
9 12
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10 13
 		global $globalNoDB;
11 14
 		if (isset($globalNoDB) && $globalNoDB === TRUE) {
@@ -142,6 +145,9 @@  discard block
 block discarded – undo
142 145
 		return true;
143 146
 	}
144 147
 
148
+	/**
149
+	 * @param string $table
150
+	 */
145 151
 	public function tableExists($table)
146 152
 	{
147 153
 		global $globalDBdriver, $globalDBname;
@@ -192,6 +198,11 @@  discard block
 block discarded – undo
192 198
 	/*
193 199
 	* Check if index exist
194 200
 	*/
201
+
202
+	/**
203
+	 * @param string $table
204
+	 * @param string $index
205
+	 */
195 206
 	public function indexExists($table,$index)
196 207
 	{
197 208
 		global $globalDBdriver, $globalDBname;
@@ -234,6 +245,10 @@  discard block
 block discarded – undo
234 245
 		return $columns;
235 246
 	}
236 247
 
248
+	/**
249
+	 * @param string $table
250
+	 * @param string $column
251
+	 */
237 252
 	public function getColumnType($table,$column) {
238 253
 		$select = $this->db->query('SELECT '.$column.' FROM '.$table);
239 254
 		$tomet = $select->getColumnMeta(0);
@@ -244,6 +259,11 @@  discard block
 block discarded – undo
244 259
 	* Check if a column name exist in a table
245 260
 	* @return Boolean column exist or not
246 261
 	*/
262
+
263
+	/**
264
+	 * @param string $table
265
+	 * @param string $name
266
+	 */
247 267
 	public function checkColumnName($table,$name)
248 268
 	{
249 269
 		global $globalDBdriver, $globalDBname;
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 
4
-class Connection{
4
+class Connection {
5 5
 	public $db = null;
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 48;
8 8
 
9
-	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
9
+	public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) {
10 10
 		global $globalNoDB;
11 11
 		if (isset($globalNoDB) && $globalNoDB === TRUE) {
12 12
 			$this->db = null;
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 					if ($user === null && $pass === null) {
17 17
 						$this->createDBConnection();
18 18
 					} else {
19
-						$this->createDBConnection(null,$user,$pass);
19
+						$this->createDBConnection(null, $user, $pass);
20 20
 					}
21 21
 				} else {
22 22
 					$this->createDBConnection($dbname);
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 		while (true) {
101 101
 			try {
102 102
 				if ($globalDBSdriver == 'mysql') {
103
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser,  $globalDBSpass);
103
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass);
104 104
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
105 105
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
106
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
107
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
108
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
109
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
110
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
106
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
107
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500);
108
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
109
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
110
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
111 111
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
112 112
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
113 113
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -117,19 +117,19 @@  discard block
 block discarded – undo
117 117
 					$this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"');
118 118
 					//$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"');
119 119
 				} else {
120
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser,  $globalDBSpass);
120
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass);
121 121
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
122 122
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
123
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
124
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
125
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
126
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
127
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
123
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
124
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200);
125
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
126
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
127
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
128 128
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
129 129
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
130 130
 				}
131 131
 				break;
132
-			} catch(PDOException $e) {
132
+			} catch (PDOException $e) {
133 133
 				$i++;
134 134
 				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
135 135
 				//exit;
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 		try {
155 155
 			//$Connection = new Connection();
156 156
 			$results = $this->db->query($query);
157
-		} catch(PDOException $e) {
157
+		} catch (PDOException $e) {
158 158
 			return false;
159 159
 		}
160
-		if($results->rowCount()>0) {
160
+		if ($results->rowCount() > 0) {
161 161
 		    return true; 
162 162
 		}
163 163
 		else return false;
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 			     return false;
180 180
 			}
181 181
 			
182
-		} catch(PDOException $e) {
183
-			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
182
+		} catch (PDOException $e) {
183
+			if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
184 184
             			throw $e;
185 185
 	                }
186 186
 	                //echo 'error ! '.$e->getMessage();
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	/*
193 193
 	* Check if index exist
194 194
 	*/
195
-	public function indexExists($table,$index)
195
+	public function indexExists($table, $index)
196 196
 	{
197 197
 		global $globalDBdriver, $globalDBname;
198 198
 		if ($globalDBdriver == 'mysql') {
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 		try {
204 204
 			//$Connection = new Connection();
205 205
 			$results = $this->db->query($query);
206
-		} catch(PDOException $e) {
206
+		} catch (PDOException $e) {
207 207
 			return false;
208 208
 		}
209 209
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
210
-		if($nb[0]['nb'] > 0) {
210
+		if ($nb[0]['nb'] > 0) {
211 211
 			return true; 
212 212
 		}
213 213
 		else return false;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		$query = "SELECT * FROM ".$table." LIMIT 0";
223 223
 		try {
224 224
 			$results = $this->db->query($query);
225
-		} catch(PDOException $e) {
225
+		} catch (PDOException $e) {
226 226
 			return "error : ".$e->getMessage()."\n";
227 227
 		}
228 228
 		$columns = array();
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		return $columns;
235 235
 	}
236 236
 
237
-	public function getColumnType($table,$column) {
237
+	public function getColumnType($table, $column) {
238 238
 		$select = $this->db->query('SELECT '.$column.' FROM '.$table);
239 239
 		$tomet = $select->getColumnMeta(0);
240 240
 		return $tomet['native_type'];
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	* Check if a column name exist in a table
245 245
 	* @return Boolean column exist or not
246 246
 	*/
247
-	public function checkColumnName($table,$name)
247
+	public function checkColumnName($table, $name)
248 248
 	{
249 249
 		global $globalDBdriver, $globalDBname;
250 250
 		if ($globalDBdriver == 'mysql') {
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 		}
255 255
 			try {
256 256
 				$sth = $this->db()->prepare($query);
257
-				$sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name));
258
-			} catch(PDOException $e) {
257
+				$sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name));
258
+			} catch (PDOException $e) {
259 259
 				echo "error : ".$e->getMessage()."\n";
260 260
 			}
261 261
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 				try {
295 295
 					$sth = $this->db->prepare($query);
296 296
 					$sth->execute();
297
-				} catch(PDOException $e) {
297
+				} catch (PDOException $e) {
298 298
 					return "error : ".$e->getMessage()."\n";
299 299
 				}
300 300
 				$result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.AIS.php 1 patch
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -117,31 +117,31 @@  discard block
 block discarded – undo
117 117
 
118 118
 	private function make_latf($temp) { // unsigned long 
119 119
 		$flat = 0.0; // float
120
-		$temp = $temp & 0x07FFFFFF;
121
-		if ($temp & 0x04000000) {
122
-			$temp = $temp ^ 0x07FFFFFF;
120
+		$temp = $temp&0x07FFFFFF;
121
+		if ($temp&0x04000000) {
122
+			$temp = $temp^0x07FFFFFF;
123 123
 			$temp += 1;
124
-			$flat = (float)($temp / (60.0 * 10000.0));
124
+			$flat = (float) ($temp/(60.0*10000.0));
125 125
 			$flat *= -1.0;
126
-		} else $flat = (float)($temp / (60.0 * 10000.0));
126
+		} else $flat = (float) ($temp/(60.0*10000.0));
127 127
 		return $flat; // float
128 128
 	}
129 129
 
130 130
 	private function make_lonf($temp) { // unsigned long
131 131
 		$flon = 0.0; // float
132
-		$temp = $temp & 0x0FFFFFFF;
133
-		if ($temp & 0x08000000) {
134
-			$temp = $temp ^ 0x0FFFFFFF;
132
+		$temp = $temp&0x0FFFFFFF;
133
+		if ($temp&0x08000000) {
134
+			$temp = $temp^0x0FFFFFFF;
135 135
 			$temp += 1;
136
-			$flon = (float)($temp / (60.0 * 10000.0));
136
+			$flon = (float) ($temp/(60.0*10000.0));
137 137
 			$flon *= -1.0;
138
-		} else $flon = (float)($temp / (60.0 * 10000.0));
138
+		} else $flon = (float) ($temp/(60.0*10000.0));
139 139
 		return $flon;
140 140
 	}
141 141
 
142 142
 	private function ascii_2_dec($chr) {
143
-		$dec=ord($chr);//get decimal ascii code
144
-		$hex=dechex($dec);//convert decimal to hex
143
+		$dec = ord($chr); //get decimal ascii code
144
+		$hex = dechex($dec); //convert decimal to hex
145 145
 		return ($dec);
146 146
 	}
147 147
 	
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
 		//only process in the following range: 48-87, 96-119
161 161
 		if ($ascii < 48) { }
162 162
 		else {
163
-			if($ascii>119) { }
163
+			if ($ascii > 119) { }
164 164
 			else {
165
-				if ($ascii>87 && $ascii<96) ;
165
+				if ($ascii > 87 && $ascii < 96);
166 166
 				else {
167
-					$ascii=$ascii+40;
168
-					if ($ascii>128){
169
-						$ascii=$ascii+32;
167
+					$ascii = $ascii + 40;
168
+					if ($ascii > 128) {
169
+						$ascii = $ascii + 32;
170 170
 					} else {
171
-						$ascii=$ascii+40;
171
+						$ascii = $ascii + 40;
172 172
 					}
173 173
 				}
174 174
 			}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	}
178 178
 
179 179
 	private function dec_2_6bit($dec) {
180
-		$bin=decbin($dec);
180
+		$bin = decbin($dec);
181 181
 		return(substr($bin, -6)); 
182 182
 	}
183 183
 
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 		);
196 196
 		// "
197 197
 		$rv = '';
198
-		if ($_size % 6 == 0) {
199
-			$len = $_size / 6;
200
-			for ($i=0; $i<$len; $i++) {
201
-				$offset = $i * 6;
202
-				$rv .= $ais_chars[ bindec(substr($_str,$_start + $offset,6)) ];
198
+		if ($_size%6 == 0) {
199
+			$len = $_size/6;
200
+			for ($i = 0; $i < $len; $i++) {
201
+				$offset = $i*6;
202
+				$rv .= $ais_chars[bindec(substr($_str, $_start + $offset, 6))];
203 203
 			}
204 204
 		}
205 205
 		return $rv;
@@ -226,93 +226,93 @@  discard block
 block discarded – undo
226 226
 		$ro->eta_hour = '';
227 227
 		$ro->eta_minute = '';
228 228
 		$ro->ts = time();
229
-		$ro->id = bindec(substr($_aisdata,0,6));
230
-		$ro->mmsi = bindec(substr($_aisdata,8,30));
229
+		$ro->id = bindec(substr($_aisdata, 0, 6));
230
+		$ro->mmsi = bindec(substr($_aisdata, 8, 30));
231 231
 		if ($ro->id >= 1 && $ro->id <= 3) {
232
-			$ro->cog = bindec(substr($_aisdata,116,12))/10;
233
-			$ro->sog = bindec(substr($_aisdata,50,10))/10;
234
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28)));
235
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27)));
232
+			$ro->cog = bindec(substr($_aisdata, 116, 12))/10;
233
+			$ro->sog = bindec(substr($_aisdata, 50, 10))/10;
234
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28)));
235
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27)));
236 236
 			$ro->cls = 1; // class A
237 237
 		} else if ($ro->id == 4) {
238
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,79,28)));
239
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,107,27)));
238
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 79, 28)));
239
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 107, 27)));
240 240
 			$ro->cls = 1; // class A
241 241
 		} else if ($ro->id == 5) {
242
-			$ro->imo = bindec(substr($_aisdata,40,30));
243
-			$ro->callsign = $this->binchar($_aisdata,70,42);
244
-			$ro->name = $this->binchar($_aisdata,112,120);
245
-			$ro->typeid = bindec(substr($_aisdata,232,8));
242
+			$ro->imo = bindec(substr($_aisdata, 40, 30));
243
+			$ro->callsign = $this->binchar($_aisdata, 70, 42);
244
+			$ro->name = $this->binchar($_aisdata, 112, 120);
245
+			$ro->typeid = bindec(substr($_aisdata, 232, 8));
246 246
 			$ro->type = $this->getShipType($ro->typeid);
247 247
 			//$ro->to_bow = bindec(substr($_aisdata,240,9));
248 248
 			//$ro->to_stern = bindec(substr($_aisdata,249,9));
249 249
 			//$ro->to_port = bindec(substr($_aisdata,258,6));
250 250
 			//$ro->to_starboard = bindec(substr($_aisdata,264,6));
251
-			$ro->eta_month = bindec(substr($_aisdata,274,4));
252
-			$ro->eta_day = bindec(substr($_aisdata,278,5));
253
-			$ro->eta_hour = bindec(substr($_aisdata,283,5));
254
-			$ro->eta_minute = bindec(substr($_aisdata,288,6));
251
+			$ro->eta_month = bindec(substr($_aisdata, 274, 4));
252
+			$ro->eta_day = bindec(substr($_aisdata, 278, 5));
253
+			$ro->eta_hour = bindec(substr($_aisdata, 283, 5));
254
+			$ro->eta_minute = bindec(substr($_aisdata, 288, 6));
255 255
 			//$ro->draught = bindec(substr($_aisdata,294,8));
256
-			$ro->destination = $this->binchar($_aisdata,302,120);
256
+			$ro->destination = $this->binchar($_aisdata, 302, 120);
257 257
 			$ro->cls = 1; // class A
258 258
 		} else if ($ro->id == 9) {
259 259
 			// Search and Rescue aircraft position report
260 260
 		} else if ($ro->id == 18) {
261
-			$ro->cog = bindec(substr($_aisdata,112,12))/10;
262
-			$ro->sog = bindec(substr($_aisdata,46,10))/10;
263
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28)));
264
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27)));
265
-			$ro->heading = bindec(substr($_aisdata,124,9));
261
+			$ro->cog = bindec(substr($_aisdata, 112, 12))/10;
262
+			$ro->sog = bindec(substr($_aisdata, 46, 10))/10;
263
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 57, 28)));
264
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 85, 27)));
265
+			$ro->heading = bindec(substr($_aisdata, 124, 9));
266 266
 			if ($ro->heading == 511) $ro->heading = '';
267 267
 			$ro->cls = 2; // class B
268 268
 		} else if ($ro->id == 19) {
269
-			$ro->cog = bindec(substr($_aisdata,112,12))/10;
270
-			$ro->sog = bindec(substr($_aisdata,46,10))/10;
271
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28)));
272
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27)));
273
-			$ro->name = $this->binchar($_aisdata,143,120);
269
+			$ro->cog = bindec(substr($_aisdata, 112, 12))/10;
270
+			$ro->sog = bindec(substr($_aisdata, 46, 10))/10;
271
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28)));
272
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27)));
273
+			$ro->name = $this->binchar($_aisdata, 143, 120);
274 274
 			$ro->cls = 2; // class B
275
-			$ro->heading = bindec(substr($_aisdata,124,9));
275
+			$ro->heading = bindec(substr($_aisdata, 124, 9));
276 276
 			if ($ro->heading == 511) $ro->heading = '';
277
-			$ro->typeid = bindec(substr($_aisdata,263,8));
277
+			$ro->typeid = bindec(substr($_aisdata, 263, 8));
278 278
 			$ro->type = $this->getShipType($ro->typeid);
279 279
 			//$ro->to_bow = bindec(substr($_aisdata,271,9));
280 280
 			//$ro->to_stern = bindec(substr($_aisdata,280,9));
281 281
 			//$ro->to_port = bindec(substr($_aisdata,289,6));
282 282
 			//$ro->to_starboard = bindec(substr($_aisdata,295,6));
283 283
 		} else if ($ro->id == 21) {
284
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,164,28)));
285
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,192,27)));
286
-			$ro->name = $this->binchar($_aisdata,43,120);
284
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 164, 28)));
285
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 192, 27)));
286
+			$ro->name = $this->binchar($_aisdata, 43, 120);
287 287
 			//$ro->to_bow = bindec(substr($_aisdata,219,9));
288 288
 			//$ro->to_stern = bindec(substr($_aisdata,228,9));
289 289
 			//$ro->to_port = bindec(substr($_aisdata,237,6));
290 290
 			//$ro->to_starboard = bindec(substr($_aisdata,243,6));
291 291
 			$ro->cls = 2; // class B
292 292
 		} else if ($ro->id == 24) {
293
-			$pn = bindec(substr($_aisdata,38,2));
293
+			$pn = bindec(substr($_aisdata, 38, 2));
294 294
 			if ($pn == 0) {
295
-				$ro->name = $this->binchar($_aisdata,40,120);
295
+				$ro->name = $this->binchar($_aisdata, 40, 120);
296 296
 			}
297
-			$ro->typeid = bindec(substr($_aisdata,40,8));
297
+			$ro->typeid = bindec(substr($_aisdata, 40, 8));
298 298
 			$ro->type = $this->getShipType($ro->typeid);
299
-			$ro->callsign = $this->binchar($_aisdata,90,42);
299
+			$ro->callsign = $this->binchar($_aisdata, 90, 42);
300 300
 			//$ro->to_bow = bindec(substr($_aisdata,132,9));
301 301
 			//$ro->to_stern = bindec(substr($_aisdata,141,9));
302 302
 			//$ro->to_port = bindec(substr($_aisdata,150,6));
303 303
 			//$ro->to_starboard = bindec(substr($_aisdata,156,6));
304 304
 			$ro->cls = 2; // class B
305 305
 		} else if ($ro->id == 27) {
306
-			$ro->cog = bindec(substr($_aisdata,85,9));
306
+			$ro->cog = bindec(substr($_aisdata, 85, 9));
307 307
 			if ($ro->cog == 511) $ro->cog = 0.0;
308
-			$ro->sog = bindec(substr($_aisdata,79,6));
308
+			$ro->sog = bindec(substr($_aisdata, 79, 6));
309 309
 			if ($ro->sog == 63) $ro->sog = 0.0;
310
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10);
311
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10);
310
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 44, 18))*10);
311
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 62, 17))*10);
312 312
 			$ro->cls = 1; // class A
313 313
 		
314 314
 		}
315
-		$ro->statusid = bindec(substr($_aisdata,38,4));
315
+		$ro->statusid = bindec(substr($_aisdata, 38, 4));
316 316
 		$ro->status = $this->getStatus($ro->statusid);
317 317
 		return $ro;
318 318
 	}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	}
360 360
 
361 361
 	public function getShipTypeID($type) {
362
-		$typeid = array_search($type,$this->shiptype);
362
+		$typeid = array_search($type, $this->shiptype);
363 363
 		if ($typeid !== FALSE) return $typeid;
364 364
 		else return '';
365 365
 	}
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 	public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) {
368 368
 		global $port; // tcpip port...
369 369
 		static $debug_counter = 0;
370
-		$aisdata168='';//six bit array of ascii characters
370
+		$aisdata168 = ''; //six bit array of ascii characters
371 371
 		$ais_nmea_array = str_split($_itu); // convert to an array
372 372
 		foreach ($ais_nmea_array as $value) {
373 373
 			$dec = $this->ascii_2_dec($value);
374 374
 			$bit8 = $this->asciidec_2_8bit($dec);
375 375
 			$bit6 = $this->dec_2_6bit($bit8);
376 376
 			//echo $value ."-" .$bit6 ."";
377
-			$aisdata168 .=$bit6;
377
+			$aisdata168 .= $bit6;
378 378
 		}
379 379
 		//echo $aisdata168 . "<br/>";
380 380
 		//return $this->decode_ais($aisdata168, $aux);
@@ -397,24 +397,24 @@  discard block
 block discarded – undo
397 397
 		// calculate checksum after ! till *
398 398
 		// assume 1st ! is valid
399 399
 		// find * ensure that it is at correct position
400
-		$end = strrpos ( $rawdata , '*' );
400
+		$end = strrpos($rawdata, '*');
401 401
 		if ($end === FALSE) return -1; // check for NULLS!!!
402
-		$cs = substr( $rawdata, $end + 1 );
403
-		if ( strlen($cs) != 2 ) return -1; // correct cs length
404
-		$dcs = (int)hexdec( $cs );
405
-		for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum
406
-		if ( $chksum == $dcs ) { // NMEA checksum pass
402
+		$cs = substr($rawdata, $end + 1);
403
+		if (strlen($cs) != 2) return -1; // correct cs length
404
+		$dcs = (int) hexdec($cs);
405
+		for ($alias = 1; $alias < $end; $alias++) $chksum ^= ord($rawdata[$alias]); // perform XOR for NMEA checksum
406
+		if ($chksum == $dcs) { // NMEA checksum pass
407 407
 			$pcs = explode(',', $rawdata);
408 408
 			// !AI??? identifier
409 409
 			if (!isset($pcs[1])) {
410 410
 				echo "ERROR,INVALID_DATA ".time()." $rawdata\n";
411 411
 				return -1;
412 412
 			}
413
-			$num_seq = (int)$pcs[1]; // number of sequences
414
-			$seq = (int)$pcs[2]; // get sequence
413
+			$num_seq = (int) $pcs[1]; // number of sequences
414
+			$seq = (int) $pcs[2]; // get sequence
415 415
 			// get msg sequence id
416 416
 			if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1
417
-			else $msg_sid = (int)$pcs[3]; // multipart message
417
+			else $msg_sid = (int) $pcs[3]; // multipart message
418 418
 			$ais_ch = $pcs[4]; // get AIS channel
419 419
 			// message sequence checking
420 420
 			if ($num_seq < 1 || $num_seq > 9) {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 					}
448 448
 				}
449 449
 				$itu = $itu.$pcs[5]; // get itu message
450
-				$filler += (int)$pcs[6][0]; // get filler
450
+				$filler += (int) $pcs[6][0]; // get filler
451 451
 				if ($num_seq == 1 // valid single message
452 452
 				    || $num_seq == $pseq // valid multi-part message
453 453
 				) {
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
 		$cbuf = $cbuf.$ibuf;
470 470
 		$last_pos = 0;
471 471
 		$result = new stdClass();
472
-		while ( ($start = strpos($cbuf,"VDM",$last_pos)) !== FALSE) {
472
+		while (($start = strpos($cbuf, "VDM", $last_pos)) !== FALSE) {
473 473
 		//while ( ($start = strpos($cbuf,"!AI",$last_pos)) !== FALSE) {
474 474
 			//DEBUG echo $cbuf;
475
-			if ( ($end = strpos($cbuf,"\r\n", $start)) !== FALSE) { //TBD need to trim?
475
+			if (($end = strpos($cbuf, "\r\n", $start)) !== FALSE) { //TBD need to trim?
476 476
 				$tst = substr($cbuf, $start - 3, ($end - $start + 3));
477 477
 				//DEBUG echo "[$start $end $tst]\n";
478
-				$result = $this->process_ais_raw( $tst, "" );
478
+				$result = $this->process_ais_raw($tst, "");
479 479
 				$last_pos = $end + 1;
480 480
 			} else break;
481 481
 		}
@@ -487,41 +487,41 @@  discard block
 block discarded – undo
487 487
 	// incoming data from serial or IP comms
488 488
 	public function process_ais_line($cbuf) {
489 489
 		$result = new stdClass();
490
-		$start = strpos($cbuf,"VDM");
490
+		$start = strpos($cbuf, "VDM");
491 491
 		$tst = substr($cbuf, $start - 3);
492
-		$result = $this->process_ais_raw( $tst, "" );
492
+		$result = $this->process_ais_raw($tst, "");
493 493
 		return $result;
494 494
 	}
495 495
 
496 496
 	/* AIS Encoding
497 497
 	*/
498
-	private function mk_ais_lat( $lat ) {
498
+	private function mk_ais_lat($lat) {
499 499
 		//$lat = 1.2569;
500
-		if ($lat<0.0) {
500
+		if ($lat < 0.0) {
501 501
 			$lat = -$lat;
502
-			$neg=true;
503
-		} else $neg=false;
502
+			$neg = true;
503
+		} else $neg = false;
504 504
 		$latd = 0x00000000;
505
-		$latd = intval ($lat * 600000.0);
506
-		if ($neg==true) {
505
+		$latd = intval($lat*600000.0);
506
+		if ($neg == true) {
507 507
 			$latd = ~$latd;
508
-			$latd+=1;
508
+			$latd += 1;
509 509
 			$latd &= 0x07FFFFFF;
510 510
 		}
511 511
 		return $latd;
512 512
 	}
513 513
 
514
-	private function mk_ais_lon( $lon ) {
514
+	private function mk_ais_lon($lon) {
515 515
 		//$lon = 103.851;
516
-		if ($lon<0.0) {
516
+		if ($lon < 0.0) {
517 517
 			$lon = -$lon;
518
-			$neg=true;
519
-		} else $neg=false;
518
+			$neg = true;
519
+		} else $neg = false;
520 520
 		$lond = 0x00000000;
521
-		$lond = intval ($lon * 600000.0);
522
-		if ($neg==true) {
521
+		$lond = intval($lon*600000.0);
522
+		if ($neg == true) {
523 523
 			$lond = ~$lond;
524
-			$lond+=1;
524
+			$lond += 1;
525 525
 			$lond &= 0x0FFFFFFF;
526 526
 		}
527 527
 		return $lond;
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 
530 530
 	private function char2bin($name, $max_len) {
531 531
 		$len = strlen($name);
532
-		if ($len > $max_len) $name = substr($name,0,$max_len);
533
-		if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6);
532
+		if ($len > $max_len) $name = substr($name, 0, $max_len);
533
+		if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len)*6);
534 534
 		else $pad = '';
535 535
 		$rv = '';
536 536
 		$ais_chars = array(
@@ -547,26 +547,26 @@  discard block
 block discarded – undo
547 547
 		if ($_a) foreach ($_a as $_1) {
548 548
 			if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1];
549 549
 			else $dec = 0;
550
-			$bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT);
550
+			$bin = str_pad(decbin($dec), 6, '0', STR_PAD_LEFT);
551 551
 			$rv .= $bin;
552 552
 			//echo "$_1 $dec ($bin)<br/>";
553 553
 		}
554 554
 		return $rv.$pad;
555 555
 	}
556 556
 
557
-	private function mk_ais($_enc, $_part=1,$_total=1,$_seq='',$_ch='A') {
557
+	private function mk_ais($_enc, $_part = 1, $_total = 1, $_seq = '', $_ch = 'A') {
558 558
 		$len_bit = strlen($_enc);
559
-		$rem6 = $len_bit % 6;
559
+		$rem6 = $len_bit%6;
560 560
 		$pad6_len = 0;
561 561
 		if ($rem6) $pad6_len = 6 - $rem6;
562 562
 		//echo  $pad6_len.'<br>';
563 563
 		$_enc .= str_repeat("0", $pad6_len); // pad the text...
564
-		$len_enc = strlen($_enc) / 6;
564
+		$len_enc = strlen($_enc)/6;
565 565
 		//echo $_enc.' '.$len_enc.'<br/>';
566 566
 		$itu = '';
567
-		for ($i=0; $i<$len_enc; $i++) {
568
-			$offset = $i * 6;
569
-			$dec = bindec(substr($_enc,$offset,6));
567
+		for ($i = 0; $i < $len_enc; $i++) {
568
+			$offset = $i*6;
569
+			$dec = bindec(substr($_enc, $offset, 6));
570 570
 			if ($dec < 40) $dec += 48;
571 571
 			else $dec += 56;
572 572
 			//echo chr($dec)." $dec<br/>";
@@ -576,15 +576,15 @@  discard block
 block discarded – undo
576 576
 		$chksum = 0;
577 577
 		$itu = "AIVDM,$_part,$_total,$_seq,$_ch,".$itu.",0";
578 578
 		$len_itu = strlen($itu);
579
-		for ($i=0; $i<$len_itu; $i++) {
580
-			$chksum ^= ord( $itu[$i] );
579
+		for ($i = 0; $i < $len_itu; $i++) {
580
+			$chksum ^= ord($itu[$i]);
581 581
 		}
582
-		$hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
583
-		$lsb = $chksum & 0x0F;
584
-		if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb];
582
+		$hex_arr = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
583
+		$lsb = $chksum&0x0F;
584
+		if ($lsb >= 0 && $lsb <= 15) $lsbc = $hex_arr[$lsb];
585 585
 		else $lsbc = '0';
586
-		$msb = (($chksum & 0xF0) >> 4) & 0x0F;
587
-		if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb];
586
+		$msb = (($chksum&0xF0) >> 4)&0x0F;
587
+		if ($msb >= 0 && $msb <= 15) $msbc = $hex_arr[$msb];
588 588
 		else $msbc = '0';
589 589
 		$itu = '!'.$itu."*{$msbc}{$lsbc}\r\n";
590 590
 		return $itu;
@@ -610,14 +610,14 @@  discard block
 block discarded – undo
610 610
 
611 611
 	public function mmsitype($mmsi) {
612 612
 		if (strlen($mmsi) == 9) {
613
-			if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
614
-			elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device';
615
-			elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)';
616
-			elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft';
617
-			elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship';
618
-			elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation';
619
-			elseif (substr($mmsi,0,2) == '00') return 'Coastal stations';
620
-			elseif (substr($mmsi,0,1) == '0') return 'Group of ships';
613
+			if (substr($mmsi, 0, 3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
614
+			elseif (substr($mmsi, 0, 3) == '972') return 'MOB (Man Overboard) device';
615
+			elseif (substr($mmsi, 0, 3) == '970') return 'AIS SART (Search and Rescue Transmitter)';
616
+			elseif (substr($mmsi, 0, 3) == '111') return 'SAR (Search and Rescue) aircraft';
617
+			elseif (substr($mmsi, 0, 2) == '98') return 'Auxiliary craft associated with a parent ship';
618
+			elseif (substr($mmsi, 0, 2) == '99') return 'Aids to Navigation';
619
+			elseif (substr($mmsi, 0, 2) == '00') return 'Coastal stations';
620
+			elseif (substr($mmsi, 0, 1) == '0') return 'Group of ships';
621 621
 			else return 'Ship';
622 622
 		}
623 623
 
@@ -627,19 +627,19 @@  discard block
 block discarded – undo
627 627
 	public function parse_line($buffer) {
628 628
 		global $globalDebug;
629 629
 		$result = array();
630
-		$start = strpos($buffer,"VDM");
630
+		$start = strpos($buffer, "VDM");
631 631
 		$tst = substr($buffer, $start - 3);
632
-		$data = $this->process_ais_raw( $tst, "" );
632
+		$data = $this->process_ais_raw($tst, "");
633 633
 		if (!is_object($data)) {
634 634
 			//if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n";
635 635
 			return array();
636 636
 		}
637 637
 		if ($data->lon != 0) $result['longitude'] = $data->lon;
638 638
 		if ($data->lat != 0) $result['latitude'] = $data->lat;
639
-		$result['ident'] = trim(str_replace('@','',$data->name));
639
+		$result['ident'] = trim(str_replace('@', '', $data->name));
640 640
 		$result['timestamp'] = $data->ts;
641 641
 		$result['mmsi'] = $data->mmsi;
642
-		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi'];
642
+		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'], 0, 3) == '669') $result['mmsi'] = '3'.$result['mmsi'];
643 643
 		$result['mmsi_type'] = $this->mmsitype($result['mmsi']);
644 644
 		if ($data->sog != -1.0) $result['speed'] = $data->sog;
645 645
 		if ($data->heading !== '') $result['heading'] = $data->heading;
@@ -649,16 +649,16 @@  discard block
 block discarded – undo
649 649
 		if ($data->type !== '') $result['type'] = $data->type;
650 650
 		if ($data->typeid !== '') $result['typeid'] = $data->typeid;
651 651
 		if ($data->imo !== '') $result['imo'] = $data->imo;
652
-		if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign));
652
+		if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@', '', $data->callsign));
653 653
 		if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') {
654
-			$eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
654
+			$eta_ts = strtotime(date('Y').'-'.sprintf("%02d", $data->eta_month).'-'.sprintf("%02d", $data->eta_day).' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00');
655 655
 			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
656 656
 		} elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) {
657
-			$eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
657
+			$eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00');
658 658
 			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
659 659
 		}
660 660
 		if ($data->destination != '') {
661
-			$dest = trim(str_replace('@','',$data->destination));
661
+			$dest = trim(str_replace('@', '', $data->destination));
662 662
 			if ($dest != '') $result['destination'] = $dest;
663 663
 		}
664 664
 		$result['all'] = (array) $data;
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Spacing   +616 added lines, -616 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
 		if ($this->db === null) die('Error: No DB connection. (Stats)');
22 22
 	}
23 23
 
24
-	public function addLastStatsUpdate($type,$stats_date) {
24
+	public function addLastStatsUpdate($type, $stats_date) {
25 25
 		$query = "DELETE FROM config WHERE name = :type;
26 26
 			    INSERT INTO config (name,value) VALUES (:type,:stats_date);";
27
-		$query_values = array('type' => $type,':stats_date' => $stats_date);
27
+		$query_values = array('type' => $type, ':stats_date' => $stats_date);
28 28
 		try {
29 29
 			$sth = $this->db->prepare($query);
30 30
 			$sth->execute($query_values);
31
-		} catch(PDOException $e) {
31
+		} catch (PDOException $e) {
32 32
 			return "error : ".$e->getMessage();
33 33
 		}
34 34
 	}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		try {
39 39
 			$sth = $this->db->prepare($query);
40 40
 			$sth->execute(array(':type' => $type));
41
-		} catch(PDOException $e) {
41
+		} catch (PDOException $e) {
42 42
 			echo "error : ".$e->getMessage();
43 43
 		}
44 44
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		try {
60 60
 			$sth = $this->db->prepare($query);
61 61
 			$sth->execute(array(':filter_name' => $filter_name));
62
-		} catch(PDOException $e) {
62
+		} catch (PDOException $e) {
63 63
 			return "error : ".$e->getMessage();
64 64
 		}
65 65
 	}
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 		try {
73 73
 			$sth = $this->db->prepare($query);
74 74
 			$sth->execute();
75
-		} catch(PDOException $e) {
75
+		} catch (PDOException $e) {
76 76
 			return "error : ".$e->getMessage();
77 77
 		}
78 78
 		$query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
79 79
 		try {
80 80
 			$sth = $this->db->prepare($query);
81 81
 			$sth->execute(array(':filter_name' => $filter_name));
82
-		} catch(PDOException $e) {
82
+		} catch (PDOException $e) {
83 83
 			return "error : ".$e->getMessage();
84 84
 		}
85 85
 	}
@@ -91,77 +91,77 @@  discard block
 block discarded – undo
91 91
 		 try {
92 92
 			$sth = $this->db->prepare($query);
93 93
 			$sth->execute(array(':filter_name' => $filter_name));
94
-		} catch(PDOException $e) {
94
+		} catch (PDOException $e) {
95 95
 			echo "error : ".$e->getMessage();
96 96
 		}
97 97
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
98 98
 		if (empty($all)) {
99 99
 			$filters = array();
100 100
 			if ($filter_name != '') {
101
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
101
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
102 102
 			}
103 103
 			$Spotter = new Spotter($this->db);
104
-			$all = $Spotter->getAllAirlineNames('',NULL,$filters);
104
+			$all = $Spotter->getAllAirlineNames('', NULL, $filters);
105 105
 		}
106 106
 		return $all;
107 107
 	}
108
-	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
108
+	public function getAllAircraftTypes($stats_airline = '', $filter_name = '') {
109 109
 		if ($filter_name == '') $filter_name = $this->filter_name;
110 110
 		$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
111 111
 		try {
112 112
 			$sth = $this->db->prepare($query);
113
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
114
-		} catch(PDOException $e) {
113
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
114
+		} catch (PDOException $e) {
115 115
 			echo "error : ".$e->getMessage();
116 116
 		}
117 117
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
118 118
 		return $all;
119 119
 	}
120
-	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
120
+	public function getAllManufacturers($stats_airline = '', $filter_name = '') {
121 121
 		if ($filter_name == '') $filter_name = $this->filter_name;
122 122
 		$query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
123 123
 		try {
124 124
 			$sth = $this->db->prepare($query);
125
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
126
-		} catch(PDOException $e) {
125
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
126
+		} catch (PDOException $e) {
127 127
 			echo "error : ".$e->getMessage();
128 128
 		}
129 129
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
130 130
 		return $all;
131 131
 	}
132
-	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
132
+	public function getAllAirportNames($stats_airline = '', $filter_name = '') {
133 133
 		if ($filter_name == '') $filter_name = $this->filter_name;
134 134
 		$query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
135 135
 		try {
136 136
 			$sth = $this->db->prepare($query);
137
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
138
-		} catch(PDOException $e) {
137
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
138
+		} catch (PDOException $e) {
139 139
 			echo "error : ".$e->getMessage();
140 140
 		}
141 141
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
142 142
 		return $all;
143 143
 	}
144 144
 
145
-	public function getAllOwnerNames($stats_airline = '',$filter_name = '') {
145
+	public function getAllOwnerNames($stats_airline = '', $filter_name = '') {
146 146
 		if ($filter_name == '') $filter_name = $this->filter_name;
147 147
 		$query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
148 148
 		try {
149 149
 			$sth = $this->db->prepare($query);
150
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
151
-		} catch(PDOException $e) {
150
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
151
+		} catch (PDOException $e) {
152 152
 			echo "error : ".$e->getMessage();
153 153
 		}
154 154
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
155 155
 		return $all;
156 156
 	}
157 157
 
158
-	public function getAllPilotNames($stats_airline = '',$filter_name = '') {
158
+	public function getAllPilotNames($stats_airline = '', $filter_name = '') {
159 159
 		if ($filter_name == '') $filter_name = $this->filter_name;
160 160
 		$query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
161 161
 		try {
162 162
 			$sth = $this->db->prepare($query);
163
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
164
-		} catch(PDOException $e) {
163
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
164
+		} catch (PDOException $e) {
165 165
 			echo "error : ".$e->getMessage();
166 166
 		}
167 167
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -169,23 +169,23 @@  discard block
 block discarded – undo
169 169
 	}
170 170
 
171 171
 
172
-	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
172
+	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
173 173
 		global $globalStatsFilters;
174 174
 		if ($filter_name == '') $filter_name = $this->filter_name;
175
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
175
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
176 176
 			$Spotter = new Spotter($this->db);
177
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
177
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
178 178
 			$alliance_airlines = array();
179 179
 			foreach ($airlines as $airline) {
180
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
180
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
181 181
 			}
182 182
 			if ($year == '' && $month == '') {
183
-				if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
184
-				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> ''  AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
183
+				if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
184
+				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> ''  AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
185 185
 				try {
186 186
 					$sth = $this->db->prepare($query);
187 187
 					$sth->execute(array(':filter_name' => $filter_name));
188
-				} catch(PDOException $e) {
188
+				} catch (PDOException $e) {
189 189
 					echo "error : ".$e->getMessage();
190 190
 				}
191 191
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -196,29 +196,29 @@  discard block
 block discarded – undo
196 196
 				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
197 197
 				try {
198 198
 					$sth = $this->db->prepare($query);
199
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
200
-				} catch(PDOException $e) {
199
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
200
+				} catch (PDOException $e) {
201 201
 					echo "error : ".$e->getMessage();
202 202
 				}
203 203
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
204 204
 			} else $all = array();
205 205
 		}
206 206
 		if (empty($all)) {
207
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
208
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
207
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
208
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
209 209
 			} else {
210
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
210
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
211 211
 			}
212 212
 			if ($filter_name != '') {
213
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
213
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
214 214
 			}
215 215
 			$Spotter = new Spotter($this->db);
216 216
 			//$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month);
217
-			$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
217
+			$all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters);
218 218
 		}
219 219
 		return $all;
220 220
 	}
221
-	public function countAllMarineTypes($limit = true, $filter_name = '',$year = '', $month = '') {
221
+	public function countAllMarineTypes($limit = true, $filter_name = '', $year = '', $month = '') {
222 222
 		global $globalStatsFilters;
223 223
 		if ($filter_name == '') $filter_name = $this->filter_name;
224 224
 		if ($year == '' && $month == '') {
@@ -227,23 +227,23 @@  discard block
 block discarded – undo
227 227
 			try {
228 228
 				$sth = $this->db->prepare($query);
229 229
 				$sth->execute(array(':filter_name' => $filter_name));
230
-			} catch(PDOException $e) {
230
+			} catch (PDOException $e) {
231 231
 				echo "error : ".$e->getMessage();
232 232
 			}
233 233
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
234 234
 		} else $all = array();
235 235
 		if (empty($all)) {
236
-			$filters = array('year' => $year,'month' => $month);
236
+			$filters = array('year' => $year, 'month' => $month);
237 237
 			if ($filter_name != '') {
238
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
238
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
239 239
 			}
240 240
 			$Marine = new Marine($this->db);
241 241
 			//$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month);
242
-			$all = $Marine->countAllMarineTypes($limit,0,'',$filters);
242
+			$all = $Marine->countAllMarineTypes($limit, 0, '', $filters);
243 243
 		}
244 244
 		return $all;
245 245
 	}
246
-	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
246
+	public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') {
247 247
 		global $globalStatsFilters;
248 248
 		if ($filter_name == '') $filter_name = $this->filter_name;
249 249
 		if ($year == '' && $month == '') {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			try {
253 253
 				$sth = $this->db->prepare($query);
254 254
 				$sth->execute(array(':filter_name' => $filter_name));
255
-			} catch(PDOException $e) {
255
+			} catch (PDOException $e) {
256 256
 				echo "error : ".$e->getMessage();
257 257
 			}
258 258
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -260,32 +260,32 @@  discard block
 block discarded – undo
260 260
 		if (empty($all)) {
261 261
 			$Spotter = new Spotter($this->db);
262 262
 			$filters = array();
263
-			$filters = array('year' => $year,'month' => $month);
263
+			$filters = array('year' => $year, 'month' => $month);
264 264
 			if ($filter_name != '') {
265
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
265
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
266 266
 			}
267 267
 			//$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month);
268
-			$all = $Spotter->countAllAirlineCountries($limit,$filters);
268
+			$all = $Spotter->countAllAirlineCountries($limit, $filters);
269 269
 		}
270 270
 		return $all;
271 271
 	}
272
-	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
272
+	public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
273 273
 		global $globalStatsFilters;
274 274
 		if ($filter_name == '') $filter_name = $this->filter_name;
275
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
275
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
276 276
 			$Spotter = new Spotter($this->db);
277
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
277
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
278 278
 			$alliance_airlines = array();
279 279
 			foreach ($airlines as $airline) {
280
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
280
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
281 281
 			}
282 282
 			if ($year == '' && $month == '') {
283
-				if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
284
-				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
283
+				if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
284
+				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
285 285
 				try {
286 286
 					$sth = $this->db->prepare($query);
287 287
 					$sth->execute(array(':filter_name' => $filter_name));
288
-				} catch(PDOException $e) {
288
+				} catch (PDOException $e) {
289 289
 					echo "error : ".$e->getMessage();
290 290
 				}
291 291
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -296,21 +296,21 @@  discard block
 block discarded – undo
296 296
 				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
297 297
 				try {
298 298
 					$sth = $this->db->prepare($query);
299
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
300
-				} catch(PDOException $e) {
299
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
300
+				} catch (PDOException $e) {
301 301
 					echo "error : ".$e->getMessage();
302 302
 				}
303 303
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
304 304
 			} else $all = array();
305 305
 		}
306 306
 		if (empty($all)) {
307
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
308
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
307
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
308
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
309 309
 			} else {
310
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
310
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
311 311
 			}
312 312
 			if ($filter_name != '') {
313
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
313
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
314 314
 			}
315 315
 			$Spotter = new Spotter($this->db);
316 316
 			//$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month);
@@ -319,23 +319,23 @@  discard block
 block discarded – undo
319 319
 		return $all;
320 320
 	}
321 321
 
322
-	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
322
+	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
323 323
 		global $globalStatsFilters;
324 324
 		if ($filter_name == '') $filter_name = $this->filter_name;
325
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
325
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
326 326
 			$Spotter = new Spotter($this->db);
327
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
327
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
328 328
 			$alliance_airlines = array();
329 329
 			foreach ($airlines as $airline) {
330
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
330
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
331 331
 			}
332 332
 			if ($year == '' && $month == '') {
333
-				if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
334
-				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
333
+				if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
334
+				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
335 335
 				try {
336 336
 					$sth = $this->db->prepare($query);
337 337
 					$sth->execute(array(':filter_name' => $filter_name));
338
-				} catch(PDOException $e) {
338
+				} catch (PDOException $e) {
339 339
 					echo "error : ".$e->getMessage();
340 340
 				}
341 341
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -346,61 +346,61 @@  discard block
 block discarded – undo
346 346
 				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
347 347
 				try {
348 348
 					$sth = $this->db->prepare($query);
349
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
350
-				} catch(PDOException $e) {
349
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
350
+				} catch (PDOException $e) {
351 351
 					echo "error : ".$e->getMessage();
352 352
 				}
353 353
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
354 354
 			} else $all = array();
355 355
 		}
356 356
 		if (empty($all)) {
357
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
358
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
357
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
358
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
359 359
 			} else {
360
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
360
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
361 361
 			}
362 362
 			if ($filter_name != '') {
363
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
363
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
364 364
 			}
365 365
 			$Spotter = new Spotter($this->db);
366 366
 			//$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month);
367
-			$all = $Spotter->countAllArrivalCountries($limit,$filters);
367
+			$all = $Spotter->countAllArrivalCountries($limit, $filters);
368 368
 		}
369 369
 		return $all;
370 370
 	}
371 371
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
372 372
 		global $globalStatsFilters;
373 373
 		if ($filter_name == '') $filter_name = $this->filter_name;
374
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
374
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
375 375
 			$Spotter = new Spotter($this->db);
376
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
376
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
377 377
 			$alliance_airlines = array();
378 378
 			foreach ($airlines as $airline) {
379
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
379
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
380 380
 			}
381
-			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
382
-			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
381
+			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
382
+			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
383 383
 			$query_values = array(':filter_name' => $filter_name);
384 384
 		} else {
385 385
 			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
386 386
 			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
387
-			$query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
387
+			$query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
388 388
 		}
389 389
 		try {
390 390
 			$sth = $this->db->prepare($query);
391 391
 			$sth->execute($query_values);
392
-		} catch(PDOException $e) {
392
+		} catch (PDOException $e) {
393 393
 			echo "error : ".$e->getMessage();
394 394
 		}
395 395
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
396 396
 		if (empty($all)) {
397
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
398
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
397
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
398
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
399 399
 			} else {
400
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
400
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
401 401
 			}
402 402
 			if ($filter_name != '') {
403
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
403
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
404 404
 			}
405 405
 			$Spotter = new Spotter($this->db);
406 406
 			//$all = $Spotter->countAllDepartureCountries($filters,$year,$month);
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 		return $all;
410 410
 	}
411 411
 
412
-	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
412
+	public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') {
413 413
 		global $globalStatsFilters, $globalVATSIM, $globalIVAO;
414 414
 		if ($filter_name == '') $filter_name = $this->filter_name;
415 415
 		if ($year == '' && $month == '') {
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 			if (isset($forsource)) {
419 419
 				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
420 420
 				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC";
421
-				$query_values = array(':filter_name' => $filter_name,':forsource' => $forsource);
421
+				$query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource);
422 422
 			} else {
423 423
 				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
424 424
 				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC";
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			try {
428 428
 				$sth = $this->db->prepare($query);
429 429
 				$sth->execute($query_values);
430
-			} catch(PDOException $e) {
430
+			} catch (PDOException $e) {
431 431
 				echo "error : ".$e->getMessage();
432 432
 			}
433 433
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -435,32 +435,32 @@  discard block
 block discarded – undo
435 435
                 if (empty($all)) {
436 436
 	                $Spotter = new Spotter($this->db);
437 437
             		$filters = array();
438
-			$filters = array('year' => $year,'month' => $month);
438
+			$filters = array('year' => $year, 'month' => $month);
439 439
             		if ($filter_name != '') {
440
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
440
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
441 441
 			}
442 442
 			//$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
443
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
443
+    		        $all = $Spotter->countAllAirlines($limit, 0, '', $filters);
444 444
                 }
445 445
                 return $all;
446 446
 	}
447
-	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
447
+	public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
448 448
 		global $globalStatsFilters;
449 449
 		if ($filter_name == '') $filter_name = $this->filter_name;
450
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
450
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
451 451
 			$Spotter = new Spotter($this->db);
452
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
452
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
453 453
 			$alliance_airlines = array();
454 454
 			foreach ($airlines as $airline) {
455
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
455
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
456 456
 			}
457 457
 			if ($year == '' && $month == '') {
458
-				if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY registration_count DESC LIMIT 10 OFFSET 0";
459
-				else $query = "SELECT s.aircraft_icao, s.cnt AS registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY registration_count DESC";
458
+				if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY registration_count DESC LIMIT 10 OFFSET 0";
459
+				else $query = "SELECT s.aircraft_icao, s.cnt AS registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY registration_count DESC";
460 460
 				try {
461 461
 					$sth = $this->db->prepare($query);
462 462
 					$sth->execute(array(':filter_name' => $filter_name));
463
-				} catch(PDOException $e) {
463
+				} catch (PDOException $e) {
464 464
 					echo "error : ".$e->getMessage();
465 465
 				}
466 466
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -471,45 +471,45 @@  discard block
 block discarded – undo
471 471
 				else $query = "SELECT s.aircraft_icao, s.cnt AS registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY registration_count DESC";
472 472
 				try {
473 473
 					$sth = $this->db->prepare($query);
474
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
475
-				} catch(PDOException $e) {
474
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
475
+				} catch (PDOException $e) {
476 476
 					echo "error : ".$e->getMessage();
477 477
 				}
478 478
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
479 479
 			} else $all = array();
480 480
 		}
481 481
 		if (empty($all)) {
482
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
483
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
482
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
483
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
484 484
 			} else {
485
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
485
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
486 486
 			}
487 487
 			if ($filter_name != '') {
488
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
488
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
489 489
 			}
490 490
 			$Spotter = new Spotter($this->db);
491 491
 			//$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month);
492
-			$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
492
+			$all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters);
493 493
 		}
494 494
 		return $all;
495 495
 	}
496
-	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
496
+	public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
497 497
 		global $globalStatsFilters;
498 498
 		if ($filter_name == '') $filter_name = $this->filter_name;
499
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
499
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
500 500
 			$Spotter = new Spotter($this->db);
501
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
501
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
502 502
 			$alliance_airlines = array();
503 503
 			foreach ($airlines as $airline) {
504
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
504
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
505 505
 			}
506 506
 			if ($year == '' && $month == '') {
507
-				if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
508
-				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
507
+				if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
508
+				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
509 509
 				 try {
510 510
 					$sth = $this->db->prepare($query);
511 511
 					$sth->execute(array(':filter_name' => $filter_name));
512
-				} catch(PDOException $e) {
512
+				} catch (PDOException $e) {
513 513
 					echo "error : ".$e->getMessage();
514 514
 				}
515 515
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -520,46 +520,46 @@  discard block
 block discarded – undo
520 520
 				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
521 521
 				 try {
522 522
 					$sth = $this->db->prepare($query);
523
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
524
-				} catch(PDOException $e) {
523
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
524
+				} catch (PDOException $e) {
525 525
 					echo "error : ".$e->getMessage();
526 526
 				}
527 527
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
528 528
 			} else $all = array();
529 529
 		}
530 530
 		if (empty($all)) {
531
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
532
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
531
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
532
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
533 533
 			} else {
534
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
534
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
535 535
 			}
536 536
 			if ($filter_name != '') {
537
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
537
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
538 538
 			}
539 539
 			$Spotter = new Spotter($this->db);
540 540
 			//$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month);
541
-			$all = $Spotter->countAllCallsigns($limit,0,'',$filters);
541
+			$all = $Spotter->countAllCallsigns($limit, 0, '', $filters);
542 542
 		}
543 543
 		return $all;
544 544
 	}
545
-	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') {
545
+	public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
546 546
 		$Connection = new Connection($this->db);
547 547
 		if ($filter_name == '') $filter_name = $this->filter_name;
548 548
 		if ($Connection->tableExists('countries')) {
549
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
549
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
550 550
 				$Spotter = new Spotter($this->db);
551
-				$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
551
+				$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
552 552
 				if ($year == '' && $month == '') {
553 553
 					$alliance_airlines = array();
554 554
 					foreach ($airlines as $airline) {
555
-						$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
555
+						$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
556 556
 					}
557
-					if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
558
-					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC";
557
+					if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
558
+					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC";
559 559
 					 try {
560 560
 						$sth = $this->db->prepare($query);
561 561
 						$sth->execute(array(':filter_name' => $filter_name));
562
-					} catch(PDOException $e) {
562
+					} catch (PDOException $e) {
563 563
 						echo "error : ".$e->getMessage();
564 564
 					}
565 565
 					$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
 					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
572 572
 					 try {
573 573
 						$sth = $this->db->prepare($query);
574
-						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
575
-					} catch(PDOException $e) {
574
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
575
+					} catch (PDOException $e) {
576 576
 						echo "error : ".$e->getMessage();
577 577
 					}
578 578
 					$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 			return $Spotter->countAllFlightOverCountries($limit);
584 584
 		} else return array();
585 585
 	}
586
-	public function countAllMarineOverCountries($limit = true, $filter_name = '',$year = '',$month = '') {
586
+	public function countAllMarineOverCountries($limit = true, $filter_name = '', $year = '', $month = '') {
587 587
 		$Connection = new Connection($this->db);
588 588
 		if ($filter_name == '') $filter_name = $this->filter_name;
589 589
 		if ($Connection->tableExists('countries')) {
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 				 try {
595 595
 					$sth = $this->db->prepare($query);
596 596
 					$sth->execute(array(':filter_name' => $filter_name));
597
-				} catch(PDOException $e) {
597
+				} catch (PDOException $e) {
598 598
 					echo "error : ".$e->getMessage();
599 599
 				}
600 600
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -602,15 +602,15 @@  discard block
 block discarded – undo
602 602
 			if (empty($all)) {
603 603
 				$filters = array();
604 604
 				if ($filter_name != '') {
605
-					$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
605
+					$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
606 606
 				}
607 607
 				$Marine = new Marine($this->db);
608
-				$all = $Marine->countAllMarineOverCountries($limit,0,'',$filters);
608
+				$all = $Marine->countAllMarineOverCountries($limit, 0, '', $filters);
609 609
 			}
610 610
 			return $all;
611 611
 		} else return array();
612 612
 	}
613
-	public function countAllTrackerOverCountries($limit = true, $filter_name = '',$year = '',$month = '') {
613
+	public function countAllTrackerOverCountries($limit = true, $filter_name = '', $year = '', $month = '') {
614 614
 		$Connection = new Connection($this->db);
615 615
 		if ($filter_name == '') $filter_name = $this->filter_name;
616 616
 		if ($Connection->tableExists('countries')) {
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 				 try {
622 622
 					$sth = $this->db->prepare($query);
623 623
 					$sth->execute(array(':filter_name' => $filter_name));
624
-				} catch(PDOException $e) {
624
+				} catch (PDOException $e) {
625 625
 					echo "error : ".$e->getMessage();
626 626
 				}
627 627
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -630,15 +630,15 @@  discard block
 block discarded – undo
630 630
 			if (empty($all)) {
631 631
 				$filters = array();
632 632
 				if ($filter_name != '') {
633
-					$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
633
+					$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
634 634
 				}
635 635
 				$Tracker = new Tracker($this->db);
636
-				$all = $Tracker->countAllTrackerOverCountries($limit,0,'',$filters);
636
+				$all = $Tracker->countAllTrackerOverCountries($limit, 0, '', $filters);
637 637
 			}
638 638
 			return $all;
639 639
 		} else return array();
640 640
 	}
641
-	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') {
641
+	public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
642 642
 		global $globalStatsFilters;
643 643
 		if ($filter_name == '') $filter_name = $this->filter_name;
644 644
 		if ($year == '' && $month == '') {
@@ -646,41 +646,41 @@  discard block
 block discarded – undo
646 646
 			else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
647 647
 			try {
648 648
 				$sth = $this->db->prepare($query);
649
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
650
-			} catch(PDOException $e) {
649
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
650
+			} catch (PDOException $e) {
651 651
 				echo "error : ".$e->getMessage();
652 652
 			}
653 653
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
654 654
 		} else $all = array();
655 655
 		if (empty($all)) {
656
-			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
656
+			$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
657 657
 			if ($filter_name != '') {
658
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
658
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
659 659
 			}
660 660
 			$Spotter = new Spotter($this->db);
661 661
 			//$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month);
662
-			$all = $Spotter->countAllPilots($limit,0,'',$filters);
662
+			$all = $Spotter->countAllPilots($limit, 0, '', $filters);
663 663
 		}
664 664
 		return $all;
665 665
 	}
666 666
 
667
-	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') {
667
+	public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
668 668
 		global $globalStatsFilters;
669 669
 		if ($filter_name == '') $filter_name = $this->filter_name;
670
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
670
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
671 671
 			$Spotter = new Spotter($this->db);
672
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
672
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
673 673
 			if ($year == '' && $month == '') {
674 674
 				$alliance_airlines = array();
675 675
 				foreach ($airlines as $airline) {
676
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
676
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
677 677
 				}
678
-				if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
679
-				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC";
678
+				if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
679
+				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC";
680 680
 				try {
681 681
 					$sth = $this->db->prepare($query);
682 682
 					$sth->execute(array(':filter_name' => $filter_name));
683
-				} catch(PDOException $e) {
683
+				} catch (PDOException $e) {
684 684
 					echo "error : ".$e->getMessage();
685 685
 				}
686 686
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -691,45 +691,45 @@  discard block
 block discarded – undo
691 691
 				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
692 692
 				try {
693 693
 					$sth = $this->db->prepare($query);
694
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
695
-				} catch(PDOException $e) {
694
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
695
+				} catch (PDOException $e) {
696 696
 					echo "error : ".$e->getMessage();
697 697
 				}
698 698
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
699 699
 			} else $all = array();
700 700
 		}
701 701
 		if (empty($all)) {
702
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
703
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
702
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
703
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
704 704
 			} else {
705
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
705
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
706 706
 			}
707 707
 			if ($filter_name != '') {
708
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
708
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
709 709
 			}
710 710
 			$Spotter = new Spotter($this->db);
711 711
 			//$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month);
712
-			$all = $Spotter->countAllOwners($limit,0,'',$filters);
712
+			$all = $Spotter->countAllOwners($limit, 0, '', $filters);
713 713
 		}
714 714
 		return $all;
715 715
 	}
716
-	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
716
+	public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
717 717
 		global $globalStatsFilters;
718 718
 		if ($filter_name == '') $filter_name = $this->filter_name;
719
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
719
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
720 720
 			$Spotter = new Spotter($this->db);
721
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
721
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
722 722
 			if ($year == '' && $month == '') {
723 723
 				$alliance_airlines = array();
724 724
 				foreach ($airlines as $airline) {
725
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
725
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
726 726
 				}
727
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
728
-				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
727
+				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
728
+				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
729 729
 				try {
730 730
 					$sth = $this->db->prepare($query);
731 731
 					$sth->execute(array(':filter_name' => $filter_name));
732
-				} catch(PDOException $e) {
732
+				} catch (PDOException $e) {
733 733
 					echo "error : ".$e->getMessage();
734 734
 				}
735 735
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -740,27 +740,27 @@  discard block
 block discarded – undo
740 740
 				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
741 741
 				try {
742 742
 					$sth = $this->db->prepare($query);
743
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
744
-				} catch(PDOException $e) {
743
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
744
+				} catch (PDOException $e) {
745 745
 					echo "error : ".$e->getMessage();
746 746
 				}
747 747
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
748 748
 			} else $all = array();
749 749
 		}
750 750
 		if (empty($all)) {
751
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
752
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
751
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
752
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
753 753
 			} else {
754
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
754
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
755 755
 			}
756 756
 			if ($filter_name != '') {
757
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
757
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
758 758
 			}
759 759
 			$Spotter = new Spotter($this->db);
760 760
 //            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month);
761 761
   //      		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month);
762
-			$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
763
-			$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
762
+			$pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters);
763
+			$dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters);
764 764
 			$all = array();
765 765
 			foreach ($pall as $value) {
766 766
 				$icao = $value['airport_departure_icao'];
@@ -776,27 +776,27 @@  discard block
 block discarded – undo
776 776
 			foreach ($all as $key => $row) {
777 777
 				$count[$key] = $row['airport_departure_icao_count'];
778 778
 			}
779
-			array_multisort($count,SORT_DESC,$all);
779
+			array_multisort($count, SORT_DESC, $all);
780 780
 		}
781 781
 		return $all;
782 782
 	}
783
-	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
783
+	public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
784 784
 		global $globalStatsFilters;
785 785
 		if ($filter_name == '') $filter_name = $this->filter_name;
786
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
786
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
787 787
 			$Spotter = new Spotter($this->db);
788
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
788
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
789 789
 			if ($year == '' && $month == '') {
790 790
 				$alliance_airlines = array();
791 791
 				foreach ($airlines as $airline) {
792
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
792
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
793 793
 				}
794
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
795
-				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
794
+				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
795
+				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
796 796
 				try {
797 797
 					$sth = $this->db->prepare($query);
798 798
 					$sth->execute(array(':filter_name' => $filter_name));
799
-				} catch(PDOException $e) {
799
+				} catch (PDOException $e) {
800 800
 					echo "error : ".$e->getMessage();
801 801
 				}
802 802
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -807,27 +807,27 @@  discard block
 block discarded – undo
807 807
 				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
808 808
 				try {
809 809
 					$sth = $this->db->prepare($query);
810
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
811
-				} catch(PDOException $e) {
810
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
811
+				} catch (PDOException $e) {
812 812
 					echo "error : ".$e->getMessage();
813 813
 				}
814 814
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
815 815
 			} else $all = array();
816 816
 		}
817 817
 		if (empty($all)) {
818
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
819
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
818
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
819
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
820 820
 			} else {
821
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
821
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
822 822
 			}
823 823
 			if ($filter_name != '') {
824
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
824
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
825 825
 			}
826 826
 			$Spotter = new Spotter($this->db);
827 827
 //			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month);
828 828
 //			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month);
829
-			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
830
-			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
829
+			$pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters);
830
+			$dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters);
831 831
 			$all = array();
832 832
 			foreach ($pall as $value) {
833 833
 				$icao = $value['airport_arrival_icao'];
@@ -843,26 +843,26 @@  discard block
 block discarded – undo
843 843
 			foreach ($all as $key => $row) {
844 844
 				$count[$key] = $row['airport_arrival_icao_count'];
845 845
 			}
846
-			array_multisort($count,SORT_DESC,$all);
846
+			array_multisort($count, SORT_DESC, $all);
847 847
 		}
848 848
 		return $all;
849 849
 	}
850
-	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
850
+	public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') {
851 851
 		global $globalDBdriver, $globalStatsFilters;
852 852
 		if ($filter_name == '') $filter_name = $this->filter_name;
853
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
853
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
854 854
 			$Spotter = new Spotter($this->db);
855
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
855
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
856 856
 			$alliance_airlines = array();
857 857
 			foreach ($airlines as $airline) {
858
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
858
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
859 859
 			}
860 860
 			if ($globalDBdriver == 'mysql') {
861
-				if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
862
-				else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
861
+				if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
862
+				else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
863 863
 			} else {
864
-				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
865
-				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
864
+				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
865
+				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
866 866
 			}
867 867
 			$query_data = array(':filter_name' => $filter_name);
868 868
 		} else {
@@ -873,23 +873,23 @@  discard block
 block discarded – undo
873 873
 				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
874 874
 				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
875 875
 			}
876
-			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
876
+			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
877 877
 		}
878 878
 		try {
879 879
 			$sth = $this->db->prepare($query);
880 880
 			$sth->execute($query_data);
881
-		} catch(PDOException $e) {
881
+		} catch (PDOException $e) {
882 882
 			echo "error : ".$e->getMessage();
883 883
 		}
884 884
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
885 885
 		if (empty($all)) {
886
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
887
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
886
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
887
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
888 888
 			} else {
889 889
 				$filters = array('airlines' => array($stats_airline));
890 890
 			}
891 891
 			if ($filter_name != '') {
892
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
892
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
893 893
 			}
894 894
 			$Spotter = new Spotter($this->db);
895 895
 			$all = $Spotter->countAllMonthsLastYear($filters);
@@ -897,57 +897,57 @@  discard block
 block discarded – undo
897 897
 		return $all;
898 898
 	}
899 899
 	
900
-	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
900
+	public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') {
901 901
 		global $globalStatsFilters;
902 902
 		if ($filter_name == '') $filter_name = $this->filter_name;
903
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
903
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
904 904
 			$Spotter = new Spotter($this->db);
905
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
905
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
906 906
 			$alliance_airlines = array();
907 907
 			foreach ($airlines as $airline) {
908
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
908
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
909 909
 			}
910
-			$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline  IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
910
+			$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline  IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
911 911
 			$query_data = array(':filter_name' => $filter_name);
912 912
 		} else {
913 913
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
914
-			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
914
+			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
915 915
 		}
916 916
 		try {
917 917
 			$sth = $this->db->prepare($query);
918 918
 			$sth->execute($query_data);
919
-		} catch(PDOException $e) {
919
+		} catch (PDOException $e) {
920 920
 			echo "error : ".$e->getMessage();
921 921
 		}
922 922
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
923 923
 		if (empty($all)) {
924
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
925
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
924
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
925
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
926 926
 			} else {
927 927
 				$filters = array('airlines' => array($stats_airline));
928 928
 			}
929 929
 			if ($filter_name != '') {
930
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
930
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
931 931
 			}
932 932
 			$Spotter = new Spotter($this->db);
933 933
 			$all = $Spotter->countAllDatesLastMonth($filters);
934 934
 		}
935 935
 		return $all;
936 936
 	}
937
-	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
937
+	public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') {
938 938
 		global $globalDBdriver, $globalStatsFilters;
939 939
 		if ($filter_name == '') $filter_name = $this->filter_name;
940
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
940
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
941 941
 			$Spotter = new Spotter($this->db);
942
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
942
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
943 943
 			$alliance_airlines = array();
944 944
 			foreach ($airlines as $airline) {
945
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
945
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
946 946
 			}
947 947
 			if ($globalDBdriver == 'mysql') {
948
-				$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
948
+				$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
949 949
 			} else {
950
-				$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
950
+				$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
951 951
 			}
952 952
 			$query_data = array(':filter_name' => $filter_name);
953 953
 		} else {
@@ -956,60 +956,60 @@  discard block
 block discarded – undo
956 956
 			} else {
957 957
 				$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
958 958
 			}
959
-			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
959
+			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
960 960
 		}
961 961
 		try {
962 962
 			$sth = $this->db->prepare($query);
963 963
 			$sth->execute($query_data);
964
-		} catch(PDOException $e) {
964
+		} catch (PDOException $e) {
965 965
 			echo "error : ".$e->getMessage();
966 966
 		}
967 967
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
968 968
 		if (empty($all)) {
969
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
970
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
969
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
970
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
971 971
 			} else {
972 972
 				$filters = array('airlines' => array($stats_airline));
973 973
 			}
974 974
 			if ($filter_name != '') {
975
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
975
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
976 976
 			}
977 977
 			$Spotter = new Spotter($this->db);
978 978
 			$all = $Spotter->countAllDatesLast7Days($filters);
979 979
 		}
980 980
 		return $all;
981 981
 	}
982
-	public function countAllDates($stats_airline = '',$filter_name = '') {
982
+	public function countAllDates($stats_airline = '', $filter_name = '') {
983 983
 		global $globalStatsFilters;
984 984
 		if ($filter_name == '') $filter_name = $this->filter_name;
985
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
985
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
986 986
 			$Spotter = new Spotter($this->db);
987
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
987
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
988 988
 			$alliance_airlines = array();
989 989
 			foreach ($airlines as $airline) {
990
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
990
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
991 991
 			}
992
-			$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC";
992
+			$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC";
993 993
 			$query_data = array(':filter_name' => $filter_name);
994 994
 		} else {
995 995
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date_count DESC";
996
-			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
996
+			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
997 997
 		}
998 998
 		try {
999 999
 			$sth = $this->db->prepare($query);
1000 1000
 			$sth->execute($query_data);
1001
-		} catch(PDOException $e) {
1001
+		} catch (PDOException $e) {
1002 1002
 			echo "error : ".$e->getMessage();
1003 1003
 		}
1004 1004
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1005 1005
 		if (empty($all)) {
1006
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1007
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1006
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1007
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1008 1008
 			} else {
1009 1009
 				$filters = array('airlines' => array($stats_airline));
1010 1010
 			}
1011 1011
 			if ($filter_name != '') {
1012
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1012
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1013 1013
 			}
1014 1014
 			$Spotter = new Spotter($this->db);
1015 1015
 			$all = $Spotter->countAllDates($filters);
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 		try {
1025 1025
 			$sth = $this->db->prepare($query);
1026 1026
 			$sth->execute($query_data);
1027
-		} catch(PDOException $e) {
1027
+		} catch (PDOException $e) {
1028 1028
 			echo "error : ".$e->getMessage();
1029 1029
 		}
1030 1030
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 		try {
1047 1047
 			$sth = $this->db->prepare($query);
1048 1048
 			$sth->execute($query_data);
1049
-		} catch(PDOException $e) {
1049
+		} catch (PDOException $e) {
1050 1050
 			echo "error : ".$e->getMessage();
1051 1051
 		}
1052 1052
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1068,34 +1068,34 @@  discard block
 block discarded – undo
1068 1068
 		try {
1069 1069
 			$sth = $this->db->prepare($query);
1070 1070
 			$sth->execute($query_data);
1071
-		} catch(PDOException $e) {
1071
+		} catch (PDOException $e) {
1072 1072
 			echo "error : ".$e->getMessage();
1073 1073
 		}
1074 1074
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1075 1075
 		if (empty($all)) {
1076 1076
 			$filters = array();
1077 1077
 			if ($filter_name != '') {
1078
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1078
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1079 1079
 			}
1080 1080
 			$Spotter = new Spotter($this->db);
1081 1081
 			$all = $Spotter->countAllDatesByAirlines($filters);
1082 1082
 		}
1083 1083
 		return $all;
1084 1084
 	}
1085
-	public function countAllMonths($stats_airline = '',$filter_name = '') {
1085
+	public function countAllMonths($stats_airline = '', $filter_name = '') {
1086 1086
 		global $globalStatsFilters, $globalDBdriver;
1087 1087
 		if ($filter_name == '') $filter_name = $this->filter_name;
1088
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1088
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1089 1089
 			$Spotter = new Spotter($this->db);
1090
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1090
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1091 1091
 			$alliance_airlines = array();
1092 1092
 			foreach ($airlines as $airline) {
1093
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1093
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1094 1094
 			}
1095 1095
 			if ($globalDBdriver == 'mysql') {
1096
-				$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC";
1096
+				$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC";
1097 1097
 			} else {
1098
-				$query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC";
1098
+				$query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC";
1099 1099
 			}
1100 1100
 			$query_data = array(':filter_name' => $filter_name);
1101 1101
 		} else {
@@ -1109,18 +1109,18 @@  discard block
 block discarded – undo
1109 1109
 		try {
1110 1110
 			$sth = $this->db->prepare($query);
1111 1111
 			$sth->execute($query_data);
1112
-		} catch(PDOException $e) {
1112
+		} catch (PDOException $e) {
1113 1113
 			echo "error : ".$e->getMessage();
1114 1114
 		}
1115 1115
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1116 1116
 		if (empty($all)) {
1117
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1118
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1117
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1118
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1119 1119
 			} else {
1120 1120
 				$filters = array('airlines' => array($stats_airline));
1121 1121
 			}
1122 1122
 			if ($filter_name != '') {
1123
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1123
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1124 1124
 			}
1125 1125
 			$Spotter = new Spotter($this->db);
1126 1126
 			$all = $Spotter->countAllMonths($filters);
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 		try {
1138 1138
 			$sth = $this->db->prepare($query);
1139 1139
 			$sth->execute();
1140
-		} catch(PDOException $e) {
1140
+		} catch (PDOException $e) {
1141 1141
 			echo "error : ".$e->getMessage();
1142 1142
 		}
1143 1143
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		try {
1158 1158
 			$sth = $this->db->prepare($query);
1159 1159
 			$sth->execute();
1160
-		} catch(PDOException $e) {
1160
+		} catch (PDOException $e) {
1161 1161
 			echo "error : ".$e->getMessage();
1162 1162
 		}
1163 1163
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1174,32 +1174,32 @@  discard block
 block discarded – undo
1174 1174
 		try {
1175 1175
 			$sth = $this->db->prepare($query);
1176 1176
 			$sth->execute(array(':filter_name' => $filter_name));
1177
-		} catch(PDOException $e) {
1177
+		} catch (PDOException $e) {
1178 1178
 			echo "error : ".$e->getMessage();
1179 1179
 		}
1180 1180
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1181 1181
 		if (empty($all)) {
1182 1182
 			$filters = array();
1183 1183
 			if ($filter_name != '') {
1184
-					$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1184
+					$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1185 1185
 			}
1186 1186
 			$Spotter = new Spotter($this->db);
1187 1187
 			$all = $Spotter->countAllMilitaryMonths($filters);
1188 1188
 		}
1189 1189
 		return $all;
1190 1190
 	}
1191
-	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
1191
+	public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') {
1192 1192
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
1193 1193
 		if ($filter_name == '') $filter_name = $this->filter_name;
1194
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1194
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1195 1195
 			$Spotter = new Spotter($this->db);
1196
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1196
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1197 1197
 			$alliance_airlines = array();
1198 1198
 			foreach ($airlines as $airline) {
1199
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1199
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1200 1200
 			}
1201
-			if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1202
-			else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1201
+			if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1202
+			else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1203 1203
 			$query_data = array(':filter_name' => $filter_name);
1204 1204
 		} else {
1205 1205
 			if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -1217,37 +1217,37 @@  discard block
 block discarded – undo
1217 1217
 		try {
1218 1218
 			$sth = $this->db->prepare($query);
1219 1219
 			$sth->execute($query_data);
1220
-		} catch(PDOException $e) {
1220
+		} catch (PDOException $e) {
1221 1221
 			echo "error : ".$e->getMessage();
1222 1222
 		}
1223 1223
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1224 1224
 		if (empty($all)) {
1225
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1226
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1225
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1226
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1227 1227
 			} else {
1228 1228
 				$filters = array('airlines' => array($stats_airline));
1229 1229
 			}
1230 1230
 			if ($filter_name != '') {
1231
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1231
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1232 1232
 			}
1233 1233
 			$Spotter = new Spotter($this->db);
1234
-			$all = $Spotter->countAllHours($orderby,$filters);
1234
+			$all = $Spotter->countAllHours($orderby, $filters);
1235 1235
 		}
1236 1236
 		return $all;
1237 1237
 	}
1238
-	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
1238
+	public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1239 1239
 		global $globalStatsFilters;
1240 1240
 		if ($filter_name == '') $filter_name = $this->filter_name;
1241 1241
 		if ($year == '') $year = date('Y');
1242
-		$all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month);
1242
+		$all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month);
1243 1243
 		if (empty($all)) {
1244
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1245
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
1244
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1245
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
1246 1246
 			} else {
1247
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1247
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1248 1248
 			}
1249 1249
 			if ($filter_name != '') {
1250
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1250
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1251 1251
 			}
1252 1252
 			$Spotter = new Spotter($this->db);
1253 1253
 			//$all = $Spotter->countOverallFlights($filters,$year,$month);
@@ -1255,15 +1255,15 @@  discard block
 block discarded – undo
1255 1255
 		}
1256 1256
 		return $all;
1257 1257
 	}
1258
-	public function countOverallMarine($filter_name = '',$year = '',$month = '') {
1258
+	public function countOverallMarine($filter_name = '', $year = '', $month = '') {
1259 1259
 		global $globalStatsFilters;
1260 1260
 		if ($filter_name == '') $filter_name = $this->filter_name;
1261 1261
 		if ($year == '') $year = date('Y');
1262
-		$all = $this->getSumStats('marine_bymonth',$year,'',$filter_name,$month);
1262
+		$all = $this->getSumStats('marine_bymonth', $year, '', $filter_name, $month);
1263 1263
 		if (empty($all)) {
1264
-			$filters = array('year' => $year,'month' => $month);
1264
+			$filters = array('year' => $year, 'month' => $month);
1265 1265
 			if ($filter_name != '') {
1266
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1266
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1267 1267
 			}
1268 1268
 			$Marine = new Marine($this->db);
1269 1269
 			//$all = $Spotter->countOverallFlights($filters,$year,$month);
@@ -1271,15 +1271,15 @@  discard block
 block discarded – undo
1271 1271
 		}
1272 1272
 		return $all;
1273 1273
 	}
1274
-	public function countOverallTracker($filter_name = '',$year = '',$month = '') {
1274
+	public function countOverallTracker($filter_name = '', $year = '', $month = '') {
1275 1275
 		global $globalStatsFilters;
1276 1276
 		if ($filter_name == '') $filter_name = $this->filter_name;
1277 1277
 		if ($year == '') $year = date('Y');
1278
-		$all = $this->getSumStats('tracker_bymonth',$year,'',$filter_name,$month);
1278
+		$all = $this->getSumStats('tracker_bymonth', $year, '', $filter_name, $month);
1279 1279
 		if (empty($all)) {
1280
-			$filters = array('year' => $year,'month' => $month);
1280
+			$filters = array('year' => $year, 'month' => $month);
1281 1281
 			if ($filter_name != '') {
1282
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1282
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1283 1283
 			}
1284 1284
 			$Tracker = new Tracker($this->db);
1285 1285
 			//$all = $Spotter->countOverallFlights($filters,$year,$month);
@@ -1287,16 +1287,16 @@  discard block
 block discarded – undo
1287 1287
 		}
1288 1288
 		return $all;
1289 1289
 	}
1290
-	public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') {
1290
+	public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') {
1291 1291
 		global $globalStatsFilters;
1292 1292
 		if ($filter_name == '') $filter_name = $this->filter_name;
1293 1293
 		if ($year == '') $year = date('Y');
1294
-		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
1294
+		$all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month);
1295 1295
 		if (empty($all)) {
1296 1296
 			$filters = array();
1297
-			$filters = array('year' => $year,'month' => $month);
1297
+			$filters = array('year' => $year, 'month' => $month);
1298 1298
 			if ($filter_name != '') {
1299
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1299
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1300 1300
 			}
1301 1301
 			$Spotter = new Spotter($this->db);
1302 1302
 			//$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month);
@@ -1304,19 +1304,19 @@  discard block
 block discarded – undo
1304 1304
 		}
1305 1305
 		return $all;
1306 1306
 	}
1307
-	public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') {
1307
+	public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1308 1308
 		global $globalStatsFilters;
1309 1309
 		if ($filter_name == '') $filter_name = $this->filter_name;
1310 1310
 		if ($year == '') $year = date('Y');
1311
-		$all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month);
1311
+		$all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month);
1312 1312
 		if (empty($all)) {
1313
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1314
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
1313
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1314
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
1315 1315
 			} else {
1316
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1316
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1317 1317
 			}
1318 1318
 			if ($filter_name != '') {
1319
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1319
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1320 1320
 			}
1321 1321
 			$Spotter = new Spotter($this->db);
1322 1322
 			//$all = $Spotter->countOverallArrival($filters,$year,$month);
@@ -1324,48 +1324,48 @@  discard block
 block discarded – undo
1324 1324
 		}
1325 1325
 		return $all;
1326 1326
 	}
1327
-	public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') {
1327
+	public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1328 1328
 		global $globalStatsFilters;
1329 1329
 		if ($filter_name == '') $filter_name = $this->filter_name;
1330
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1330
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1331 1331
 			$Spotter = new Spotter($this->db);
1332
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1332
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1333 1333
 			if ($year == '' && $month == '') {
1334 1334
 				$alliance_airlines = array();
1335 1335
 				foreach ($airlines as $airline) {
1336
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1336
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1337 1337
 				}
1338
-				$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1338
+				$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1339 1339
 				try {
1340 1340
 					$sth = $this->db->prepare($query);
1341 1341
 					$sth->execute(array(':filter_name' => $filter_name));
1342
-				} catch(PDOException $e) {
1342
+				} catch (PDOException $e) {
1343 1343
 					echo "error : ".$e->getMessage();
1344 1344
 				}
1345 1345
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1346 1346
 				$all = $result[0]['nb'];
1347
-			} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1347
+			} else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month);
1348 1348
 		} else {
1349 1349
 			if ($year == '' && $month == '') {
1350 1350
 				$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
1351 1351
 				try {
1352 1352
 					$sth = $this->db->prepare($query);
1353
-					$sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline));
1354
-				} catch(PDOException $e) {
1353
+					$sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline));
1354
+				} catch (PDOException $e) {
1355 1355
 					echo "error : ".$e->getMessage();
1356 1356
 				}
1357 1357
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1358 1358
 				$all = $result[0]['nb'];
1359
-			} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1359
+			} else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month);
1360 1360
 		}
1361 1361
 		if (empty($all)) {
1362
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1363
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
1362
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1363
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
1364 1364
 			} else {
1365
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1365
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1366 1366
 			}
1367 1367
 			if ($filter_name != '') {
1368
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1368
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1369 1369
 			}
1370 1370
 			$Spotter = new Spotter($this->db);
1371 1371
 			//$all = $Spotter->countOverallAircrafts($filters,$year,$month);
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 		}
1374 1374
 		return $all;
1375 1375
 	}
1376
-	public function countOverallAirlines($filter_name = '',$year = '',$month = '') {
1376
+	public function countOverallAirlines($filter_name = '', $year = '', $month = '') {
1377 1377
 		global $globalStatsFilters;
1378 1378
 		if ($filter_name == '') $filter_name = $this->filter_name;
1379 1379
 		if ($year == '' && $month == '') {
@@ -1381,17 +1381,17 @@  discard block
 block discarded – undo
1381 1381
 			try {
1382 1382
 				$sth = $this->db->prepare($query);
1383 1383
 				$sth->execute(array(':filter_name' => $filter_name));
1384
-			} catch(PDOException $e) {
1384
+			} catch (PDOException $e) {
1385 1385
 				echo "error : ".$e->getMessage();
1386 1386
 			}
1387 1387
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1388 1388
 			$all = $result[0]['nb_airline'];
1389
-		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
1389
+		} else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month);
1390 1390
 		if (empty($all)) {
1391 1391
 			$filters = array();
1392
-			$filters = array('year' => $year,'month' => $month);
1392
+			$filters = array('year' => $year, 'month' => $month);
1393 1393
 			if ($filter_name != '') {
1394
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1394
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1395 1395
 			}
1396 1396
 			$Spotter = new Spotter($this->db);
1397 1397
 			//$all = $Spotter->countOverallAirlines($filters,$year,$month);
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 		}
1400 1400
 		return $all;
1401 1401
 	}
1402
-	public function countOverallMarineTypes($filter_name = '',$year = '',$month = '') {
1402
+	public function countOverallMarineTypes($filter_name = '', $year = '', $month = '') {
1403 1403
 		global $globalStatsFilters;
1404 1404
 		if ($filter_name == '') $filter_name = $this->filter_name;
1405 1405
 		$all = array();
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 			try {
1409 1409
 				$sth = $this->db->prepare($query);
1410 1410
 				$sth->execute(array(':filter_name' => $filter_name));
1411
-			} catch(PDOException $e) {
1411
+			} catch (PDOException $e) {
1412 1412
 				echo "error : ".$e->getMessage();
1413 1413
 			}
1414 1414
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1416,9 +1416,9 @@  discard block
 block discarded – undo
1416 1416
 		}
1417 1417
 		if (empty($all)) {
1418 1418
 			$filters = array();
1419
-			$filters = array('year' => $year,'month' => $month);
1419
+			$filters = array('year' => $year, 'month' => $month);
1420 1420
 			if ($filter_name != '') {
1421
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1421
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1422 1422
 			}
1423 1423
 			$Marine = new Marine($this->db);
1424 1424
 			//$all = $Spotter->countOverallAirlines($filters,$year,$month);
@@ -1426,29 +1426,29 @@  discard block
 block discarded – undo
1426 1426
 		}
1427 1427
 		return $all;
1428 1428
 	}
1429
-	public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') {
1429
+	public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1430 1430
 		global $globalStatsFilters;
1431 1431
 		if ($filter_name == '') $filter_name = $this->filter_name;
1432
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1432
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1433 1433
 			$Spotter = new Spotter($this->db);
1434
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1434
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1435 1435
 			if ($year == '' && $month == '') {
1436 1436
 				$alliance_airlines = array();
1437 1437
 				foreach ($airlines as $airline) {
1438
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1438
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1439 1439
 				}
1440
-				$query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1440
+				$query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1441 1441
 				$query_values = array(':filter_name' => $filter_name);
1442 1442
 				try {
1443 1443
 					$sth = $this->db->prepare($query);
1444 1444
 					$sth->execute($query_values);
1445
-				} catch(PDOException $e) {
1445
+				} catch (PDOException $e) {
1446 1446
 					echo "error : ".$e->getMessage();
1447 1447
 				}
1448 1448
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1449 1449
 				$all = $result[0]['nb'];
1450 1450
 			} else {
1451
-				$all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month);
1451
+				$all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month);
1452 1452
 			}
1453 1453
 		} else {
1454 1454
 			if ($year == '' && $month == '') {
@@ -1457,23 +1457,23 @@  discard block
 block discarded – undo
1457 1457
 				try {
1458 1458
 					$sth = $this->db->prepare($query);
1459 1459
 					$sth->execute($query_values);
1460
-				} catch(PDOException $e) {
1460
+				} catch (PDOException $e) {
1461 1461
 					echo "error : ".$e->getMessage();
1462 1462
 				}
1463 1463
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1464 1464
 				$all = $result[0]['nb'];
1465 1465
 			} else {
1466
-				$all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month);
1466
+				$all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month);
1467 1467
 			}
1468 1468
 		}
1469 1469
 		if (empty($all)) {
1470
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1471
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
1470
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1471
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
1472 1472
 			} else {
1473
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1473
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1474 1474
 			}
1475 1475
 			if ($filter_name != '') {
1476
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1476
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1477 1477
 			}
1478 1478
 			$Spotter = new Spotter($this->db);
1479 1479
 			//$all = $Spotter->countOverallOwners($filters,$year,$month);
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 		}
1482 1482
 		return $all;
1483 1483
 	}
1484
-	public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') {
1484
+	public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1485 1485
 		global $globalStatsFilters;
1486 1486
 		if ($filter_name == '') $filter_name = $this->filter_name;
1487 1487
 		//if ($year == '') $year = date('Y');
@@ -1491,18 +1491,18 @@  discard block
 block discarded – undo
1491 1491
 			try {
1492 1492
 				$sth = $this->db->prepare($query);
1493 1493
 				$sth->execute($query_values);
1494
-			} catch(PDOException $e) {
1494
+			} catch (PDOException $e) {
1495 1495
 				echo "error : ".$e->getMessage();
1496 1496
 			}
1497 1497
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1498 1498
 			$all = $result[0]['nb'];
1499 1499
 		} else {
1500
-			$all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month);
1500
+			$all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month);
1501 1501
 		}
1502 1502
 		if (empty($all)) {
1503
-			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1503
+			$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1504 1504
 			if ($filter_name != '') {
1505
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1505
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1506 1506
 			}
1507 1507
 			$Spotter = new Spotter($this->db);
1508 1508
 			//$all = $Spotter->countOverallPilots($filters,$year,$month);
@@ -1511,104 +1511,104 @@  discard block
 block discarded – undo
1511 1511
 		return $all;
1512 1512
 	}
1513 1513
 
1514
-	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
1514
+	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') {
1515 1515
 		if ($filter_name == '') $filter_name = $this->filter_name;
1516
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1516
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1517 1517
 			$Spotter = new Spotter($this->db);
1518
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1518
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1519 1519
 			$alliance_airlines = array();
1520 1520
 			foreach ($airlines as $airline) {
1521
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1521
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1522 1522
 			}
1523
-			$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY date";
1524
-			$query_values = array(':airport_icao' => $airport_icao,':filter_name' => $filter_name);
1523
+			$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY date";
1524
+			$query_values = array(':airport_icao' => $airport_icao, ':filter_name' => $filter_name);
1525 1525
 		} else {
1526 1526
 			$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
1527
-			$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1527
+			$query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1528 1528
 		}
1529 1529
 		try {
1530 1530
 			$sth = $this->db->prepare($query);
1531 1531
 			$sth->execute($query_values);
1532
-		} catch(PDOException $e) {
1532
+		} catch (PDOException $e) {
1533 1533
 			echo "error : ".$e->getMessage();
1534 1534
 		}
1535 1535
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1536 1536
 		return $all;
1537 1537
 	}
1538
-	public function getStats($type,$stats_airline = '', $filter_name = '') {
1538
+	public function getStats($type, $stats_airline = '', $filter_name = '') {
1539 1539
 		if ($filter_name == '') $filter_name = $this->filter_name;
1540 1540
 		$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
1541
-		$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1541
+		$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1542 1542
 		try {
1543 1543
 			$sth = $this->db->prepare($query);
1544 1544
 			$sth->execute($query_values);
1545
-		} catch(PDOException $e) {
1545
+		} catch (PDOException $e) {
1546 1546
 			echo "error : ".$e->getMessage();
1547 1547
 		}
1548 1548
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1549 1549
 		return $all;
1550 1550
 	}
1551
-	public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') {
1551
+	public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') {
1552 1552
 		if ($filter_name == '') $filter_name = $this->filter_name;
1553 1553
 		$query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name";
1554
-		$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1554
+		$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1555 1555
 		try {
1556 1556
 			$sth = $this->db->prepare($query);
1557 1557
 			$sth->execute($query_values);
1558
-		} catch(PDOException $e) {
1558
+		} catch (PDOException $e) {
1559 1559
 			echo "error : ".$e->getMessage();
1560 1560
 		}
1561 1561
 	}
1562
-	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
1562
+	public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') {
1563 1563
 		if ($filter_name == '') $filter_name = $this->filter_name;
1564 1564
 		global $globalArchiveMonths, $globalDBdriver;
1565
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1565
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1566 1566
 			$Spotter = new Spotter($this->db);
1567
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1567
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1568 1568
 			$alliance_airlines = array();
1569 1569
 			foreach ($airlines as $airline) {
1570
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1570
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1571 1571
 			}
1572 1572
 			if ($globalDBdriver == 'mysql') {
1573 1573
 				if ($month == '') {
1574
-					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1574
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1575 1575
 					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name);
1576 1576
 				} else {
1577
-					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1578
-					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month);
1577
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1578
+					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month);
1579 1579
 				}
1580 1580
 			} else {
1581 1581
 				if ($month == '') {
1582
-					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1582
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1583 1583
 					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name);
1584 1584
 				} else {
1585
-					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1586
-					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month);
1585
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1586
+					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month);
1587 1587
 				}
1588 1588
 			}
1589 1589
 		} else {
1590 1590
 			if ($globalDBdriver == 'mysql') {
1591 1591
 				if ($month == '') {
1592 1592
 					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
1593
-					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1593
+					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1594 1594
 				} else {
1595 1595
 					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name";
1596
-					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month);
1596
+					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month);
1597 1597
 				}
1598 1598
 			} else {
1599 1599
 				if ($month == '') {
1600 1600
 					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
1601
-					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1601
+					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1602 1602
 				} else {
1603 1603
 					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name";
1604
-					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month);
1604
+					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month);
1605 1605
 				}
1606 1606
 			}
1607 1607
 		}
1608 1608
 		try {
1609 1609
 			$sth = $this->db->prepare($query);
1610 1610
 			$sth->execute($query_values);
1611
-		} catch(PDOException $e) {
1611
+		} catch (PDOException $e) {
1612 1612
 			echo "error : ".$e->getMessage();
1613 1613
 		}
1614 1614
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1617,17 +1617,17 @@  discard block
 block discarded – undo
1617 1617
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
1618 1618
 		global $globalArchiveMonths, $globalDBdriver;
1619 1619
 		if ($filter_name == '') $filter_name = $this->filter_name;
1620
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1620
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1621 1621
 			$Spotter = new Spotter($this->db);
1622
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1622
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1623 1623
 			$alliance_airlines = array();
1624 1624
 			foreach ($airlines as $airline) {
1625
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1625
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1626 1626
 			}
1627 1627
 			if ($globalDBdriver == 'mysql') {
1628
-				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1628
+				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1629 1629
 			} else {
1630
-				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1630
+				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1631 1631
 			}
1632 1632
 			$query_values = array(':type' => $type, ':filter_name' => $filter_name);
1633 1633
 		} else {
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
 		try {
1642 1642
 			$sth = $this->db->prepare($query);
1643 1643
 			$sth->execute($query_values);
1644
-		} catch(PDOException $e) {
1644
+		} catch (PDOException $e) {
1645 1645
 			echo "error : ".$e->getMessage();
1646 1646
 		}
1647 1647
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1650,17 +1650,17 @@  discard block
 block discarded – undo
1650 1650
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
1651 1651
 		global $globalArchiveMonths, $globalDBdriver;
1652 1652
 		if ($filter_name == '') $filter_name = $this->filter_name;
1653
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1653
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1654 1654
 			$Spotter = new Spotter($this->db);
1655
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1655
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1656 1656
 			$alliance_airlines = array();
1657 1657
 			foreach ($airlines as $airline) {
1658
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1658
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1659 1659
 			}
1660 1660
 			if ($globalDBdriver == 'mysql') {
1661
-				$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1661
+				$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1662 1662
 			} else {
1663
-				$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1663
+				$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1664 1664
 			}
1665 1665
 		} else {
1666 1666
 			if ($globalDBdriver == 'mysql') {
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 		try {
1673 1673
 			$sth = $this->db->prepare($query);
1674 1674
 			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
1675
-		} catch(PDOException $e) {
1675
+		} catch (PDOException $e) {
1676 1676
 			echo "error : ".$e->getMessage();
1677 1677
 		}
1678 1678
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 		try {
1690 1690
 			$sth = $this->db->prepare($query);
1691 1691
 			$sth->execute(array(':filter_name' => $filter_name));
1692
-		} catch(PDOException $e) {
1692
+		} catch (PDOException $e) {
1693 1693
 			echo "error : ".$e->getMessage();
1694 1694
 		}
1695 1695
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1706,20 +1706,20 @@  discard block
 block discarded – undo
1706 1706
 		try {
1707 1707
 			$sth = $this->db->prepare($query);
1708 1708
 			$sth->execute(array(':filter_name' => $filter_name));
1709
-		} catch(PDOException $e) {
1709
+		} catch (PDOException $e) {
1710 1710
 			echo "error : ".$e->getMessage();
1711 1711
 		}
1712 1712
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1713 1713
 		return $all[0]['total'];
1714 1714
 	}
1715
-	public function getStatsOwner($owner_name,$filter_name = '') {
1715
+	public function getStatsOwner($owner_name, $filter_name = '') {
1716 1716
 		global $globalArchiveMonths, $globalDBdriver;
1717 1717
 		if ($filter_name == '') $filter_name = $this->filter_name;
1718 1718
 		$query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name";
1719 1719
 		try {
1720 1720
 			$sth = $this->db->prepare($query);
1721
-			$sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name));
1722
-		} catch(PDOException $e) {
1721
+			$sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name));
1722
+		} catch (PDOException $e) {
1723 1723
 			echo "error : ".$e->getMessage();
1724 1724
 		}
1725 1725
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1737,20 +1737,20 @@  discard block
 block discarded – undo
1737 1737
 		try {
1738 1738
 			$sth = $this->db->prepare($query);
1739 1739
 			$sth->execute(array(':filter_name' => $filter_name));
1740
-		} catch(PDOException $e) {
1740
+		} catch (PDOException $e) {
1741 1741
 			echo "error : ".$e->getMessage();
1742 1742
 		}
1743 1743
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1744 1744
 		return $all[0]['total'];
1745 1745
 	}
1746
-	public function getStatsPilot($pilot,$filter_name = '') {
1746
+	public function getStatsPilot($pilot, $filter_name = '') {
1747 1747
 		global $globalArchiveMonths, $globalDBdriver;
1748 1748
 		if ($filter_name == '') $filter_name = $this->filter_name;
1749 1749
 		$query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)";
1750 1750
 		try {
1751 1751
 			$sth = $this->db->prepare($query);
1752
-			$sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot));
1753
-		} catch(PDOException $e) {
1752
+			$sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot));
1753
+		} catch (PDOException $e) {
1754 1754
 			echo "error : ".$e->getMessage();
1755 1755
 		}
1756 1756
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 		else return 0;
1759 1759
 	}
1760 1760
 
1761
-	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1761
+	public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
1762 1762
 		global $globalDBdriver;
1763 1763
 		if ($filter_name == '') $filter_name = $this->filter_name;
1764 1764
 		if ($globalDBdriver == 'mysql') {
@@ -1766,15 +1766,15 @@  discard block
 block discarded – undo
1766 1766
 		} else {
1767 1767
 			$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1768 1768
 		}
1769
-		$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1769
+		$query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1770 1770
 		try {
1771 1771
 			$sth = $this->db->prepare($query);
1772 1772
 			$sth->execute($query_values);
1773
-		} catch(PDOException $e) {
1773
+		} catch (PDOException $e) {
1774 1774
 			return "error : ".$e->getMessage();
1775 1775
 		}
1776 1776
 	}
1777
-	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1777
+	public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
1778 1778
 		global $globalDBdriver;
1779 1779
 		if ($filter_name == '') $filter_name = $this->filter_name;
1780 1780
 		if ($globalDBdriver == 'mysql') {
@@ -1783,11 +1783,11 @@  discard block
 block discarded – undo
1783 1783
 			//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
1784 1784
 			$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1785 1785
 		}
1786
-		$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1786
+		$query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1787 1787
 		try {
1788 1788
 			$sth = $this->db->prepare($query);
1789 1789
 			$sth->execute($query_values);
1790
-		} catch(PDOException $e) {
1790
+		} catch (PDOException $e) {
1791 1791
 			return "error : ".$e->getMessage();
1792 1792
 		}
1793 1793
 	}
@@ -1811,95 +1811,95 @@  discard block
 block discarded – undo
1811 1811
         }
1812 1812
         */
1813 1813
 
1814
-	public function getStatsSource($stats_type,$year = '',$month = '',$day = '') {
1814
+	public function getStatsSource($stats_type, $year = '', $month = '', $day = '') {
1815 1815
 		global $globalDBdriver;
1816 1816
 		$query = "SELECT * FROM stats_source WHERE stats_type = :stats_type";
1817 1817
 		$query_values = array();
1818 1818
 		if ($globalDBdriver == 'mysql') {
1819 1819
 			if ($year != '') {
1820 1820
 				$query .= ' AND YEAR(stats_date) = :year';
1821
-				$query_values = array_merge($query_values,array(':year' => $year));
1821
+				$query_values = array_merge($query_values, array(':year' => $year));
1822 1822
 			}
1823 1823
 			if ($month != '') {
1824 1824
 				$query .= ' AND MONTH(stats_date) = :month';
1825
-				$query_values = array_merge($query_values,array(':month' => $month));
1825
+				$query_values = array_merge($query_values, array(':month' => $month));
1826 1826
 			}
1827 1827
 			if ($day != '') {
1828 1828
 				$query .= ' AND DAY(stats_date) = :day';
1829
-				$query_values = array_merge($query_values,array(':day' => $day));
1829
+				$query_values = array_merge($query_values, array(':day' => $day));
1830 1830
 			}
1831 1831
 		} else {
1832 1832
 			if ($year != '') {
1833 1833
 				$query .= ' AND EXTRACT(YEAR FROM stats_date) = :year';
1834
-				$query_values = array_merge($query_values,array(':year' => $year));
1834
+				$query_values = array_merge($query_values, array(':year' => $year));
1835 1835
 			}
1836 1836
 			if ($month != '') {
1837 1837
 				$query .= ' AND EXTRACT(MONTH FROM stats_date) = :month';
1838
-				$query_values = array_merge($query_values,array(':month' => $month));
1838
+				$query_values = array_merge($query_values, array(':month' => $month));
1839 1839
 			}
1840 1840
 			if ($day != '') {
1841 1841
 				$query .= ' AND EXTRACT(DAY FROM stats_date) = :day';
1842
-				$query_values = array_merge($query_values,array(':day' => $day));
1842
+				$query_values = array_merge($query_values, array(':day' => $day));
1843 1843
 			}
1844 1844
 		}
1845 1845
 		$query .= " ORDER BY source_name";
1846
-		$query_values = array_merge($query_values,array(':stats_type' => $stats_type));
1846
+		$query_values = array_merge($query_values, array(':stats_type' => $stats_type));
1847 1847
 		try {
1848 1848
 			$sth = $this->db->prepare($query);
1849 1849
 			$sth->execute($query_values);
1850
-		} catch(PDOException $e) {
1850
+		} catch (PDOException $e) {
1851 1851
 			echo "error : ".$e->getMessage();
1852 1852
 		}
1853 1853
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1854 1854
 		return $all;
1855 1855
 	}
1856 1856
 
1857
-	public function addStatSource($data,$source_name,$stats_type,$date) {
1857
+	public function addStatSource($data, $source_name, $stats_type, $date) {
1858 1858
 		global $globalDBdriver;
1859 1859
 		if ($globalDBdriver == 'mysql') {
1860 1860
 			$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data";
1861 1861
 		} else {
1862 1862
 			$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; 
1863 1863
 		}
1864
-		$query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
1864
+		$query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type);
1865 1865
 		try {
1866 1866
 			$sth = $this->db->prepare($query);
1867 1867
 			$sth->execute($query_values);
1868
-		} catch(PDOException $e) {
1868
+		} catch (PDOException $e) {
1869 1869
 			return "error : ".$e->getMessage();
1870 1870
 		}
1871 1871
 	}
1872
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
1872
+	public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') {
1873 1873
 		$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
1874
-		$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1874
+		$query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1875 1875
 		try {
1876 1876
 			$sth = $this->db->prepare($query);
1877 1877
 			$sth->execute($query_values);
1878
-		} catch(PDOException $e) {
1878
+		} catch (PDOException $e) {
1879 1879
 			return "error : ".$e->getMessage();
1880 1880
 		}
1881 1881
 	}
1882
-	public function addStatMarine($type,$date_name,$cnt,$filter_name = '') {
1882
+	public function addStatMarine($type, $date_name, $cnt, $filter_name = '') {
1883 1883
 		$query = "INSERT INTO stats_marine (stats_type,marine_date,cnt,filter_name) VALUES (:type,:flight_date,:cnt,:filter_name)";
1884
-		$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt,':filter_name' => $filter_name);
1884
+		$query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1885 1885
 		try {
1886 1886
 			$sth = $this->db->prepare($query);
1887 1887
 			$sth->execute($query_values);
1888
-		} catch(PDOException $e) {
1888
+		} catch (PDOException $e) {
1889 1889
 			return "error : ".$e->getMessage();
1890 1890
 		}
1891 1891
 	}
1892
-	public function addStatTracker($type,$date_name,$cnt,$filter_name = '') {
1892
+	public function addStatTracker($type, $date_name, $cnt, $filter_name = '') {
1893 1893
 		$query = "INSERT INTO stats_tracker (stats_type,tracker_date,cnt,filter_name) VALUES (:type,:flight_date,:cnt,:filter_name)";
1894
-		$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt,':filter_name' => $filter_name);
1894
+		$query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1895 1895
 		try {
1896 1896
 			$sth = $this->db->prepare($query);
1897 1897
 			$sth->execute($query_values);
1898
-		} catch(PDOException $e) {
1898
+		} catch (PDOException $e) {
1899 1899
 			return "error : ".$e->getMessage();
1900 1900
 		}
1901 1901
 	}
1902
-	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) {
1902
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) {
1903 1903
 		global $globalDBdriver;
1904 1904
 		if ($globalDBdriver == 'mysql') {
1905 1905
 			if ($reset) {
@@ -1914,15 +1914,15 @@  discard block
 block discarded – undo
1914 1914
 				$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1915 1915
 			}
1916 1916
 		}
1917
-		$query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1917
+		$query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1918 1918
 		try {
1919 1919
 			$sth = $this->db->prepare($query);
1920 1920
 			$sth->execute($query_values);
1921
-		} catch(PDOException $e) {
1921
+		} catch (PDOException $e) {
1922 1922
 			return "error : ".$e->getMessage();
1923 1923
 		}
1924 1924
 	}
1925
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) {
1925
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) {
1926 1926
 		global $globalDBdriver;
1927 1927
 		if ($globalDBdriver == 'mysql') {
1928 1928
 			if ($reset) {
@@ -1937,15 +1937,15 @@  discard block
 block discarded – undo
1937 1937
 				$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; 
1938 1938
 			}
1939 1939
 		}
1940
-		$query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1940
+		$query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
1941 1941
 		try {
1942 1942
 			$sth = $this->db->prepare($query);
1943 1943
 			$sth->execute($query_values);
1944
-		} catch(PDOException $e) {
1944
+		} catch (PDOException $e) {
1945 1945
 			return "error : ".$e->getMessage();
1946 1946
 		}
1947 1947
 	}
1948
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) {
1948
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) {
1949 1949
 		global $globalDBdriver;
1950 1950
 		if ($globalDBdriver == 'mysql') {
1951 1951
 			if ($reset) {
@@ -1960,15 +1960,15 @@  discard block
 block discarded – undo
1960 1960
 				$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; 
1961 1961
 			}
1962 1962
 		}
1963
-		$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao);
1963
+		$query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao);
1964 1964
 		try {
1965 1965
 			$sth = $this->db->prepare($query);
1966 1966
 			$sth->execute($query_values);
1967
-		} catch(PDOException $e) {
1967
+		} catch (PDOException $e) {
1968 1968
 			return "error : ".$e->getMessage();
1969 1969
 		}
1970 1970
 	}
1971
-	public function addStatCountryMarine($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) {
1971
+	public function addStatCountryMarine($iso2, $iso3, $name, $cnt, $filter_name = '', $reset = false) {
1972 1972
 		global $globalDBdriver;
1973 1973
 		if ($globalDBdriver == 'mysql') {
1974 1974
 			if ($reset) {
@@ -1983,15 +1983,15 @@  discard block
 block discarded – undo
1983 1983
 				$query = "UPDATE stats_marine_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_marine_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_marine_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
1984 1984
 			}
1985 1985
 		}
1986
-		$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1986
+		$query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1987 1987
 		try {
1988 1988
 			$sth = $this->db->prepare($query);
1989 1989
 			$sth->execute($query_values);
1990
-		} catch(PDOException $e) {
1990
+		} catch (PDOException $e) {
1991 1991
 			return "error : ".$e->getMessage();
1992 1992
 		}
1993 1993
 	}
1994
-	public function addStatCountryTracker($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) {
1994
+	public function addStatCountryTracker($iso2, $iso3, $name, $cnt, $filter_name = '', $reset = false) {
1995 1995
 		global $globalDBdriver;
1996 1996
 		if ($globalDBdriver == 'mysql') {
1997 1997
 			if ($reset) {
@@ -2006,15 +2006,15 @@  discard block
 block discarded – undo
2006 2006
 				$query = "UPDATE stats_tracker_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_tracker_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_tracker_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
2007 2007
 			}
2008 2008
 		}
2009
-		$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
2009
+		$query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
2010 2010
 		try {
2011 2011
 			$sth = $this->db->prepare($query);
2012 2012
 			$sth->execute($query_values);
2013
-		} catch(PDOException $e) {
2013
+		} catch (PDOException $e) {
2014 2014
 			return "error : ".$e->getMessage();
2015 2015
 		}
2016 2016
 	}
2017
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
2017
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
2018 2018
 		global $globalDBdriver;
2019 2019
 		if ($globalDBdriver == 'mysql') {
2020 2020
 			if ($reset) {
@@ -2029,15 +2029,15 @@  discard block
 block discarded – undo
2029 2029
 				$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
2030 2030
 			}
2031 2031
 		}
2032
-		$query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
2032
+		$query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
2033 2033
 		try {
2034 2034
 			$sth = $this->db->prepare($query);
2035 2035
 			$sth->execute($query_values);
2036
-		} catch(PDOException $e) {
2036
+		} catch (PDOException $e) {
2037 2037
 			return "error : ".$e->getMessage();
2038 2038
 		}
2039 2039
 	}
2040
-	public function addStatMarineType($type,$type_id,$cnt, $filter_name = '', $reset = false) {
2040
+	public function addStatMarineType($type, $type_id, $cnt, $filter_name = '', $reset = false) {
2041 2041
 		global $globalDBdriver;
2042 2042
 		if ($globalDBdriver == 'mysql') {
2043 2043
 			if ($reset) {
@@ -2052,15 +2052,15 @@  discard block
 block discarded – undo
2052 2052
 				$query = "UPDATE stats_marine_type SET cnt = cnt+:cnt, type = :type, filter_name = :filter_name WHERE type_id = :type_id AND filter_name = :filter_name; INSERT INTO stats_marine_type (type,type_id,cnt,filter_name) SELECT :type,:type_id,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_marine_type WHERE type_id = :type_id AND filter_name = :filter_name);"; 
2053 2053
 			}
2054 2054
 		}
2055
-		$query_values = array(':type' => $type,':type_id' => $type_id,':cnt' => $cnt, ':filter_name' => $filter_name);
2055
+		$query_values = array(':type' => $type, ':type_id' => $type_id, ':cnt' => $cnt, ':filter_name' => $filter_name);
2056 2056
 		try {
2057 2057
 			$sth = $this->db->prepare($query);
2058 2058
 			$sth->execute($query_values);
2059
-		} catch(PDOException $e) {
2059
+		} catch (PDOException $e) {
2060 2060
 			return "error : ".$e->getMessage();
2061 2061
 		}
2062 2062
 	}
2063
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) {
2063
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) {
2064 2064
 		global $globalDBdriver;
2065 2065
 		if ($globalDBdriver == 'mysql') {
2066 2066
 			if ($reset) {
@@ -2075,15 +2075,15 @@  discard block
 block discarded – undo
2075 2075
 				$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; 
2076 2076
 			}
2077 2077
 		}
2078
-		$query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
2078
+		$query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
2079 2079
 		try {
2080 2080
 			$sth = $this->db->prepare($query);
2081 2081
 			$sth->execute($query_values);
2082
-		} catch(PDOException $e) {
2082
+		} catch (PDOException $e) {
2083 2083
 			return "error : ".$e->getMessage();
2084 2084
 		}
2085 2085
 	}
2086
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) {
2086
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) {
2087 2087
 		global $globalDBdriver;
2088 2088
 		if ($globalDBdriver == 'mysql') {
2089 2089
 			if ($reset) {
@@ -2098,15 +2098,15 @@  discard block
 block discarded – undo
2098 2098
 				$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
2099 2099
 			}
2100 2100
 		}
2101
-		$query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
2101
+		$query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
2102 2102
 		try {
2103 2103
 			$sth = $this->db->prepare($query);
2104 2104
 			$sth->execute($query_values);
2105
-		} catch(PDOException $e) {
2105
+		} catch (PDOException $e) {
2106 2106
 			return "error : ".$e->getMessage();
2107 2107
 		}
2108 2108
 	}
2109
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) {
2109
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) {
2110 2110
 		global $globalDBdriver;
2111 2111
 		if ($globalDBdriver == 'mysql') {
2112 2112
 			if ($reset) {
@@ -2121,15 +2121,15 @@  discard block
 block discarded – undo
2121 2121
 				$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; 
2122 2122
 			}
2123 2123
 		}
2124
-		$query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source);
2124
+		$query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source);
2125 2125
 		try {
2126 2126
 			$sth = $this->db->prepare($query);
2127 2127
 			$sth->execute($query_values);
2128
-		} catch(PDOException $e) {
2128
+		} catch (PDOException $e) {
2129 2129
 			return "error : ".$e->getMessage();
2130 2130
 		}
2131 2131
 	}
2132
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) {
2132
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) {
2133 2133
 		global $globalDBdriver;
2134 2134
 		if ($airport_icao != '') {
2135 2135
 			if ($globalDBdriver == 'mysql') {
@@ -2145,16 +2145,16 @@  discard block
 block discarded – undo
2145 2145
 					$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
2146 2146
 				}
2147 2147
 			}
2148
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name);
2148
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
2149 2149
 			try {
2150 2150
 				$sth = $this->db->prepare($query);
2151 2151
 				$sth->execute($query_values);
2152
-			} catch(PDOException $e) {
2152
+			} catch (PDOException $e) {
2153 2153
 				return "error : ".$e->getMessage();
2154 2154
 			}
2155 2155
 		}
2156 2156
 	}
2157
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
2157
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
2158 2158
 		global $globalDBdriver;
2159 2159
 		if ($airport_icao != '') {
2160 2160
 			if ($globalDBdriver == 'mysql') {
@@ -2162,16 +2162,16 @@  discard block
 block discarded – undo
2162 2162
 			} else {
2163 2163
 				$query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
2164 2164
 			}
2165
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
2165
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
2166 2166
 			 try {
2167 2167
 				$sth = $this->db->prepare($query);
2168 2168
 				$sth->execute($query_values);
2169
-			} catch(PDOException $e) {
2169
+			} catch (PDOException $e) {
2170 2170
 				return "error : ".$e->getMessage();
2171 2171
 			}
2172 2172
 		}
2173 2173
 	}
2174
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) {
2174
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) {
2175 2175
 		global $globalDBdriver;
2176 2176
 		if ($airport_icao != '') {
2177 2177
 			if ($globalDBdriver == 'mysql') {
@@ -2187,16 +2187,16 @@  discard block
 block discarded – undo
2187 2187
 					$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
2188 2188
 				}
2189 2189
 			}
2190
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
2190
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
2191 2191
 			try {
2192 2192
 				$sth = $this->db->prepare($query);
2193 2193
 				$sth->execute($query_values);
2194
-			} catch(PDOException $e) {
2194
+			} catch (PDOException $e) {
2195 2195
 				return "error : ".$e->getMessage();
2196 2196
 			}
2197 2197
 		}
2198 2198
 	}
2199
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
2199
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
2200 2200
 		global $globalDBdriver;
2201 2201
 		if ($airport_icao != '') {
2202 2202
 			if ($globalDBdriver == 'mysql') {
@@ -2204,11 +2204,11 @@  discard block
 block discarded – undo
2204 2204
 			} else {
2205 2205
 				$query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
2206 2206
 			}
2207
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
2207
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
2208 2208
 			try {
2209 2209
 				$sth = $this->db->prepare($query);
2210 2210
 				$sth->execute($query_values);
2211
-			} catch(PDOException $e) {
2211
+			} catch (PDOException $e) {
2212 2212
 				return "error : ".$e->getMessage();
2213 2213
 			}
2214 2214
 		}
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
 		try {
2221 2221
 			$sth = $this->db->prepare($query);
2222 2222
 			$sth->execute($query_values);
2223
-		} catch(PDOException $e) {
2223
+		} catch (PDOException $e) {
2224 2224
 			return "error : ".$e->getMessage();
2225 2225
 		}
2226 2226
 	}
@@ -2230,7 +2230,7 @@  discard block
 block discarded – undo
2230 2230
 		try {
2231 2231
 			$sth = $this->db->prepare($query);
2232 2232
 			$sth->execute($query_values);
2233
-		} catch(PDOException $e) {
2233
+		} catch (PDOException $e) {
2234 2234
 			return "error : ".$e->getMessage();
2235 2235
 		}
2236 2236
 	}
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
 		try {
2241 2241
 			$sth = $this->db->prepare($query);
2242 2242
 			$sth->execute($query_values);
2243
-		} catch(PDOException $e) {
2243
+		} catch (PDOException $e) {
2244 2244
 			return "error : ".$e->getMessage();
2245 2245
 		}
2246 2246
 	}
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
 		try {
2251 2251
 			$sth = $this->db->prepare($query);
2252 2252
 			$sth->execute($query_values);
2253
-		} catch(PDOException $e) {
2253
+		} catch (PDOException $e) {
2254 2254
 			return "error : ".$e->getMessage();
2255 2255
 		}
2256 2256
 	}
@@ -2260,13 +2260,13 @@  discard block
 block discarded – undo
2260 2260
 		try {
2261 2261
 			$sth = $this->db->prepare($query);
2262 2262
 			$sth->execute($query_values);
2263
-		} catch(PDOException $e) {
2263
+		} catch (PDOException $e) {
2264 2264
 			return "error : ".$e->getMessage();
2265 2265
 		}
2266 2266
 	}
2267 2267
 
2268 2268
 	public function addOldStats() {
2269
-		global $globalMasterServer, $globalAircraft, $globalMarine, $globalTracker, $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents;
2269
+		global $globalMasterServer, $globalAircraft, $globalMarine, $globalTracker, $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear, $globalAccidents;
2270 2270
 		$Common = new Common();
2271 2271
 		$Connection = new Connection($this->db);
2272 2272
 		date_default_timezone_set('UTC');
@@ -2281,9 +2281,9 @@  discard block
 block discarded – undo
2281 2281
 			$filtername = 'marine';
2282 2282
 			if ($Connection->tableExists('countries')) {
2283 2283
 				if ($globalDebug) echo 'Count all vessels by countries...'."\n";
2284
-				$alldata = $Marine->countAllMarineOverCountries(false,0,$last_update_day);
2284
+				$alldata = $Marine->countAllMarineOverCountries(false, 0, $last_update_day);
2285 2285
 				foreach ($alldata as $number) {
2286
-					echo $this->addStatCountryMarine($number['marine_country_iso2'],$number['marine_country_iso3'],$number['marine_country'],$number['marine_count'],'','',$reset);
2286
+					echo $this->addStatCountryMarine($number['marine_country_iso2'], $number['marine_country_iso3'], $number['marine_country'], $number['marine_count'], '', '', $reset);
2287 2287
 				}
2288 2288
 			}
2289 2289
 			if ($globalDebug) echo 'Count all vessels by months...'."\n";
@@ -2293,44 +2293,44 @@  discard block
 block discarded – undo
2293 2293
 			$lastyear = false;
2294 2294
 			foreach ($alldata as $number) {
2295 2295
 				if ($number['year_name'] != date('Y')) $lastyear = true;
2296
-				$this->addStat('marine_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2296
+				$this->addStat('marine_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2297 2297
 			}
2298 2298
 			echo 'Marine data...'."\n";
2299 2299
 			$this->deleteStatMarine('month');
2300 2300
 			echo '-> countAllDatesLastMonth...'."\n";
2301 2301
 			$alldata = $Marine->countAllDatesLastMonth($filter_last_month);
2302 2302
 			foreach ($alldata as $number) {
2303
-				$this->addStatMarine('month',$number['date_name'],$number['date_count']);
2303
+				$this->addStatMarine('month', $number['date_name'], $number['date_count']);
2304 2304
 			}
2305 2305
 			echo '-> countAllDates...'."\n";
2306 2306
 			$previousdata = $this->countAllDatesMarine();
2307 2307
 			$this->deleteStatMarine('date');
2308
-			$alldata = $Common->array_merge_noappend($previousdata,$Marine->countAllDates($filter_last_month));
2308
+			$alldata = $Common->array_merge_noappend($previousdata, $Marine->countAllDates($filter_last_month));
2309 2309
 			$values = array();
2310 2310
 			foreach ($alldata as $cnt) {
2311 2311
 				$values[] = $cnt['date_count'];
2312 2312
 			}
2313
-			array_multisort($values,SORT_DESC,$alldata);
2314
-			array_splice($alldata,11);
2313
+			array_multisort($values, SORT_DESC, $alldata);
2314
+			array_splice($alldata, 11);
2315 2315
 			foreach ($alldata as $number) {
2316
-				$this->addStatMarine('date',$number['date_name'],$number['date_count']);
2316
+				$this->addStatMarine('date', $number['date_name'], $number['date_count']);
2317 2317
 			}
2318 2318
 			
2319 2319
 			$this->deleteStatMarine('hour');
2320 2320
 			echo '-> countAllHours...'."\n";
2321
-			$alldata = $Marine->countAllHours('hour',$filter_last_month);
2321
+			$alldata = $Marine->countAllHours('hour', $filter_last_month);
2322 2322
 			foreach ($alldata as $number) {
2323
-				$this->addStatMarine('hour',$number['hour_name'],$number['hour_count']);
2323
+				$this->addStatMarine('hour', $number['hour_name'], $number['hour_count']);
2324 2324
 			}
2325 2325
 			if ($globalDebug) echo 'Count all types...'."\n";
2326
-			$alldata = $Marine->countAllMarineTypes(false,0,$last_update_day);
2326
+			$alldata = $Marine->countAllMarineTypes(false, 0, $last_update_day);
2327 2327
 			foreach ($alldata as $number) {
2328
-				$this->addStatMarineType($number['marine_type'],$number['marine_type_id'],$number['marine_type_count'],'',$reset);
2328
+				$this->addStatMarineType($number['marine_type'], $number['marine_type_id'], $number['marine_type_count'], '', $reset);
2329 2329
 			}
2330 2330
 
2331 2331
 			echo 'Insert last stats update date...'."\n";
2332 2332
 			date_default_timezone_set('UTC');
2333
-			$this->addLastStatsUpdate('last_update_stats_marine',date('Y-m-d G:i:s'));
2333
+			$this->addLastStatsUpdate('last_update_stats_marine', date('Y-m-d G:i:s'));
2334 2334
 		}
2335 2335
 		if ((isset($globalTracker) && $globalTracker) || (isset($globalMasterServer) && $globalMasterServer)) {
2336 2336
 			$last_update = $this->getLastStatsUpdate('last_update_stats_tracker');
@@ -2342,9 +2342,9 @@  discard block
 block discarded – undo
2342 2342
 			$Tracker = new Tracker($this->db);
2343 2343
 			if ($Connection->tableExists('countries')) {
2344 2344
 				if ($globalDebug) echo 'Count all trackers by countries...'."\n";
2345
-				$alldata = $Tracker->countAllTrackerOverCountries(false,0,$last_update_day);
2345
+				$alldata = $Tracker->countAllTrackerOverCountries(false, 0, $last_update_day);
2346 2346
 				foreach ($alldata as $number) {
2347
-					$this->addStatCountryTracker($number['tracker_country_iso2'],$number['tracker_country_iso3'],$number['tracker_country'],$number['tracker_count'],'','',$reset);
2347
+					$this->addStatCountryTracker($number['tracker_country_iso2'], $number['tracker_country_iso3'], $number['tracker_country'], $number['tracker_count'], '', '', $reset);
2348 2348
 				}
2349 2349
 			}
2350 2350
 			if ($globalDebug) echo 'Count all vessels by months...'."\n";
@@ -2354,38 +2354,38 @@  discard block
 block discarded – undo
2354 2354
 			$lastyear = false;
2355 2355
 			foreach ($alldata as $number) {
2356 2356
 				if ($number['year_name'] != date('Y')) $lastyear = true;
2357
-				$this->addStat('tracker_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2357
+				$this->addStat('tracker_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2358 2358
 			}
2359 2359
 			echo 'Tracker data...'."\n";
2360 2360
 			$this->deleteStatTracker('month');
2361 2361
 			echo '-> countAllDatesLastMonth...'."\n";
2362 2362
 			$alldata = $Tracker->countAllDatesLastMonth($filter_last_month);
2363 2363
 			foreach ($alldata as $number) {
2364
-				$this->addStatTracker('month',$number['date_name'],$number['date_count']);
2364
+				$this->addStatTracker('month', $number['date_name'], $number['date_count']);
2365 2365
 			}
2366 2366
 			echo '-> countAllDates...'."\n";
2367 2367
 			$previousdata = $this->countAllDatesTracker();
2368 2368
 			$this->deleteStatTracker('date');
2369
-			$alldata = $Common->array_merge_noappend($previousdata,$Tracker->countAllDates($filter_last_month));
2369
+			$alldata = $Common->array_merge_noappend($previousdata, $Tracker->countAllDates($filter_last_month));
2370 2370
 			$values = array();
2371 2371
 			foreach ($alldata as $cnt) {
2372 2372
 				$values[] = $cnt['date_count'];
2373 2373
 			}
2374
-			array_multisort($values,SORT_DESC,$alldata);
2375
-			array_splice($alldata,11);
2374
+			array_multisort($values, SORT_DESC, $alldata);
2375
+			array_splice($alldata, 11);
2376 2376
 			foreach ($alldata as $number) {
2377
-				$this->addStatTracker('date',$number['date_name'],$number['date_count']);
2377
+				$this->addStatTracker('date', $number['date_name'], $number['date_count']);
2378 2378
 			}
2379 2379
 			
2380 2380
 			$this->deleteStatTracker('hour');
2381 2381
 			echo '-> countAllHours...'."\n";
2382
-			$alldata = $Tracker->countAllHours('hour',$filter_last_month);
2382
+			$alldata = $Tracker->countAllHours('hour', $filter_last_month);
2383 2383
 			foreach ($alldata as $number) {
2384
-				$this->addStatTracker('hour',$number['hour_name'],$number['hour_count']);
2384
+				$this->addStatTracker('hour', $number['hour_name'], $number['hour_count']);
2385 2385
 			}
2386 2386
 			echo 'Insert last stats update date...'."\n";
2387 2387
 			date_default_timezone_set('UTC');
2388
-			$this->addLastStatsUpdate('last_update_stats_tracker',date('Y-m-d G:i:s'));
2388
+			$this->addLastStatsUpdate('last_update_stats_tracker', date('Y-m-d G:i:s'));
2389 2389
 		}
2390 2390
 
2391 2391
 		if (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft) || (isset($globalMasterServer) && $globalMasterServer)) {
@@ -2403,41 +2403,41 @@  discard block
 block discarded – undo
2403 2403
 			$Spotter = new Spotter($this->db);
2404 2404
 
2405 2405
 			if ($globalDebug) echo 'Count all aircraft types...'."\n";
2406
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
2406
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
2407 2407
 			foreach ($alldata as $number) {
2408
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset);
2408
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset);
2409 2409
 			}
2410 2410
 			if ($globalDebug) echo 'Count all airlines...'."\n";
2411
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
2411
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
2412 2412
 			foreach ($alldata as $number) {
2413
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset);
2413
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset);
2414 2414
 			}
2415 2415
 			if ($globalDebug) echo 'Count all registrations...'."\n";
2416
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
2416
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
2417 2417
 			foreach ($alldata as $number) {
2418
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset);
2418
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset);
2419 2419
 			}
2420 2420
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
2421
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
2421
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
2422 2422
 			foreach ($alldata as $number) {
2423
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
2423
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset);
2424 2424
 			}
2425 2425
 			if ($globalDebug) echo 'Count all owners...'."\n";
2426
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
2426
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
2427 2427
 			foreach ($alldata as $number) {
2428
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset);
2428
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset);
2429 2429
 			}
2430 2430
 			if ($globalDebug) echo 'Count all pilots...'."\n";
2431
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
2431
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
2432 2432
 			foreach ($alldata as $number) {
2433 2433
 				if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name'];
2434
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset);
2434
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset);
2435 2435
 			}
2436 2436
 			
2437 2437
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
2438
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
2438
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
2439 2439
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
2440
-			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
2440
+			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
2441 2441
 			if ($globalDebug) echo 'Order departure airports...'."\n";
2442 2442
 			$alldata = array();
2443 2443
 			foreach ($pall as $value) {
@@ -2454,14 +2454,14 @@  discard block
 block discarded – undo
2454 2454
 			foreach ($alldata as $key => $row) {
2455 2455
 				$count[$key] = $row['airport_departure_icao_count'];
2456 2456
 			}
2457
-			array_multisort($count,SORT_DESC,$alldata);
2457
+			array_multisort($count, SORT_DESC, $alldata);
2458 2458
 			foreach ($alldata as $number) {
2459
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
2459
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset);
2460 2460
 			}
2461 2461
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
2462
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
2462
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
2463 2463
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
2464
-			$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
2464
+			$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
2465 2465
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
2466 2466
 			$alldata = array();
2467 2467
 			foreach ($pall as $value) {
@@ -2478,18 +2478,18 @@  discard block
 block discarded – undo
2478 2478
 			foreach ($alldata as $key => $row) {
2479 2479
 				$count[$key] = $row['airport_arrival_icao_count'];
2480 2480
 			}
2481
-			array_multisort($count,SORT_DESC,$alldata);
2481
+			array_multisort($count, SORT_DESC, $alldata);
2482 2482
 			foreach ($alldata as $number) {
2483
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
2483
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset);
2484 2484
 			}
2485 2485
 			if ($Connection->tableExists('countries')) {
2486 2486
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
2487 2487
 				//$SpotterArchive = new SpotterArchive();
2488 2488
 				//$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
2489 2489
 				$Spotter = new Spotter($this->db);
2490
-				$alldata = $Spotter->countAllFlightOverCountries(false,0,$last_update_day);
2490
+				$alldata = $Spotter->countAllFlightOverCountries(false, 0, $last_update_day);
2491 2491
 				foreach ($alldata as $number) {
2492
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset);
2492
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset);
2493 2493
 				}
2494 2494
 			}
2495 2495
 			
@@ -2499,12 +2499,12 @@  discard block
 block discarded – undo
2499 2499
 				$this->deleteStatsByType('fatalities_byyear');
2500 2500
 				$alldata = $Accident->countFatalitiesByYear();
2501 2501
 				foreach ($alldata as $number) {
2502
-					$this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year'])));
2502
+					$this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year'])));
2503 2503
 				}
2504 2504
 				$this->deleteStatsByType('fatalities_bymonth');
2505 2505
 				$alldata = $Accident->countFatalitiesLast12Months();
2506 2506
 				foreach ($alldata as $number) {
2507
-					$this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year'])));
2507
+					$this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year'])));
2508 2508
 				}
2509 2509
 			}
2510 2510
 
@@ -2518,37 +2518,37 @@  discard block
 block discarded – undo
2518 2518
 			$lastyear = false;
2519 2519
 			foreach ($alldata as $number) {
2520 2520
 				if ($number['year_name'] != date('Y')) $lastyear = true;
2521
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2521
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2522 2522
 			}
2523 2523
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
2524 2524
 			$alldata = $Spotter->countAllMilitaryMonths($filter_last_month);
2525 2525
 			foreach ($alldata as $number) {
2526
-				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2526
+				$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2527 2527
 			}
2528 2528
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
2529 2529
 			$alldata = $Spotter->countAllMonthsOwners($filter_last_month);
2530 2530
 			foreach ($alldata as $number) {
2531
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2531
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2532 2532
 			}
2533 2533
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
2534 2534
 			$alldata = $Spotter->countAllMonthsPilots($filter_last_month);
2535 2535
 			foreach ($alldata as $number) {
2536
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2536
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2537 2537
 			}
2538 2538
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
2539 2539
 			$alldata = $Spotter->countAllMonthsAirlines($filter_last_month);
2540 2540
 			foreach ($alldata as $number) {
2541
-				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2541
+				$this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2542 2542
 			}
2543 2543
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
2544 2544
 			$alldata = $Spotter->countAllMonthsAircrafts($filter_last_month);
2545 2545
 			foreach ($alldata as $number) {
2546
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2546
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2547 2547
 			}
2548 2548
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
2549 2549
 			$alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month);
2550 2550
 			foreach ($alldata as $number) {
2551
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2551
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2552 2552
 			}
2553 2553
 			if ($globalDebug) echo 'Airports data...'."\n";
2554 2554
 			if ($globalDebug) echo '...Departure'."\n";
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
 			}
2594 2594
 			$alldata = $pall;
2595 2595
 			foreach ($alldata as $number) {
2596
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
2596
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
2597 2597
 			}
2598 2598
 			echo '...Arrival'."\n";
2599 2599
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -2634,7 +2634,7 @@  discard block
 block discarded – undo
2634 2634
 			}
2635 2635
 			$alldata = $pall;
2636 2636
 			foreach ($alldata as $number) {
2637
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
2637
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
2638 2638
 			}
2639 2639
 
2640 2640
 			echo 'Flights data...'."\n";
@@ -2642,28 +2642,28 @@  discard block
 block discarded – undo
2642 2642
 			echo '-> countAllDatesLastMonth...'."\n";
2643 2643
 			$alldata = $Spotter->countAllDatesLastMonth($filter_last_month);
2644 2644
 			foreach ($alldata as $number) {
2645
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
2645
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
2646 2646
 			}
2647 2647
 			echo '-> countAllDates...'."\n";
2648 2648
 			$previousdata = $this->countAllDates();
2649 2649
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
2650 2650
 			$this->deleteStatFlight('date');
2651
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter_last_month));
2651
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter_last_month));
2652 2652
 			$values = array();
2653 2653
 			foreach ($alldata as $cnt) {
2654 2654
 				$values[] = $cnt['date_count'];
2655 2655
 			}
2656
-			array_multisort($values,SORT_DESC,$alldata);
2657
-			array_splice($alldata,11);
2656
+			array_multisort($values, SORT_DESC, $alldata);
2657
+			array_splice($alldata, 11);
2658 2658
 			foreach ($alldata as $number) {
2659
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
2659
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
2660 2660
 			}
2661 2661
 			
2662 2662
 			$this->deleteStatFlight('hour');
2663 2663
 			echo '-> countAllHours...'."\n";
2664
-			$alldata = $Spotter->countAllHours('hour',$filter_last_month);
2664
+			$alldata = $Spotter->countAllHours('hour', $filter_last_month);
2665 2665
 			foreach ($alldata as $number) {
2666
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
2666
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
2667 2667
 			}
2668 2668
 
2669 2669
 			// Count by airlines
@@ -2672,42 +2672,42 @@  discard block
 block discarded – undo
2672 2672
 				if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n";
2673 2673
 				$SpotterArchive = new SpotterArchive($this->db);
2674 2674
 				//$Spotter = new Spotter($this->db);
2675
-				$alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day);
2675
+				$alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day);
2676 2676
 				//$alldata = $Spotter->countAllFlightOverCountriesByAirlines(false,0,$last_update_day);
2677 2677
 				foreach ($alldata as $number) {
2678
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset);
2678
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset);
2679 2679
 				}
2680 2680
 			}
2681 2681
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
2682 2682
 			$Spotter = new Spotter($this->db);
2683
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
2683
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
2684 2684
 			foreach ($alldata as $number) {
2685
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset);
2685
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset);
2686 2686
 			}
2687 2687
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
2688
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
2688
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
2689 2689
 			foreach ($alldata as $number) {
2690
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset);
2690
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset);
2691 2691
 			}
2692 2692
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
2693
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
2693
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
2694 2694
 			foreach ($alldata as $number) {
2695
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
2695
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset);
2696 2696
 			}
2697 2697
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
2698
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
2698
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
2699 2699
 			foreach ($alldata as $number) {
2700
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset);
2700
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset);
2701 2701
 			}
2702 2702
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
2703
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
2703
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
2704 2704
 			foreach ($alldata as $number) {
2705
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset);
2705
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset);
2706 2706
 			}
2707 2707
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
2708
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
2708
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
2709 2709
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
2710
-			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
2710
+			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
2711 2711
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
2712 2712
 			//$alldata = array();
2713 2713
 			foreach ($dall as $value) {
@@ -2727,12 +2727,12 @@  discard block
 block discarded – undo
2727 2727
 			}
2728 2728
 			$alldata = $pall;
2729 2729
 			foreach ($alldata as $number) {
2730
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
2730
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset);
2731 2731
 			}
2732 2732
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
2733
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
2733
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
2734 2734
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
2735
-			$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
2735
+			$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
2736 2736
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
2737 2737
 			//$alldata = array();
2738 2738
 			foreach ($dall as $value) {
@@ -2752,7 +2752,7 @@  discard block
 block discarded – undo
2752 2752
 			}
2753 2753
 			$alldata = $pall;
2754 2754
 			foreach ($alldata as $number) {
2755
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
2755
+				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset);
2756 2756
 			}
2757 2757
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
2758 2758
 			$Spotter = new Spotter($this->db);
@@ -2760,27 +2760,27 @@  discard block
 block discarded – undo
2760 2760
 			$lastyear = false;
2761 2761
 			foreach ($alldata as $number) {
2762 2762
 				if ($number['year_name'] != date('Y')) $lastyear = true;
2763
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2763
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2764 2764
 			}
2765 2765
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
2766 2766
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month);
2767 2767
 			foreach ($alldata as $number) {
2768
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2768
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2769 2769
 			}
2770 2770
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
2771 2771
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month);
2772 2772
 			foreach ($alldata as $number) {
2773
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2773
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2774 2774
 			}
2775 2775
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
2776 2776
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month);
2777 2777
 			foreach ($alldata as $number) {
2778
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2778
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2779 2779
 			}
2780 2780
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
2781 2781
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month);
2782 2782
 			foreach ($alldata as $number) {
2783
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2783
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2784 2784
 			}
2785 2785
 			if ($globalDebug) echo '...Departure'."\n";
2786 2786
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -2803,7 +2803,7 @@  discard block
 block discarded – undo
2803 2803
 			}
2804 2804
 			$alldata = $pall;
2805 2805
 			foreach ($alldata as $number) {
2806
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
2806
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']);
2807 2807
 			}
2808 2808
 			if ($globalDebug) echo '...Arrival'."\n";
2809 2809
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -2826,32 +2826,32 @@  discard block
 block discarded – undo
2826 2826
 			}
2827 2827
 			$alldata = $pall;
2828 2828
 			foreach ($alldata as $number) {
2829
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
2829
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']);
2830 2830
 			}
2831 2831
 
2832 2832
 			if ($globalDebug) echo 'Flights data...'."\n";
2833 2833
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2834 2834
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month);
2835 2835
 			foreach ($alldata as $number) {
2836
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
2836
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
2837 2837
 			}
2838 2838
 			if ($globalDebug) echo '-> countAllDates...'."\n";
2839 2839
 			//$previousdata = $this->countAllDatesByAirlines();
2840
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month));
2840
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines($filter_last_month));
2841 2841
 			$values = array();
2842 2842
 			foreach ($alldata as $cnt) {
2843 2843
 				$values[] = $cnt['date_count'];
2844 2844
 			}
2845
-			array_multisort($values,SORT_DESC,$alldata);
2846
-			array_splice($alldata,11);
2845
+			array_multisort($values, SORT_DESC, $alldata);
2846
+			array_splice($alldata, 11);
2847 2847
 			foreach ($alldata as $number) {
2848
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
2848
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
2849 2849
 			}
2850 2850
 			
2851 2851
 			if ($globalDebug) echo '-> countAllHours...'."\n";
2852
-			$alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month);
2852
+			$alldata = $Spotter->countAllHoursByAirlines('hour', $filter_last_month);
2853 2853
 			foreach ($alldata as $number) {
2854
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
2854
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
2855 2855
 			}
2856 2856
 
2857 2857
 			// Stats by filters
@@ -2875,7 +2875,7 @@  discard block
 block discarded – undo
2875 2875
 							$last_update_day = date('Y').'-01-01 00:00:00';
2876 2876
 						}
2877 2877
 					}
2878
-					if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) {
2878
+					if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) {
2879 2879
 						$last_update_day = date('Y').'-01-01 00:00:00';
2880 2880
 						$reset = true;
2881 2881
 					}
@@ -2883,38 +2883,38 @@  discard block
 block discarded – undo
2883 2883
 					if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2884 2884
 					$Spotter = new Spotter($this->db);
2885 2885
 					if ($globalDebug) echo 'Count all aircraft types...'."\n";
2886
-					$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
2886
+					$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
2887 2887
 					foreach ($alldata as $number) {
2888
-						$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset);
2888
+						$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset);
2889 2889
 					}
2890 2890
 					if ($globalDebug) echo 'Count all airlines...'."\n";
2891
-					$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
2891
+					$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
2892 2892
 					foreach ($alldata as $number) {
2893
-						$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset);
2893
+						$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset);
2894 2894
 					}
2895 2895
 					if ($globalDebug) echo 'Count all aircraft registrations...'."\n";
2896
-					$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
2896
+					$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
2897 2897
 					foreach ($alldata as $number) {
2898
-						$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset);
2898
+						$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset);
2899 2899
 					}
2900 2900
 					if ($globalDebug) echo 'Count all callsigns...'."\n";
2901
-					$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
2901
+					$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
2902 2902
 					foreach ($alldata as $number) {
2903
-						$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset);
2903
+						$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset);
2904 2904
 					}
2905 2905
 					if ($globalDebug) echo 'Count all owners...'."\n";
2906
-					$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
2906
+					$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
2907 2907
 					foreach ($alldata as $number) {
2908
-						$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset);
2908
+						$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset);
2909 2909
 					}
2910 2910
 					if ($globalDebug) echo 'Count all pilots...'."\n";
2911
-					$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
2911
+					$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
2912 2912
 					foreach ($alldata as $number) {
2913
-						$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset);
2913
+						$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset);
2914 2914
 					}
2915 2915
 					if ($globalDebug) echo 'Count departure airports...'."\n";
2916
-					$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
2917
-					$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
2916
+					$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
2917
+					$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
2918 2918
 					$alldata = array();
2919 2919
 					foreach ($pall as $value) {
2920 2920
 						$icao = $value['airport_departure_icao'];
@@ -2930,13 +2930,13 @@  discard block
 block discarded – undo
2930 2930
 					foreach ($alldata as $key => $row) {
2931 2931
 						$count[$key] = $row['airport_departure_icao_count'];
2932 2932
 					}
2933
-					array_multisort($count,SORT_DESC,$alldata);
2933
+					array_multisort($count, SORT_DESC, $alldata);
2934 2934
 					foreach ($alldata as $number) {
2935
-						echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset);
2935
+						echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset);
2936 2936
 					}
2937 2937
 					if ($globalDebug) echo 'Count all arrival airports...'."\n";
2938
-					$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
2939
-					$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
2938
+					$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter);
2939
+					$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter);
2940 2940
 					$alldata = array();
2941 2941
 					foreach ($pall as $value) {
2942 2942
 						$icao = $value['airport_arrival_icao'];
@@ -2952,9 +2952,9 @@  discard block
 block discarded – undo
2952 2952
 					foreach ($alldata as $key => $row) {
2953 2953
 						$count[$key] = $row['airport_arrival_icao_count'];
2954 2954
 					}
2955
-					array_multisort($count,SORT_DESC,$alldata);
2955
+					array_multisort($count, SORT_DESC, $alldata);
2956 2956
 					foreach ($alldata as $number) {
2957
-						echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset);
2957
+						echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset);
2958 2958
 					}
2959 2959
 					if ($globalDebug) echo 'Count all months...'."\n";
2960 2960
 					$Spotter = new Spotter($this->db);
@@ -2962,36 +2962,36 @@  discard block
 block discarded – undo
2962 2962
 					$lastyear = false;
2963 2963
 					foreach ($alldata as $number) {
2964 2964
 						if ($number['year_name'] != date('Y')) $lastyear = true;
2965
-						$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2965
+						$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2966 2966
 					}
2967 2967
 					if ($globalDebug) echo 'Count all owners by months...'."\n";
2968 2968
 					$alldata = $Spotter->countAllMonthsOwners($filter);
2969 2969
 					foreach ($alldata as $number) {
2970
-						$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2970
+						$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2971 2971
 					}
2972 2972
 					if ($globalDebug) echo 'Count all pilots by months...'."\n";
2973 2973
 					$alldata = $Spotter->countAllMonthsPilots($filter);
2974 2974
 					foreach ($alldata as $number) {
2975
-						$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2975
+						$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2976 2976
 					}
2977 2977
 					if ($globalDebug) echo 'Count all military by months...'."\n";
2978 2978
 					$alldata = $Spotter->countAllMilitaryMonths($filter);
2979 2979
 					foreach ($alldata as $number) {
2980
-						$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2980
+						$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2981 2981
 					}
2982 2982
 					if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
2983 2983
 					$alldata = $Spotter->countAllMonthsAircrafts($filter);
2984 2984
 				    	foreach ($alldata as $number) {
2985
-			    			$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2985
+			    			$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2986 2986
 					}
2987 2987
 					if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
2988 2988
 					$alldata = $Spotter->countAllMonthsRealArrivals($filter);
2989 2989
 					foreach ($alldata as $number) {
2990
-						$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2990
+						$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2991 2991
 					}
2992 2992
 					echo '...Departure'."\n";
2993
-					$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
2994
-					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
2993
+					$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
2994
+					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
2995 2995
 					foreach ($dall as $value) {
2996 2996
 						$icao = $value['departure_airport_icao'];
2997 2997
 						$ddate = $value['date'];
@@ -3009,11 +3009,11 @@  discard block
 block discarded – undo
3009 3009
 					}
3010 3010
 					$alldata = $pall;
3011 3011
 					foreach ($alldata as $number) {
3012
-						$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name);
3012
+						$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name);
3013 3013
 					}
3014 3014
 					echo '...Arrival'."\n";
3015
-					$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
3016
-					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
3015
+					$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
3016
+					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
3017 3017
 					foreach ($dall as $value) {
3018 3018
 						$icao = $value['arrival_airport_icao'];
3019 3019
 						$ddate = $value['date'];
@@ -3031,39 +3031,39 @@  discard block
 block discarded – undo
3031 3031
 					}
3032 3032
 					$alldata = $pall;
3033 3033
 					foreach ($alldata as $number) {
3034
-						$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name);
3034
+						$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name);
3035 3035
 					}
3036 3036
 					echo 'Flights data...'."\n";
3037 3037
 					echo '-> countAllDatesLastMonth...'."\n";
3038 3038
 					$alldata = $Spotter->countAllDatesLastMonth($filter);
3039 3039
 					foreach ($alldata as $number) {
3040
-						$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
3040
+						$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
3041 3041
 					}
3042 3042
 					echo '-> countAllDates...'."\n";
3043
-					$previousdata = $this->countAllDates('',$filter_name);
3044
-					$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
3043
+					$previousdata = $this->countAllDates('', $filter_name);
3044
+					$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
3045 3045
 					$values = array();
3046 3046
 					foreach ($alldata as $cnt) {
3047 3047
 						$values[] = $cnt['date_count'];
3048 3048
 					}
3049
-					array_multisort($values,SORT_DESC,$alldata);
3050
-					array_splice($alldata,11);
3049
+					array_multisort($values, SORT_DESC, $alldata);
3050
+					array_splice($alldata, 11);
3051 3051
 					foreach ($alldata as $number) {
3052
-						$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
3052
+						$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
3053 3053
 					}
3054 3054
 				
3055 3055
 					echo '-> countAllHours...'."\n";
3056
-					$alldata = $Spotter->countAllHours('hour',$filter);
3056
+					$alldata = $Spotter->countAllHours('hour', $filter);
3057 3057
 					foreach ($alldata as $number) {
3058
-						$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
3058
+						$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
3059 3059
 					}
3060 3060
 					echo 'Insert last stats update date...'."\n";
3061 3061
 					date_default_timezone_set('UTC');
3062
-					$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s'));
3062
+					$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s'));
3063 3063
 					if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) {
3064
-						if (date('Y',strtotime($last_update_day)) != date('Y')) {
3064
+						if (date('Y', strtotime($last_update_day)) != date('Y')) {
3065 3065
 							$this->deleteOldStats($filter_name);
3066
-							$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00');
3066
+							$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00');
3067 3067
 						}
3068 3068
 					}
3069 3069
 				}
@@ -3076,16 +3076,16 @@  discard block
 block discarded – undo
3076 3076
 				// SUM all previous month to put as year
3077 3077
 				$previous_year = date('Y');
3078 3078
 				$previous_year--;
3079
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
3080
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
3081
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
3082
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
3079
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
3080
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
3081
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
3082
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
3083 3083
 				$allairlines = $this->getAllAirlineNames();
3084 3084
 				foreach ($allairlines as $data) {
3085
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
3086
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
3087
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
3088
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
3085
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
3086
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
3087
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
3088
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
3089 3089
 				}
3090 3090
 				
3091 3091
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -3094,21 +3094,21 @@  discard block
 block discarded – undo
3094 3094
 						try {
3095 3095
 							$sth = $this->db->prepare($query);
3096 3096
 							$sth->execute();
3097
-						} catch(PDOException $e) {
3097
+						} catch (PDOException $e) {
3098 3098
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
3099 3099
 						}
3100 3100
 						$query = "INSERT INTO tracker_archive_output SELECT * FROM tracker_output WHERE tracker_output.date < '".date('Y')."-01-01 00:00:00'";
3101 3101
 						try {
3102 3102
 							$sth = $this->db->prepare($query);
3103 3103
 							$sth->execute();
3104
-						} catch(PDOException $e) {
3104
+						} catch (PDOException $e) {
3105 3105
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
3106 3106
 						}
3107 3107
 						$query = "INSERT INTO marine_archive_output SELECT * FROM marine_output WHERE marine_output.date < '".date('Y')."-01-01 00:00:00'";
3108 3108
 						try {
3109 3109
 							$sth = $this->db->prepare($query);
3110 3110
 							$sth->execute();
3111
-						} catch(PDOException $e) {
3111
+						} catch (PDOException $e) {
3112 3112
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
3113 3113
 						}
3114 3114
 					}
@@ -3121,7 +3121,7 @@  discard block
 block discarded – undo
3121 3121
 					try {
3122 3122
 						$sth = $this->db->prepare($query);
3123 3123
 						$sth->execute();
3124
-					} catch(PDOException $e) {
3124
+					} catch (PDOException $e) {
3125 3125
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
3126 3126
 					}
3127 3127
 					if ($globalDBdriver == 'mysql') {
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
 					try {
3133 3133
 						$sth = $this->db->prepare($query);
3134 3134
 						$sth->execute();
3135
-					} catch(PDOException $e) {
3135
+					} catch (PDOException $e) {
3136 3136
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
3137 3137
 					}
3138 3138
 					if ($globalDBdriver == 'mysql') {
@@ -3143,15 +3143,15 @@  discard block
 block discarded – undo
3143 3143
 					try {
3144 3144
 						$sth = $this->db->prepare($query);
3145 3145
 						$sth->execute();
3146
-					} catch(PDOException $e) {
3146
+					} catch (PDOException $e) {
3147 3147
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
3148 3148
 					}
3149 3149
 				}
3150 3150
 				if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) {
3151 3151
 					$last_update = $this->getLastStatsUpdate('last_update_stats');
3152
-					if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) {
3152
+					if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) {
3153 3153
 						$this->deleteOldStats();
3154
-						$this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00');
3154
+						$this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00');
3155 3155
 						$lastyearupdate = true;
3156 3156
 					}
3157 3157
 				}
@@ -3173,7 +3173,7 @@  discard block
 block discarded – undo
3173 3173
 					try {
3174 3174
 						$sth = $this->db->prepare($query);
3175 3175
 						$sth->execute();
3176
-					} catch(PDOException $e) {
3176
+					} catch (PDOException $e) {
3177 3177
 						return "error : ".$e->getMessage();
3178 3178
 					}
3179 3179
 					echo 'Archive old tracker data...'."\n";
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
 					try {
3190 3190
 						$sth = $this->db->prepare($query);
3191 3191
 						$sth->execute();
3192
-					} catch(PDOException $e) {
3192
+					} catch (PDOException $e) {
3193 3193
 						return "error : ".$e->getMessage();
3194 3194
 					}
3195 3195
 					echo 'Archive old marine data...'."\n";
@@ -3205,7 +3205,7 @@  discard block
 block discarded – undo
3205 3205
 					try {
3206 3206
 						$sth = $this->db->prepare($query);
3207 3207
 						$sth->execute();
3208
-					} catch(PDOException $e) {
3208
+					} catch (PDOException $e) {
3209 3209
 						return "error : ".$e->getMessage();
3210 3210
 					}
3211 3211
 				}
@@ -3218,7 +3218,7 @@  discard block
 block discarded – undo
3218 3218
 				try {
3219 3219
 					$sth = $this->db->prepare($query);
3220 3220
 					$sth->execute();
3221
-				} catch(PDOException $e) {
3221
+				} catch (PDOException $e) {
3222 3222
 					return "error : ".$e->getMessage();
3223 3223
 				}
3224 3224
 				echo 'Deleting old tracker data...'."\n";
@@ -3230,7 +3230,7 @@  discard block
 block discarded – undo
3230 3230
 				try {
3231 3231
 					$sth = $this->db->prepare($query);
3232 3232
 					$sth->execute();
3233
-				} catch(PDOException $e) {
3233
+				} catch (PDOException $e) {
3234 3234
 					return "error : ".$e->getMessage();
3235 3235
 				}
3236 3236
 				echo 'Deleting old marine data...'."\n";
@@ -3242,14 +3242,14 @@  discard block
 block discarded – undo
3242 3242
 				try {
3243 3243
 					$sth = $this->db->prepare($query);
3244 3244
 					$sth->execute();
3245
-				} catch(PDOException $e) {
3245
+				} catch (PDOException $e) {
3246 3246
 					return "error : ".$e->getMessage();
3247 3247
 				}
3248 3248
 			}
3249 3249
 			if (!isset($lastyearupdate)) {
3250 3250
 				echo 'Insert last stats update date...'."\n";
3251 3251
 				date_default_timezone_set('UTC');
3252
-				$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
3252
+				$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
3253 3253
 			}
3254 3254
 			if ($globalStatsResetYear) {
3255 3255
 				require_once(dirname(__FILE__).'/../install/class.settings.php');
Please login to merge, or discard this patch.
statistics.php 1 patch
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 }
24 24
 
25 25
 if (!isset($filter_name)) $filter_name = '';
26
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
26
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
27 27
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28 28
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
29 29
 }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
33 33
 	if (isset($airline_info[0]['name'])) {
34 34
 		$airline_name = $airline_info[0]['name'];
35
-	} elseif (strpos($airline_icao,'alliance_') !== FALSE) {
35
+	} elseif (strpos($airline_icao, 'alliance_') !== FALSE) {
36 36
 		$alliance_name = $airline_icao;
37 37
 	}
38 38
 }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	$title = _("Statistics");
43 43
 }
44 44
 
45
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
45
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
46
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
47 47
 
48 48
 require_once('header.php');
49 49
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	date_default_timezone_set('UTC');
75 75
 	$lastupdate = strtotime($last_update[0]['value']);
76 76
 	if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
77
-	print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
77
+	print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
78 78
 }
79 79
 
80 80
 ?>
@@ -86,31 +86,31 @@  discard block
 block discarded – undo
86 86
 <?php
87 87
 if ($type == 'aircraft') {
88 88
 ?>
89
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
90
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
91
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
92
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
89
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
90
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
91
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
92
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
93 93
 <?php
94 94
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
95 95
 ?>
96
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
97
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
96
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
97
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
98 98
 <?php
99 99
 	}
100 100
 	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
101 101
 ?>
102
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
103
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
102
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
103
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
104 104
 <?php
105 105
 	}
106 106
 ?>
107
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
108
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
107
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
108
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
109 109
 <?php
110 110
 	if ($airline_icao == '') {
111 111
 ?>
112
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
113
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
112
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
113
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
114 114
 <?php
115 115
 	}
116 116
 ?>
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) {
119 119
 		if ($airline_icao == '' || $airline_icao == 'all') {
120 120
 ?>
121
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
122
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
121
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
122
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
123 123
 <?php
124 124
 		}
125 125
 	}
@@ -127,22 +127,22 @@  discard block
 block discarded – undo
127 127
 <?php
128 128
 } elseif ($type == 'marine') {
129 129
 ?>
130
-	<span><span class="badge"><?php print number_format($Stats->countOverallMarine($filter_name,$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
131
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
132
-	<span><span class="badge"><?php print number_format($Stats->countOverallMarineTypes($filter_name,$year,$month)); ?></span> <?php echo _("Types"); ?></span>
133
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
130
+	<span><span class="badge"><?php print number_format($Stats->countOverallMarine($filter_name, $year, $month)); ?></span> <?php echo _("Vessels"); ?></span>
131
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
132
+	<span><span class="badge"><?php print number_format($Stats->countOverallMarineTypes($filter_name, $year, $month)); ?></span> <?php echo _("Types"); ?></span>
133
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
134 134
 <?php
135 135
 } elseif ($type == 'tracker') {
136 136
 ?>
137
-	<span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
138
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
139
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
140
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
137
+	<span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name, $year, $month)); ?></span> <?php echo _("Trackers"); ?></span>
138
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
139
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
140
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
141 141
 <?php
142 142
 }
143 143
 ?>
144 144
     </p>
145
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
145
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
146 146
     <div class="specific-stats">
147 147
 <?php
148 148
 if ($type == 'aircraft') {
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
             <div class="col-md-6">
152 152
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
153 153
 <?php
154
-	$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
154
+	$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
155 155
 	if (count($aircraft_array) == 0) {
156 156
 		print _("No data available");
157 157
 	} else {
158 158
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
159 159
 		$aircraft_data = '';
160
-		foreach($aircraft_array as $aircraft_item) {
160
+		foreach ($aircraft_array as $aircraft_item) {
161 161
 			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
162 162
 			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
163 163
 		}
@@ -186,16 +186,16 @@  discard block
 block discarded – undo
186 186
 ?>
187 187
                 </div>
188 188
             </div>
189
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
189
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
190 190
 <?php
191 191
 	if ($airline_icao == '' || $airline_icao == 'all') {
192
-		$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
192
+		$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
193 193
 		if (count($airline_array) > 0) {
194 194
 			print '<div class="col-md-6">';
195 195
 			print '<h2>'._("Top 10 Most Common Airline").'</h2>';
196 196
 			print '<div id="chart2" class="chart" width="100%"></div><script>';
197 197
 			$airline_data = '';
198
-			foreach($airline_array as $airline_item) {
198
+			foreach ($airline_array as $airline_item) {
199 199
 				$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
200 200
 			}
201 201
 			$airline_data = substr($airline_data, 0, -1);
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 ?>
222 222
         </div>
223
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
223
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
224 224
 <?php
225 225
 	}
226 226
 }
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
             <div class="col-md-6">
233 233
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
234 234
 <?php
235
-	$marine_array = $Stats->countAllMarineTypes(true,0,'',$filter_name,$year,$month);
235
+	$marine_array = $Stats->countAllMarineTypes(true, 0, '', $filter_name, $year, $month);
236 236
 	if (count($marine_array) == 0) print _("No data available");
237 237
 	else {
238 238
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
239 239
 		$marine_data = '';
240
-		foreach($marine_array as $marine_item) {
240
+		foreach ($marine_array as $marine_item) {
241 241
 			$marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
242 242
 		}
243 243
 		$marine_data = substr($marine_data, 0, -1);
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             	    ?>
267 267
                 </div>
268 268
             </div>
269
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
269
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
270 270
 <!--	</div>-->
271 271
 <?php
272 272
 }
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
             <div class="col-md-6">
277 277
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
278 278
 <?php
279
-	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
279
+	$tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month);
280 280
 	if (count($tracker_array) == 0) print _("No data available");
281 281
 	else {
282 282
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
283 283
 		$tracker_data = '';
284
-		foreach($tracker_array as $tracker_item) {
284
+		foreach ($tracker_array as $tracker_item) {
285 285
 			$tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
286 286
 		}
287 287
 		$tracker_data = substr($tracker_data, 0, -1);
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             	    ?>
312 312
                 </div>
313 313
             </div>
314
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
314
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
315 315
 <!--	</div>-->
316 316
 <?php
317 317
 }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		else {
327 327
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
328 328
 			$owner_data = '';
329
-			foreach($owner_array as $owner_item) {
329
+			foreach ($owner_array as $owner_item) {
330 330
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
331 331
 			}
332 332
 			$owner_data = substr($owner_data, 0, -1);
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                 </div>
347 347
                 -->
348 348
             </div>
349
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
349
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
350 350
             <div class="col-md-6">
351 351
                 <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2>
352 352
 <?php
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 		else {
356 356
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
357 357
 			$owner_data = '';
358
-			foreach($countries_array as $owner_item) {
358
+			foreach ($countries_array as $owner_item) {
359 359
 				$owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],';
360 360
 			}
361 361
 			$owner_data = substr($owner_data, 0, -1);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 -->
377 377
             </div>
378 378
             
379
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
379
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
380 380
 ²	</div>
381 381
         <div class="row column">
382 382
             <div class="col-md-6">
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		else {
388 388
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
389 389
 			$launch_site_data = '';
390
-			foreach($launch_site_array as $launch_site_item) {
390
+			foreach ($launch_site_array as $launch_site_item) {
391 391
 				$launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],';
392 392
 			}
393 393
 			$launch_site_data = substr($launch_site_data, 0, -1);
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 ?>
415 415
         <div class="row column">
416 416
 <?php
417
-	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
417
+	$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
418 418
 	//if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
419 419
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
420 420
 		if (empty($flightover_array)) {
@@ -425,12 +425,12 @@  discard block
 block discarded – undo
425 425
 ?>
426 426
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
427 427
 <?php
428
-		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
428
+		$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
429 429
 		if (count($pilot_array) == 0) print _("No data available");
430 430
 		else {
431 431
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
432 432
 			$pilot_data = '';
433
-			foreach($pilot_array as $pilot_item) {
433
+			foreach ($pilot_array as $pilot_item) {
434 434
 				$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
435 435
 			}
436 436
 			$pilot_data = substr($pilot_data, 0, -1);
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 ?>
452 452
             </div>
453 453
 
454
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
454
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
455 455
 <?php
456 456
 	}
457 457
 	// else {
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
             <div class="col-md-6">
461 461
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
462 462
 <?php
463
-		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
463
+		$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
464 464
 		if (count($owner_array) == 0) print _("No data available");
465 465
 		else {
466 466
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
467 467
 			$owner_data = '';
468
-			foreach($owner_array as $owner_item) {
468
+			foreach ($owner_array as $owner_item) {
469 469
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
470 470
 			}
471 471
 			$owner_data = substr($owner_data, 0, -1);
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                 </div>
485 485
             </div>
486 486
         
487
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
487
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
488 488
 <?php
489 489
 	}
490 490
 	if (!empty($flightover_array)) {
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
499 499
 			print 'var series = [';
500 500
 			$flightover_data = '';
501
-			foreach($flightover_array as $flightover_item) {
501
+			foreach ($flightover_array as $flightover_item) {
502 502
 				$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
503 503
 			}
504 504
 			$flightover_data = substr($flightover_data, 0, -1);
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	}
544 544
 ?>
545 545
         </div>
546
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
546
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
547 547
         </div>
548 548
 <?php
549 549
 }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
560 560
 		print 'var series = [';
561 561
 		$flightover_data = '';
562
-		foreach($flightover_array as $flightover_item) {
562
+		foreach ($flightover_array as $flightover_item) {
563 563
 			$flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
564 564
 		}
565 565
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
617 617
 		print 'var series = [';
618 618
 		$flightover_data = '';
619
-		foreach($flightover_array as $flightover_item) {
619
+		foreach ($flightover_array as $flightover_item) {
620 620
 			$flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
621 621
 		}
622 622
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -666,14 +666,14 @@  discard block
 block discarded – undo
666 666
         <div class="row column">
667 667
             <div class="col-md-6">
668 668
 <?php
669
-	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
669
+	$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
670 670
 	if (count($airport_airport_array) > 0) {
671 671
 		print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
672 672
 		print '<div id="chart3" class="chart" width="100%"></div><script>';
673 673
 		print "\n";
674 674
 		print 'var series = [';
675 675
 		$airport_data = '';
676
-		foreach($airport_airport_array as $airport_item) {
676
+		foreach ($airport_airport_array as $airport_item) {
677 677
 			$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
678 678
 		}
679 679
 		$airport_data = substr($airport_data, 0, -1);
@@ -723,18 +723,18 @@  discard block
 block discarded – undo
723 723
 	}
724 724
 ?>
725 725
             </div>
726
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
726
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
727 727
 
728 728
             <div class="col-md-6">
729 729
 <?php
730
-	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
730
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
731 731
 	if (count($airport_airport_array2) > 0) {
732 732
 		print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
733 733
 		print '<div id="chart4" class="chart" width="100%"></div><script>';
734 734
 		print "\n";
735 735
 		print 'var series = [';
736 736
 		$airport_data = '';
737
-		foreach($airport_airport_array2 as $airport_item)
737
+		foreach ($airport_airport_array2 as $airport_item)
738 738
 		{
739 739
 			if (isset($airport_item['airport_arrival_longitude']) && isset($airport_item['airport_arrival_latitude'])) {
740 740
 				$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 ?>
789 789
             </div>
790 790
         </div>
791
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
791
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
792 792
 <?php 
793 793
 }
794 794
 if ($type == 'aircraft') {
@@ -800,18 +800,18 @@  discard block
 block discarded – undo
800 800
             <div class="col-md-6">
801 801
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
802 802
 <?php
803
-		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
803
+		$year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
804 804
 		if (count($year_array) == 0) print _("No data available");
805 805
 		else {
806 806
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
807 807
 			$year_data = '';
808 808
 			$year_cnt = '';
809
-			foreach($year_array as $year_item) {
809
+			foreach ($year_array as $year_item) {
810 810
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
811 811
 				$year_cnt .= $year_item['date_count'].',';
812 812
 			}
813 813
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
814
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
814
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
815 815
 			print 'c3.generate({
816 816
 			    bindto: "#chart8",
817 817
 			    data: { x: "x",
@@ -824,22 +824,22 @@  discard block
 block discarded – undo
824 824
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
825 825
                 </div>
826 826
             </div>
827
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
827
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
828 828
             <div class="col-md-6">
829 829
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
830 830
 <?php
831
-		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
831
+		$month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
832 832
 		if (count($month_array) == 0) print _("No data available");
833 833
 		else {
834 834
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
835 835
 			$month_data = '';
836 836
 			$month_cnt = '';
837
-			foreach($month_array as $month_item) {
837
+			foreach ($month_array as $month_item) {
838 838
 				$month_data .= '"'.$month_item['date_name'].'",';
839 839
 				$month_cnt .= $month_item['date_count'].',';
840 840
 			}
841 841
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
842
-			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
842
+			$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
843 843
 			print 'c3.generate({
844 844
 			    bindto: "#chart9",
845 845
 			    data: { x: "x",
@@ -852,23 +852,23 @@  discard block
 block discarded – undo
852 852
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
853 853
                 </div>
854 854
             </div>
855
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
855
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
856 856
 
857 857
             <div class="col-md-6">
858 858
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
859 859
 <?php
860
-		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
860
+		$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
861 861
 		if (empty($date_array)) print _("No data available");
862 862
 		else {
863 863
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
864 864
 			$date_data = '';
865 865
 			$date_cnt = '';
866
-			foreach($date_array as $date_item) {
866
+			foreach ($date_array as $date_item) {
867 867
 				$date_data .= '"'.$date_item['date_name'].'",';
868 868
 				$date_cnt .= $date_item['date_count'].',';
869 869
 			}
870 870
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
871
-			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
871
+			$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
872 872
 			print 'c3.generate({
873 873
 			    bindto: "#chart5",
874 874
 			    data: { x: "x",
@@ -881,22 +881,22 @@  discard block
 block discarded – undo
881 881
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
882 882
                 </div>
883 883
             </div>
884
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
884
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
885 885
             <div class="col-md-6">
886 886
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
887 887
 <?php
888
-		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
888
+		$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
889 889
 		if (empty($hour_array)) print _("No data available");
890 890
 		else {
891 891
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
892 892
 			$hour_data = '';
893 893
 			$hour_cnt = '';
894
-			foreach($hour_array as $hour_item) {
894
+			foreach ($hour_array as $hour_item) {
895 895
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
896 896
 				$hour_cnt .= $hour_item['hour_count'].',';
897 897
 			}
898 898
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
899
-			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
899
+			$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
900 900
 			print 'c3.generate({
901 901
 			    bindto: "#chart6",
902 902
 			    data: {
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
910 910
                 </div>
911 911
             </div>
912
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
912
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
913 913
         </div>
914 914
 <?php
915 915
 	}
@@ -925,18 +925,18 @@  discard block
 block discarded – undo
925 925
             <div class="col-md-6">
926 926
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
927 927
 <?php
928
-		$year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name);
928
+		$year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name);
929 929
 		if (count($year_array) == 0) print _("No data available");
930 930
 		else {
931 931
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
932 932
 			$year_data = '';
933 933
 			$year_cnt = '';
934
-			foreach($year_array as $year_item) {
934
+			foreach ($year_array as $year_item) {
935 935
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
936 936
 				$year_cnt .= $year_item['date_count'].',';
937 937
 			}
938 938
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
939
-			$year_cnt = "['vessels',".substr($year_cnt,0,-1)."]";
939
+			$year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]";
940 940
 			print 'c3.generate({
941 941
 			    bindto: "#chart8",
942 942
 			    data: { x: "x",
@@ -950,22 +950,22 @@  discard block
 block discarded – undo
950 950
                 </div>
951 951
             </div>
952 952
             
953
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
953
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
954 954
             <div class="col-md-6">
955 955
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
956 956
 <?php
957
-		$month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name);
957
+		$month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name);
958 958
 		if (count($month_array) == 0) print _("No data available");
959 959
 		else {
960 960
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
961 961
 			$month_data = '';
962 962
 			$month_cnt = '';
963
-			foreach($month_array as $month_item) {
963
+			foreach ($month_array as $month_item) {
964 964
 				$month_data .= '"'.$month_item['date_name'].'",';
965 965
 				$month_cnt .= $month_item['date_count'].',';
966 966
 			}
967 967
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
968
-			$month_cnt = "['vessels',".substr($month_cnt,0,-1)."]";
968
+			$month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]";
969 969
 			print 'c3.generate({
970 970
 			    bindto: "#chart9",
971 971
 			    data: { x: "x",
@@ -978,23 +978,23 @@  discard block
 block discarded – undo
978 978
                     <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
979 979
                 </div>
980 980
             </div>
981
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
981
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
982 982
 
983 983
             <div class="col-md-6">
984 984
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
985 985
 <?php
986
-		$date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name);
986
+		$date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name);
987 987
 		if (empty($date_array)) print _("No data available");
988 988
 		else {
989 989
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
990 990
 			$date_data = '';
991 991
 			$date_cnt = '';
992
-			foreach($date_array as $date_item) {
992
+			foreach ($date_array as $date_item) {
993 993
 				$date_data .= '"'.$date_item['date_name'].'",';
994 994
 				$date_cnt .= $date_item['date_count'].',';
995 995
 			}
996 996
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
997
-			$date_cnt = "['vessels',".substr($date_cnt,0,-1)."]";
997
+			$date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]";
998 998
 			print 'c3.generate({
999 999
 			    bindto: "#chart5",
1000 1000
 			    data: { x: "x",
@@ -1007,22 +1007,22 @@  discard block
 block discarded – undo
1007 1007
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1008 1008
                 </div>
1009 1009
             </div>
1010
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1010
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1011 1011
             <div class="col-md-6">
1012 1012
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1013 1013
 <?php
1014
-		$hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name);
1014
+		$hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name);
1015 1015
 		if (empty($hour_array)) print _("No data available");
1016 1016
 		else {
1017 1017
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1018 1018
 			$hour_data = '';
1019 1019
 			$hour_cnt = '';
1020
-			foreach($hour_array as $hour_item) {
1020
+			foreach ($hour_array as $hour_item) {
1021 1021
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1022 1022
 				$hour_cnt .= $hour_item['hour_count'].',';
1023 1023
 			}
1024 1024
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1025
-			$hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]";
1025
+			$hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]";
1026 1026
 			print 'c3.generate({
1027 1027
 			    bindto: "#chart6",
1028 1028
 			    data: {
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                     <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1036 1036
                 </div>
1037 1037
             </div>
1038
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1038
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1039 1039
         </div>
1040 1040
 <?php
1041 1041
 	}
@@ -1057,12 +1057,12 @@  discard block
 block discarded – undo
1057 1057
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
1058 1058
 			$year_data = '';
1059 1059
 			$year_cnt = '';
1060
-			foreach($year_array as $year_item) {
1060
+			foreach ($year_array as $year_item) {
1061 1061
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1062 1062
 				$year_cnt .= $year_item['date_count'].',';
1063 1063
 			}
1064 1064
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1065
-			$year_cnt = "['trackers',".substr($year_cnt,0,-1)."]";
1065
+			$year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]";
1066 1066
 			print 'c3.generate({
1067 1067
 			    bindto: "#chart8",
1068 1068
 			    data: { x: "x",
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
                 </div>
1077 1077
             </div>
1078 1078
             
1079
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1079
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1080 1080
             <div class="col-md-6">
1081 1081
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1082 1082
 <?php
@@ -1086,12 +1086,12 @@  discard block
 block discarded – undo
1086 1086
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1087 1087
 			$month_data = '';
1088 1088
 			$month_cnt = '';
1089
-			foreach($month_array as $month_item) {
1089
+			foreach ($month_array as $month_item) {
1090 1090
 				$month_data .= '"'.$month_item['date_name'].'",';
1091 1091
 				$month_cnt .= $month_item['date_count'].',';
1092 1092
 			}
1093 1093
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
1094
-			$month_cnt = "['trackers',".substr($month_cnt,0,-1)."]";
1094
+			$month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]";
1095 1095
 			print 'c3.generate({
1096 1096
 			    bindto: "#chart9",
1097 1097
 			    data: { x: "x",
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
                     <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1105 1105
                 </div>
1106 1106
             </div>
1107
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1107
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1108 1108
 
1109 1109
             <div class="col-md-6">
1110 1110
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -1115,12 +1115,12 @@  discard block
 block discarded – undo
1115 1115
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1116 1116
 			$date_data = '';
1117 1117
 			$date_cnt = '';
1118
-			foreach($date_array as $date_item) {
1118
+			foreach ($date_array as $date_item) {
1119 1119
 				$date_data .= '"'.$date_item['date_name'].'",';
1120 1120
 				$date_cnt .= $date_item['date_count'].',';
1121 1121
 			}
1122 1122
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
1123
-			$date_cnt = "['trackers',".substr($date_cnt,0,-1)."]";
1123
+			$date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]";
1124 1124
 			print 'c3.generate({
1125 1125
 			    bindto: "#chart5",
1126 1126
 			    data: { x: "x",
@@ -1133,22 +1133,22 @@  discard block
 block discarded – undo
1133 1133
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1134 1134
                 </div>
1135 1135
             </div>
1136
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1136
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1137 1137
             <div class="col-md-6">
1138 1138
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1139 1139
 <?php
1140
-		$hour_array = $Tracker->countAllHours('hour',true);
1140
+		$hour_array = $Tracker->countAllHours('hour', true);
1141 1141
 		if (empty($hour_array)) print _("No data available");
1142 1142
 		else {
1143 1143
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1144 1144
 			$hour_data = '';
1145 1145
 			$hour_cnt = '';
1146
-			foreach($hour_array as $hour_item) {
1146
+			foreach ($hour_array as $hour_item) {
1147 1147
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1148 1148
 				$hour_cnt .= $hour_item['hour_count'].',';
1149 1149
 			}
1150 1150
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1151
-			$hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]";
1151
+			$hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]";
1152 1152
 			print 'c3.generate({
1153 1153
 			    bindto: "#chart6",
1154 1154
 			    data: {
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
                     <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1162 1162
                 </div>
1163 1163
             </div>
1164
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1164
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1165 1165
         </div>
1166 1166
 <?php
1167 1167
 	}
@@ -1183,12 +1183,12 @@  discard block
 block discarded – undo
1183 1183
 			print '<div id="chart21" class="chart" width="100%"></div><script>';
1184 1184
 			$year_data = '';
1185 1185
 			$year_cnt = '';
1186
-			foreach($year_array as $year_item) {
1186
+			foreach ($year_array as $year_item) {
1187 1187
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1188 1188
 				$year_cnt .= $year_item['date_count'].',';
1189 1189
 			}
1190 1190
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1191
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1191
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1192 1192
 			print 'c3.generate({
1193 1193
 			    bindto: "#chart21",
1194 1194
 			    data: { x: "x",
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
             -->
1205 1205
             </div>
1206 1206
             
1207
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1207
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1208 1208
             <div class="col-md-6">
1209 1209
                 <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2>
1210 1210
 <?php
@@ -1214,12 +1214,12 @@  discard block
 block discarded – undo
1214 1214
 			print '<div id="chart22" class="chart" width="100%"></div><script>';
1215 1215
 			$year_data = '';
1216 1216
 			$year_cnt = '';
1217
-			foreach($year_array as $year_item) {
1217
+			foreach ($year_array as $year_item) {
1218 1218
 				$year_data .= '"'.$year_item['year_name'].'-01-01'.'",';
1219 1219
 				$year_cnt .= $year_item['date_count'].',';
1220 1220
 			}
1221 1221
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1222
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1222
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1223 1223
 			print 'c3.generate({
1224 1224
 			    bindto: "#chart22",
1225 1225
 			    data: { x: "x",
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
             -->
1236 1236
             </div>
1237 1237
             
1238
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1238
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1239 1239
         </div>
1240 1240
 <?php
1241 1241
 	}
@@ -1257,12 +1257,12 @@  discard block
 block discarded – undo
1257 1257
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1258 1258
 			$year_data = '';
1259 1259
 			$year_cnt = '';
1260
-			foreach($year_array as $year_item) {
1260
+			foreach ($year_array as $year_item) {
1261 1261
 				$year_data .= '"'.$year_item['year'].'-01-01",';
1262 1262
 				$year_cnt .= $year_item['count'].',';
1263 1263
 			}
1264 1264
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1265
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1265
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1266 1266
 			print 'c3.generate({
1267 1267
 			    bindto: "#chart32",
1268 1268
 			    data: { x: "x",
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1276 1276
                 </div>
1277 1277
             </div>
1278
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1278
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1279 1279
 
1280 1280
         <div class="row column">
1281 1281
             <div class="col-md-6">
@@ -1287,12 +1287,12 @@  discard block
 block discarded – undo
1287 1287
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1288 1288
 			$year_data = '';
1289 1289
 			$year_cnt = '';
1290
-			foreach($year_array as $year_item) {
1290
+			foreach ($year_array as $year_item) {
1291 1291
 				$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
1292 1292
 				$year_cnt .= $year_item['count'].',';
1293 1293
 			}
1294 1294
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1295
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1295
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1296 1296
 			print 'c3.generate({
1297 1297
 			    bindto: "#chart33",
1298 1298
 			    data: { x: "x",
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1306 1306
                 </div>
1307 1307
             </div>
1308
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1308
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1309 1309
 <br/>
1310 1310
 <?php
1311 1311
 	}
@@ -1319,19 +1319,19 @@  discard block
 block discarded – undo
1319 1319
 	//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
1320 1320
 	if ($year == '' && $month == '') {
1321 1321
 		if ($type == 'aircraft') {
1322
-			$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
1322
+			$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
1323 1323
 		} elseif ($type == 'marine') {
1324
-			$polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d'));
1324
+			$polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d'));
1325 1325
 		} elseif ($type == 'tracker') {
1326
-			$polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d'));
1326
+			$polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d'));
1327 1327
 		}
1328 1328
 	} else {
1329 1329
 		if ($type == 'aircraft') {
1330
-			$polar = $Stats->getStatsSource('polar',$year,$month);
1330
+			$polar = $Stats->getStatsSource('polar', $year, $month);
1331 1331
 		} elseif ($type == 'marine') {
1332
-			$polar = $Stats->getStatsSource('polar_marine',$year,$month);
1332
+			$polar = $Stats->getStatsSource('polar_marine', $year, $month);
1333 1333
 		} elseif ($type == 'tracker') {
1334
-			$polar = $Stats->getStatsSource('polar_tracker',$year,$month);
1334
+			$polar = $Stats->getStatsSource('polar_tracker', $year, $month);
1335 1335
 		}
1336 1336
 	}
1337 1337
 	if (!empty($polar)) {
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 			unset($polar_data);
1341 1341
 			$Spotter = new Spotter();
1342 1342
 			$data = json_decode($eachpolar['source_data']);
1343
-			foreach($data as $value => $key) {
1343
+			foreach ($data as $value => $key) {
1344 1344
 				$direction = $Spotter->parseDirection(($value*22.5));
1345 1345
 				$distance = $key;
1346 1346
 				$unit = 'km';
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 ?>
1361 1361
             <div class="col-md-6">
1362 1362
                 <h4><?php print $eachpolar['source_name']; ?></h4>
1363
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1363
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1364 1364
         	<script>
1365 1365
         	    (function() {
1366 1366
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 		      color: color,
1385 1385
 		      unit: '<?php echo $unit; ?>'
1386 1386
 		    };
1387
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1387
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1388 1388
 		    })();
1389 1389
 		</script>
1390 1390
             </div>
@@ -1399,19 +1399,19 @@  discard block
 block discarded – undo
1399 1399
 	//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
1400 1400
 	if ($year == '' && $month == '') {
1401 1401
 		if ($type == 'aircraft') {
1402
-			$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
1402
+			$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
1403 1403
 		} elseif ($type == 'marine') {
1404
-			$msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d'));
1404
+			$msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d'));
1405 1405
 		} elseif ($type == 'tracker') {
1406
-			$msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d'));
1406
+			$msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d'));
1407 1407
 		}
1408 1408
 	} else {
1409 1409
 		if ($type == 'aircraft') {
1410
-			$msg = $Stats->getStatsSource('msg',$year,$month);
1410
+			$msg = $Stats->getStatsSource('msg', $year, $month);
1411 1411
 		} elseif ($type == 'marine') {
1412
-			$msg = $Stats->getStatsSource('msg_marine',$year,$month);
1412
+			$msg = $Stats->getStatsSource('msg_marine', $year, $month);
1413 1413
 		} elseif ($type == 'tracker') {
1414
-			$msg = $Stats->getStatsSource('msg_tracker',$year,$month);
1414
+			$msg = $Stats->getStatsSource('msg_tracker', $year, $month);
1415 1415
 		}
1416 1416
 	}
1417 1417
 	if (!empty($msg)) {
@@ -1419,13 +1419,13 @@  discard block
 block discarded – undo
1419 1419
 		foreach ($msg as $eachmsg) {
1420 1420
 			//$eachmsg = $msg[0];
1421 1421
 			$data = $eachmsg['source_data'];
1422
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1422
+			if ($data > 500) $max = (round(($data + 100)/100))*100;
1423 1423
 			else $max = 500;
1424 1424
 ?>
1425
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1425
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1426 1426
         	<script>
1427 1427
 		      var g = new JustGage({
1428
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
1428
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
1429 1429
 			    value: <?php echo $data; ?>,
1430 1430
 			    min: 0,
1431 1431
 			    max: <?php print $max; ?>,
@@ -1447,19 +1447,19 @@  discard block
 block discarded – undo
1447 1447
 	//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
1448 1448
 	if ($year == '' && $month == '') {
1449 1449
 		if ($type == 'aircraft') {
1450
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
1450
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
1451 1451
 		} elseif ($type == 'marine') {
1452
-			$hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d'));
1452
+			$hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d'));
1453 1453
 		} elseif ($type == 'tracker') {
1454
-			$hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d'));
1454
+			$hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d'));
1455 1455
 		}
1456 1456
 	} else {
1457 1457
 		if ($type == 'aircraft') {
1458
-			$hist = $Stats->getStatsSource('hist',$year,$month);
1458
+			$hist = $Stats->getStatsSource('hist', $year, $month);
1459 1459
 		} elseif ($type == 'marine') {
1460
-			$hist = $Stats->getStatsSource('hist_marine',$year,$month);
1460
+			$hist = $Stats->getStatsSource('hist_marine', $year, $month);
1461 1461
 		} elseif ($type == 'tracker') {
1462
-			$hist = $Stats->getStatsSource('hist_tracker',$year,$month);
1462
+			$hist = $Stats->getStatsSource('hist_tracker', $year, $month);
1463 1463
 		}
1464 1464
 	}
1465 1465
 	foreach ($hist as $hists) {
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 		$source = $hists['source_name'];
1470 1470
 		$hist_array = json_decode($hists['source_data']);
1471 1471
 		$unit = 'km';
1472
-		foreach($hist_array as $distance => $nb) {
1472
+		foreach ($hist_array as $distance => $nb) {
1473 1473
 			if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1474 1474
 				$distance = round($distance*0.539957);
1475 1475
 				$unit = 'nm';
@@ -1489,18 +1489,18 @@  discard block
 block discarded – undo
1489 1489
 		$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
1490 1490
 ?>
1491 1491
             <div class="col-md-6">
1492
-                <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2>
1492
+                <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2>
1493 1493
 <?php
1494
-		print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
1494
+		print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
1495 1495
 		print 'c3.generate({
1496
-		    bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
1496
+		    bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
1497 1497
 		    data: { x: "x",
1498 1498
 		    columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1499 1499
 		    axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
1500 1500
 		print '</script>';
1501 1501
 ?>
1502 1502
     	    </div>
1503
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1503
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1504 1504
 <?php
1505 1505
 	}
1506 1506
 ?>
Please login to merge, or discard this patch.
install/class.update_schema.php 1 patch
Spacing   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 412
     		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 430
             		$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+    		    } catch (PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 443
             	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445 445
             	    }
446 446
                 } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 497
     		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+    		if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) {
499
+    			$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+	    		} catch (PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505 505
     			}
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 602
     			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 664
     			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 674
     			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
682
+		if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684 684
     			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 694
     			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -814,17 +814,17 @@  discard block
 block discarded – undo
814 814
 			try {
815 815
 				$sth = $Connection->db->prepare($query);
816 816
 				$sth->execute();
817
-			} catch(PDOException $e) {
817
+			} catch (PDOException $e) {
818 818
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
819 819
 			}
820 820
 		}
821
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
821
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
822 822
 			// Add aircraft_manufacturer to stats_aircraft
823 823
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
824 824
 			try {
825 825
 				$sth = $Connection->db->prepare($query);
826 826
 				$sth->execute();
827
-			} catch(PDOException $e) {
827
+			} catch (PDOException $e) {
828 828
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
829 829
     			}
830 830
     		}
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 		try {
834 834
 			$sth = $Connection->db->prepare($query);
835 835
 			$sth->execute();
836
-		} catch(PDOException $e) {
836
+		} catch (PDOException $e) {
837 837
 			return "error (update schema_version) : ".$e->getMessage()."\n";
838 838
 		}
839 839
 		return $error;
@@ -849,23 +849,23 @@  discard block
 block discarded – undo
849 849
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
850 850
 		}
851 851
 		if ($error != '') return 'Import airlines.sql : '.$error;
852
-		if (!$Connection->checkColumnName('airlines','forsource')) {
852
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
853 853
 			// Add forsource to airlines
854 854
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
855 855
 			try {
856 856
 				$sth = $Connection->db->prepare($query);
857 857
 				$sth->execute();
858
-			} catch(PDOException $e) {
858
+			} catch (PDOException $e) {
859 859
 				return "error (add forsource column) : ".$e->getMessage()."\n";
860 860
 			}
861 861
 		}
862
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
862
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
863 863
 			// Add forsource to airlines
864 864
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
865 865
 			try {
866 866
 				$sth = $Connection->db->prepare($query);
867 867
 				$sth->execute();
868
-			} catch(PDOException $e) {
868
+			} catch (PDOException $e) {
869 869
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
870 870
 			}
871 871
 			// Add unique key
@@ -877,17 +877,17 @@  discard block
 block discarded – undo
877 877
 			try {
878 878
 				$sth = $Connection->db->prepare($query);
879 879
 				$sth->execute();
880
-			} catch(PDOException $e) {
880
+			} catch (PDOException $e) {
881 881
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
882 882
 			}
883 883
 		}
884
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
884
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
885 885
 			// Add forsource to airlines
886 886
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
887 887
 			try {
888 888
 				$sth = $Connection->db->prepare($query);
889 889
 				$sth->execute();
890
-			} catch(PDOException $e) {
890
+			} catch (PDOException $e) {
891 891
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
892 892
 			}
893 893
 			// Add unique key
@@ -899,17 +899,17 @@  discard block
 block discarded – undo
899 899
 			try {
900 900
 				$sth = $Connection->db->prepare($query);
901 901
 				$sth->execute();
902
-			} catch(PDOException $e) {
902
+			} catch (PDOException $e) {
903 903
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
904 904
 			}
905 905
 		}
906
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
906
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
907 907
 			// Add forsource to airlines
908 908
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
909 909
 			try {
910 910
 				$sth = $Connection->db->prepare($query);
911 911
 				$sth->execute();
912
-			} catch(PDOException $e) {
912
+			} catch (PDOException $e) {
913 913
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
914 914
 			}
915 915
 			// Add unique key
@@ -921,36 +921,36 @@  discard block
 block discarded – undo
921 921
 			try {
922 922
 				$sth = $Connection->db->prepare($query);
923 923
 				$sth->execute();
924
-			} catch(PDOException $e) {
924
+			} catch (PDOException $e) {
925 925
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
926 926
 			}
927 927
 		}
928
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
928
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
929 929
 			// Add forsource to airlines
930 930
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
931 931
 			try {
932 932
 				$sth = $Connection->db->prepare($query);
933 933
 				$sth->execute();
934
-			} catch(PDOException $e) {
934
+			} catch (PDOException $e) {
935 935
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
936 936
 			}
937 937
 		}
938
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
938
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
939 939
 			// Add forsource to airlines
940 940
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
941 941
 			try {
942 942
 				$sth = $Connection->db->prepare($query);
943 943
 				$sth->execute();
944
-			} catch(PDOException $e) {
944
+			} catch (PDOException $e) {
945 945
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
946 946
 			}
947
-			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
947
+			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
948 948
 				// Add unique key
949 949
 				$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
950 950
 				try {
951 951
 					$sth = $Connection->db->prepare($query);
952 952
 					$sth->execute();
953
-				} catch(PDOException $e) {
953
+				} catch (PDOException $e) {
954 954
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
955 955
 				}
956 956
 			} else {
@@ -963,18 +963,18 @@  discard block
 block discarded – undo
963 963
 				try {
964 964
 					$sth = $Connection->db->prepare($query);
965 965
 					$sth->execute();
966
-				} catch(PDOException $e) {
966
+				} catch (PDOException $e) {
967 967
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
968 968
 				}
969 969
 			}
970 970
 		}
971
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
971
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
972 972
 			// Add forsource to airlines
973 973
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
974 974
 			try {
975 975
 				$sth = $Connection->db->prepare($query);
976 976
 				$sth->execute();
977
-			} catch(PDOException $e) {
977
+			} catch (PDOException $e) {
978 978
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
979 979
 			}
980 980
 			// Add unique key
@@ -986,17 +986,17 @@  discard block
 block discarded – undo
986 986
 			try {
987 987
 				$sth = $Connection->db->prepare($query);
988 988
 				$sth->execute();
989
-			} catch(PDOException $e) {
989
+			} catch (PDOException $e) {
990 990
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
991 991
 			}
992 992
 		}
993
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
993
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
994 994
 			// Add forsource to airlines
995 995
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
996 996
 			try {
997 997
 				$sth = $Connection->db->prepare($query);
998 998
 				$sth->execute();
999
-			} catch(PDOException $e) {
999
+			} catch (PDOException $e) {
1000 1000
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1001 1001
 			}
1002 1002
 			// Add unique key
@@ -1008,17 +1008,17 @@  discard block
 block discarded – undo
1008 1008
 			try {
1009 1009
 				$sth = $Connection->db->prepare($query);
1010 1010
 				$sth->execute();
1011
-			} catch(PDOException $e) {
1011
+			} catch (PDOException $e) {
1012 1012
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1013 1013
 			}
1014 1014
 		}
1015
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1015
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1016 1016
 			// Add forsource to airlines
1017 1017
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1018 1018
 			try {
1019 1019
 				$sth = $Connection->db->prepare($query);
1020 1020
 				$sth->execute();
1021
-			} catch(PDOException $e) {
1021
+			} catch (PDOException $e) {
1022 1022
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1023 1023
 			}
1024 1024
 			// Add unique key
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 			try {
1031 1031
 				$sth = $Connection->db->prepare($query);
1032 1032
 				$sth->execute();
1033
-			} catch(PDOException $e) {
1033
+			} catch (PDOException $e) {
1034 1034
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1035 1035
 			}
1036 1036
 		}
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 		try {
1040 1040
 			$sth = $Connection->db->prepare($query);
1041 1041
 			$sth->execute();
1042
-		} catch(PDOException $e) {
1042
+		} catch (PDOException $e) {
1043 1043
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1044 1044
 		}
1045 1045
 		return $error;
@@ -1049,13 +1049,13 @@  discard block
 block discarded – undo
1049 1049
 		global $globalDBdriver;
1050 1050
 		$Connection = new Connection();
1051 1051
 		$error = '';
1052
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1052
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1053 1053
 			// Add forsource to airlines
1054 1054
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1055 1055
 			try {
1056 1056
 				$sth = $Connection->db->prepare($query);
1057 1057
 				$sth->execute();
1058
-			} catch(PDOException $e) {
1058
+			} catch (PDOException $e) {
1059 1059
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1060 1060
 			}
1061 1061
 			// Add unique key
@@ -1067,17 +1067,17 @@  discard block
 block discarded – undo
1067 1067
 			try {
1068 1068
 				$sth = $Connection->db->prepare($query);
1069 1069
 				$sth->execute();
1070
-			} catch(PDOException $e) {
1070
+			} catch (PDOException $e) {
1071 1071
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1072 1072
 			}
1073 1073
 		}
1074
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1074
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1075 1075
 			// Add forsource to airlines
1076 1076
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1077 1077
 			try {
1078 1078
 				$sth = $Connection->db->prepare($query);
1079 1079
 				$sth->execute();
1080
-			} catch(PDOException $e) {
1080
+			} catch (PDOException $e) {
1081 1081
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1082 1082
 			}
1083 1083
 			// Add unique key
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 			try {
1090 1090
 				$sth = $Connection->db->prepare($query);
1091 1091
 				$sth->execute();
1092
-			} catch(PDOException $e) {
1092
+			} catch (PDOException $e) {
1093 1093
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1094 1094
 			}
1095 1095
 		}
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 		try {
1098 1098
 			$sth = $Connection->db->prepare($query);
1099 1099
 			$sth->execute();
1100
-		} catch(PDOException $e) {
1100
+		} catch (PDOException $e) {
1101 1101
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1102 1102
 		}
1103 1103
 		return $error;
@@ -1107,12 +1107,12 @@  discard block
 block discarded – undo
1107 1107
 		global $globalDBdriver;
1108 1108
 		$Connection = new Connection();
1109 1109
 		$error = '';
1110
-		if (!$Connection->checkColumnName('atc','format_source')) {
1110
+		if (!$Connection->checkColumnName('atc', 'format_source')) {
1111 1111
 			$query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL";
1112 1112
 			try {
1113 1113
 				$sth = $Connection->db->prepare($query);
1114 1114
 				$sth->execute();
1115
-			} catch(PDOException $e) {
1115
+			} catch (PDOException $e) {
1116 1116
 				return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n";
1117 1117
 			}
1118 1118
 		}
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 		try {
1121 1121
 			$sth = $Connection->db->prepare($query);
1122 1122
 			$sth->execute();
1123
-		} catch(PDOException $e) {
1123
+		} catch (PDOException $e) {
1124 1124
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1125 1125
 		}
1126 1126
 		return $error;
@@ -1130,13 +1130,13 @@  discard block
 block discarded – undo
1130 1130
 		global $globalDBdriver;
1131 1131
 		$Connection = new Connection();
1132 1132
 		$error = '';
1133
-		if (!$Connection->checkColumnName('stats_pilot','format_source')) {
1133
+		if (!$Connection->checkColumnName('stats_pilot', 'format_source')) {
1134 1134
 			// Add forsource to airlines
1135 1135
 			$query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''";
1136 1136
 			try {
1137 1137
 				$sth = $Connection->db->prepare($query);
1138 1138
 				$sth->execute();
1139
-			} catch(PDOException $e) {
1139
+			} catch (PDOException $e) {
1140 1140
 				return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n";
1141 1141
 			}
1142 1142
 			// Add unique key
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 			try {
1149 1149
 				$sth = $Connection->db->prepare($query);
1150 1150
 				$sth->execute();
1151
-			} catch(PDOException $e) {
1151
+			} catch (PDOException $e) {
1152 1152
 				return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n";
1153 1153
 			}
1154 1154
 		}
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 		try {
1157 1157
 			$sth = $Connection->db->prepare($query);
1158 1158
 			$sth->execute();
1159
-		} catch(PDOException $e) {
1159
+		} catch (PDOException $e) {
1160 1160
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1161 1161
 		}
1162 1162
 		return $error;
@@ -1166,23 +1166,23 @@  discard block
 block discarded – undo
1166 1166
 		global $globalDBdriver;
1167 1167
 		$Connection = new Connection();
1168 1168
 		$error = '';
1169
-		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) {
1169
+		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) {
1170 1170
 			// Add unique key
1171 1171
 			$query = "alter table spotter_live add index(latitude,longitude)";
1172 1172
 			try {
1173 1173
 				$sth = $Connection->db->prepare($query);
1174 1174
 				$sth->execute();
1175
-			} catch(PDOException $e) {
1175
+			} catch (PDOException $e) {
1176 1176
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1177 1177
 			}
1178 1178
                 }
1179
-		if (!$Connection->checkColumnName('aircraft','mfr')) {
1179
+		if (!$Connection->checkColumnName('aircraft', 'mfr')) {
1180 1180
 			// Add mfr to aircraft
1181 1181
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
1182 1182
 			try {
1183 1183
 				$sth = $Connection->db->prepare($query);
1184 1184
 				$sth->execute();
1185
-			} catch(PDOException $e) {
1185
+			} catch (PDOException $e) {
1186 1186
 				return "error (add mfr column in aircraft) : ".$e->getMessage()."\n";
1187 1187
 			}
1188 1188
 		}
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 		try {
1199 1199
 			$sth = $Connection->db->prepare($query);
1200 1200
 			$sth->execute();
1201
-		} catch(PDOException $e) {
1201
+		} catch (PDOException $e) {
1202 1202
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1203 1203
 		}
1204 1204
 		return $error;
@@ -1208,13 +1208,13 @@  discard block
 block discarded – undo
1208 1208
 		global $globalDBdriver;
1209 1209
 		$Connection = new Connection();
1210 1210
 		$error = '';
1211
-		if ($Connection->checkColumnName('aircraft','mfr')) {
1211
+		if ($Connection->checkColumnName('aircraft', 'mfr')) {
1212 1212
 			// drop mfr to aircraft
1213 1213
 			$query = "ALTER TABLE aircraft DROP COLUMN mfr";
1214 1214
 			try {
1215 1215
 				$sth = $Connection->db->prepare($query);
1216 1216
 				$sth->execute();
1217
-			} catch(PDOException $e) {
1217
+			} catch (PDOException $e) {
1218 1218
 				return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n";
1219 1219
 			}
1220 1220
 		}
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 		try {
1231 1231
 			$sth = $Connection->db->prepare($query);
1232 1232
 			$sth->execute();
1233
-		} catch(PDOException $e) {
1233
+		} catch (PDOException $e) {
1234 1234
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1235 1235
 		}
1236 1236
 		return $error;
@@ -1240,33 +1240,33 @@  discard block
 block discarded – undo
1240 1240
 		global $globalDBdriver;
1241 1241
 		$Connection = new Connection();
1242 1242
 		$error = '';
1243
-		if (!$Connection->indexExists('notam','ref_idx')) {
1243
+		if (!$Connection->indexExists('notam', 'ref_idx')) {
1244 1244
 			// Add index key
1245 1245
 			$query = "create index ref_idx on notam (ref)";
1246 1246
 			try {
1247 1247
 				$sth = $Connection->db->prepare($query);
1248 1248
 				$sth->execute();
1249
-			} catch(PDOException $e) {
1249
+			} catch (PDOException $e) {
1250 1250
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1251 1251
 			}
1252 1252
                 }
1253
-		if (!$Connection->indexExists('accidents','registration_idx')) {
1253
+		if (!$Connection->indexExists('accidents', 'registration_idx')) {
1254 1254
 			// Add index key
1255 1255
 			$query = "create index registration_idx on accidents (registration)";
1256 1256
 			try {
1257 1257
 				$sth = $Connection->db->prepare($query);
1258 1258
 				$sth->execute();
1259
-			} catch(PDOException $e) {
1259
+			} catch (PDOException $e) {
1260 1260
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1261 1261
 			}
1262 1262
                 }
1263
-		if (!$Connection->indexExists('accidents','rdts')) {
1263
+		if (!$Connection->indexExists('accidents', 'rdts')) {
1264 1264
 			// Add index key
1265 1265
 			$query = "create index rdts on accidents (registration,date,type,source)";
1266 1266
 			try {
1267 1267
 				$sth = $Connection->db->prepare($query);
1268 1268
 				$sth->execute();
1269
-			} catch(PDOException $e) {
1269
+			} catch (PDOException $e) {
1270 1270
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1271 1271
 			}
1272 1272
                 }
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 		try {
1276 1276
 			$sth = $Connection->db->prepare($query);
1277 1277
 			$sth->execute();
1278
-		} catch(PDOException $e) {
1278
+		} catch (PDOException $e) {
1279 1279
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1280 1280
 		}
1281 1281
 		return $error;
@@ -1285,23 +1285,23 @@  discard block
 block discarded – undo
1285 1285
 		global $globalDBdriver;
1286 1286
 		$Connection = new Connection();
1287 1287
 		$error = '';
1288
-		if (!$Connection->checkColumnName('accidents','airline_name')) {
1288
+		if (!$Connection->checkColumnName('accidents', 'airline_name')) {
1289 1289
 			// Add airline_name to accidents
1290 1290
 			$query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL";
1291 1291
 			try {
1292 1292
 				$sth = $Connection->db->prepare($query);
1293 1293
 				$sth->execute();
1294
-			} catch(PDOException $e) {
1294
+			} catch (PDOException $e) {
1295 1295
 				return "error (add airline_name column in accidents) : ".$e->getMessage()."\n";
1296 1296
 			}
1297 1297
 		}
1298
-		if (!$Connection->checkColumnName('accidents','airline_icao')) {
1298
+		if (!$Connection->checkColumnName('accidents', 'airline_icao')) {
1299 1299
 			// Add airline_icao to accidents
1300 1300
 			$query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL";
1301 1301
 			try {
1302 1302
 				$sth = $Connection->db->prepare($query);
1303 1303
 				$sth->execute();
1304
-			} catch(PDOException $e) {
1304
+			} catch (PDOException $e) {
1305 1305
 				return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n";
1306 1306
 			}
1307 1307
 		}
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 		try {
1310 1310
 			$sth = $Connection->db->prepare($query);
1311 1311
 			$sth->execute();
1312
-		} catch(PDOException $e) {
1312
+		} catch (PDOException $e) {
1313 1313
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1314 1314
 		}
1315 1315
 		return $error;
@@ -1319,13 +1319,13 @@  discard block
 block discarded – undo
1319 1319
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1320 1320
 		$Connection = new Connection();
1321 1321
 		$error = '';
1322
-		if (!$Connection->checkColumnName('airlines','alliance')) {
1322
+		if (!$Connection->checkColumnName('airlines', 'alliance')) {
1323 1323
 			// Add alliance to airlines
1324 1324
 			$query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL";
1325 1325
 			try {
1326 1326
 				$sth = $Connection->db->prepare($query);
1327 1327
 				$sth->execute();
1328
-			} catch(PDOException $e) {
1328
+			} catch (PDOException $e) {
1329 1329
 				return "error (add alliance column in airlines) : ".$e->getMessage()."\n";
1330 1330
 			}
1331 1331
 		}
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 		try {
1353 1353
 			$sth = $Connection->db->prepare($query);
1354 1354
 			$sth->execute();
1355
-		} catch(PDOException $e) {
1355
+		} catch (PDOException $e) {
1356 1356
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1357 1357
 		}
1358 1358
 		return $error;
@@ -1362,13 +1362,13 @@  discard block
 block discarded – undo
1362 1362
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1363 1363
 		$Connection = new Connection();
1364 1364
 		$error = '';
1365
-		if (!$Connection->checkColumnName('airlines','ban_eu')) {
1365
+		if (!$Connection->checkColumnName('airlines', 'ban_eu')) {
1366 1366
 			// Add ban_eu to airlines
1367 1367
 			$query = "ALTER TABLE airlines ADD ban_eu INTEGER NOT NULL DEFAULT '0'";
1368 1368
 			try {
1369 1369
 				$sth = $Connection->db->prepare($query);
1370 1370
 				$sth->execute();
1371
-			} catch(PDOException $e) {
1371
+			} catch (PDOException $e) {
1372 1372
 				return "error (add ban_eu column in airlines) : ".$e->getMessage()."\n";
1373 1373
 			}
1374 1374
 		}
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
 		try {
1377 1377
 			$sth = $Connection->db->prepare($query);
1378 1378
 			$sth->execute();
1379
-		} catch(PDOException $e) {
1379
+		} catch (PDOException $e) {
1380 1380
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1381 1381
 		}
1382 1382
 		return $error;
@@ -1387,19 +1387,19 @@  discard block
 block discarded – undo
1387 1387
 		$Connection = new Connection();
1388 1388
 		$error = '';
1389 1389
 		if ($globalDBdriver == 'mysql') {
1390
-			if ($Connection->getColumnType('spotter_output','date') == 'TIMESTAMP' && $Connection->getColumnType('spotter_output','last_seen') != 'TIMESTAMP') {
1390
+			if ($Connection->getColumnType('spotter_output', 'date') == 'TIMESTAMP' && $Connection->getColumnType('spotter_output', 'last_seen') != 'TIMESTAMP') {
1391 1391
 				$query = "ALTER TABLE spotter_output CHANGE date date TIMESTAMP NULL DEFAULT NULL";
1392 1392
 				try {
1393 1393
 					$sth = $Connection->db->prepare($query);
1394 1394
 					$sth->execute();
1395
-				} catch(PDOException $e) {
1395
+				} catch (PDOException $e) {
1396 1396
 					return "error (delete default timestamp spotter_output) : ".$e->getMessage()."\n";
1397 1397
 				}
1398 1398
 				$query = "ALTER TABLE spotter_output MODIFY COLUMN last_seen timestamp not null default current_timestamp()";
1399 1399
 				try {
1400 1400
 					$sth = $Connection->db->prepare($query);
1401 1401
 					$sth->execute();
1402
-				} catch(PDOException $e) {
1402
+				} catch (PDOException $e) {
1403 1403
 					return "error (convert spotter_output last_seen to timestamp) : ".$e->getMessage()."\n";
1404 1404
 				}
1405 1405
 				
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 				try {
1408 1408
 					$sth = $Connection->db->prepare($query);
1409 1409
 					$sth->execute();
1410
-				} catch(PDOException $e) {
1410
+				} catch (PDOException $e) {
1411 1411
 					return "error (delete default timestamp spotter_output) : ".$e->getMessage()."\n";
1412 1412
 				}
1413 1413
 				/*$query = "SELECT date,last_seen FROM spotter_output WHERE last_seen < date ORDER BY date DESC LIMIT 150";
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
 				try {
1459 1459
 					$sth = $Connection->db->prepare($query);
1460 1460
 					$sth->execute();
1461
-				} catch(PDOException $e) {
1461
+				} catch (PDOException $e) {
1462 1462
 					return "error (fix date) : ".$e->getMessage()."\n";
1463 1463
 				}
1464 1464
 			}
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 		try {
1544 1544
 			$sth = $Connection->db->prepare($query);
1545 1545
 			$sth->execute();
1546
-		} catch(PDOException $e) {
1546
+		} catch (PDOException $e) {
1547 1547
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1548 1548
 		}
1549 1549
 		return $error;
@@ -1552,13 +1552,13 @@  discard block
 block discarded – undo
1552 1552
 		global $globalDBdriver;
1553 1553
 		$Connection = new Connection();
1554 1554
 		$error = '';
1555
-		if (!$Connection->indexExists('accidents','type')) {
1555
+		if (!$Connection->indexExists('accidents', 'type')) {
1556 1556
 			// Add index key
1557 1557
 			$query = "create index type on accidents (type,date)";
1558 1558
 			try {
1559 1559
 				$sth = $Connection->db->prepare($query);
1560 1560
 				$sth->execute();
1561
-			} catch(PDOException $e) {
1561
+			} catch (PDOException $e) {
1562 1562
 				return "error (add index type on accidents) : ".$e->getMessage()."\n";
1563 1563
 			}
1564 1564
                 }
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
 		try {
1567 1567
 			$sth = $Connection->db->prepare($query);
1568 1568
 			$sth->execute();
1569
-		} catch(PDOException $e) {
1569
+		} catch (PDOException $e) {
1570 1570
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1571 1571
 		}
1572 1572
 		return $error;
@@ -1576,12 +1576,12 @@  discard block
 block discarded – undo
1576 1576
 		global $globalDBdriver;
1577 1577
 		$Connection = new Connection();
1578 1578
 		$error = '';
1579
-		if (!$Connection->checkColumnName('aircraft_modes','source_type')) {
1579
+		if (!$Connection->checkColumnName('aircraft_modes', 'source_type')) {
1580 1580
 			$query = "ALTER TABLE aircraft_modes ADD source_type VARCHAR(255) DEFAULT 'modes'";
1581 1581
 			try {
1582 1582
 				$sth = $Connection->db->prepare($query);
1583 1583
 				$sth->execute();
1584
-			} catch(PDOException $e) {
1584
+			} catch (PDOException $e) {
1585 1585
 				return "error (add source_type column in aircraft_modes) : ".$e->getMessage()."\n";
1586 1586
 			}
1587 1587
 		}
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
 		try {
1648 1648
 			$sth = $Connection->db->prepare($query);
1649 1649
 			$sth->execute();
1650
-		} catch(PDOException $e) {
1650
+		} catch (PDOException $e) {
1651 1651
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1652 1652
 		}
1653 1653
 		return $error;
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
 			try {
1700 1700
 				$sth = $Connection->db->prepare($query);
1701 1701
 				$sth->execute();
1702
-			} catch(PDOException $e) {
1702
+			} catch (PDOException $e) {
1703 1703
 				return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
1704 1704
 			}
1705 1705
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -1708,18 +1708,18 @@  discard block
 block discarded – undo
1708 1708
 				try {
1709 1709
 					$sth = $Connection->db->prepare($query);
1710 1710
 					$sth->execute();
1711
-				} catch(PDOException $e) {
1711
+				} catch (PDOException $e) {
1712 1712
 					return "error (Change table format from archive to InnoDB for spotter_archive) : ".$e->getMessage()."\n";
1713 1713
 				}
1714 1714
 			}
1715 1715
 		}
1716
-		if (!$Connection->indexExists('spotter_archive','flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive','flightaware_id')) {
1716
+		if (!$Connection->indexExists('spotter_archive', 'flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive', 'flightaware_id')) {
1717 1717
 			// Add index key
1718 1718
 			$query = "create index flightaware_id_date_idx on spotter_archive (flightaware_id,date)";
1719 1719
 			try {
1720 1720
 				$sth = $Connection->db->prepare($query);
1721 1721
 				$sth->execute();
1722
-			} catch(PDOException $e) {
1722
+			} catch (PDOException $e) {
1723 1723
 				return "error (add index flightaware_id, date on spotter_archive) : ".$e->getMessage()."\n";
1724 1724
 			}
1725 1725
                 }
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
 		try {
1728 1728
 			$sth = $Connection->db->prepare($query);
1729 1729
 			$sth->execute();
1730
-		} catch(PDOException $e) {
1730
+		} catch (PDOException $e) {
1731 1731
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1732 1732
 		}
1733 1733
 		return $error;
@@ -1738,148 +1738,148 @@  discard block
 block discarded – undo
1738 1738
 		$Connection = new Connection();
1739 1739
 		$error = '';
1740 1740
 		if ($globalDBdriver == 'mysql') {
1741
-			if (!$Connection->checkColumnName('marine_output','type_id')) {
1741
+			if (!$Connection->checkColumnName('marine_output', 'type_id')) {
1742 1742
 				$query = "ALTER TABLE marine_output ADD COLUMN type_id int(11) DEFAULT NULL";
1743 1743
 				try {
1744 1744
 					$sth = $Connection->db->prepare($query);
1745 1745
 					$sth->execute();
1746
-				} catch(PDOException $e) {
1746
+				} catch (PDOException $e) {
1747 1747
 					return "error (add column type_id in marine_output) : ".$e->getMessage()."\n";
1748 1748
 				}
1749 1749
 			}
1750
-			if (!$Connection->checkColumnName('marine_live','type_id')) {
1750
+			if (!$Connection->checkColumnName('marine_live', 'type_id')) {
1751 1751
 				$query = "ALTER TABLE marine_live ADD COLUMN type_id int(11) DEFAULT NULL";
1752 1752
 				try {
1753 1753
 					$sth = $Connection->db->prepare($query);
1754 1754
 					$sth->execute();
1755
-				} catch(PDOException $e) {
1755
+				} catch (PDOException $e) {
1756 1756
 					return "error (add column type_id in marine_live) : ".$e->getMessage()."\n";
1757 1757
 				}
1758 1758
 			}
1759
-			if (!$Connection->checkColumnName('marine_archive','type_id')) {
1759
+			if (!$Connection->checkColumnName('marine_archive', 'type_id')) {
1760 1760
 				$query = "ALTER TABLE marine_archive ADD COLUMN type_id int(11) DEFAULT NULL";
1761 1761
 				try {
1762 1762
 					$sth = $Connection->db->prepare($query);
1763 1763
 					$sth->execute();
1764
-				} catch(PDOException $e) {
1764
+				} catch (PDOException $e) {
1765 1765
 					return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n";
1766 1766
 				}
1767 1767
 			}
1768
-			if (!$Connection->checkColumnName('marine_archive_output','type_id')) {
1768
+			if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) {
1769 1769
 				$query = "ALTER TABLE marine_archive_output ADD COLUMN type_id int(11) DEFAULT NULL";
1770 1770
 				try {
1771 1771
 					$sth = $Connection->db->prepare($query);
1772 1772
 					$sth->execute();
1773
-				} catch(PDOException $e) {
1773
+				} catch (PDOException $e) {
1774 1774
 					return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n";
1775 1775
 				}
1776 1776
 			}
1777
-			if (!$Connection->checkColumnName('marine_output','status_id')) {
1777
+			if (!$Connection->checkColumnName('marine_output', 'status_id')) {
1778 1778
 				$query = "ALTER TABLE marine_output ADD COLUMN status_id int(11) DEFAULT NULL";
1779 1779
 				try {
1780 1780
 					$sth = $Connection->db->prepare($query);
1781 1781
 					$sth->execute();
1782
-				} catch(PDOException $e) {
1782
+				} catch (PDOException $e) {
1783 1783
 					return "error (add column status_id in marine_output) : ".$e->getMessage()."\n";
1784 1784
 				}
1785 1785
 			}
1786
-			if (!$Connection->checkColumnName('marine_live','status_id')) {
1786
+			if (!$Connection->checkColumnName('marine_live', 'status_id')) {
1787 1787
 				$query = "ALTER TABLE marine_live ADD COLUMN status_id int(11) DEFAULT NULL";
1788 1788
 				try {
1789 1789
 					$sth = $Connection->db->prepare($query);
1790 1790
 					$sth->execute();
1791
-				} catch(PDOException $e) {
1791
+				} catch (PDOException $e) {
1792 1792
 					return "error (add column status_id in marine_live) : ".$e->getMessage()."\n";
1793 1793
 				}
1794 1794
 			}
1795
-			if (!$Connection->checkColumnName('marine_archive','status_id')) {
1795
+			if (!$Connection->checkColumnName('marine_archive', 'status_id')) {
1796 1796
 				$query = "ALTER TABLE marine_archive ADD COLUMN status_id int(11) DEFAULT NULL";
1797 1797
 				try {
1798 1798
 					$sth = $Connection->db->prepare($query);
1799 1799
 					$sth->execute();
1800
-				} catch(PDOException $e) {
1800
+				} catch (PDOException $e) {
1801 1801
 					return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n";
1802 1802
 				}
1803 1803
 			}
1804
-			if (!$Connection->checkColumnName('marine_archive_output','status_id')) {
1804
+			if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) {
1805 1805
 				$query = "ALTER TABLE marine_archive_output ADD COLUMN status_id int(11) DEFAULT NULL";
1806 1806
 				try {
1807 1807
 					$sth = $Connection->db->prepare($query);
1808 1808
 					$sth->execute();
1809
-				} catch(PDOException $e) {
1809
+				} catch (PDOException $e) {
1810 1810
 					return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n";
1811 1811
 				}
1812 1812
 			}
1813 1813
 		} else {
1814
-			if (!$Connection->checkColumnName('marine_output','type_id')) {
1814
+			if (!$Connection->checkColumnName('marine_output', 'type_id')) {
1815 1815
 				$query = "ALTER TABLE marine_output ADD COLUMN type_id integer DEFAULT NULL";
1816 1816
 				try {
1817 1817
 					$sth = $Connection->db->prepare($query);
1818 1818
 					$sth->execute();
1819
-				} catch(PDOException $e) {
1819
+				} catch (PDOException $e) {
1820 1820
 					return "error (add column type_id in marine_output) : ".$e->getMessage()."\n";
1821 1821
 				}
1822 1822
 			}
1823
-			if (!$Connection->checkColumnName('marine_live','type_id')) {
1823
+			if (!$Connection->checkColumnName('marine_live', 'type_id')) {
1824 1824
 				$query = "ALTER TABLE marine_live ADD COLUMN type_id integer DEFAULT NULL";
1825 1825
 				try {
1826 1826
 					$sth = $Connection->db->prepare($query);
1827 1827
 					$sth->execute();
1828
-				} catch(PDOException $e) {
1828
+				} catch (PDOException $e) {
1829 1829
 					return "error (add column type_id in marine_live) : ".$e->getMessage()."\n";
1830 1830
 				}
1831 1831
 			}
1832
-			if (!$Connection->checkColumnName('marine_archive','type_id')) {
1832
+			if (!$Connection->checkColumnName('marine_archive', 'type_id')) {
1833 1833
 				$query = "ALTER TABLE marine_archive ADD COLUMN type_id integer DEFAULT NULL";
1834 1834
 				try {
1835 1835
 					$sth = $Connection->db->prepare($query);
1836 1836
 					$sth->execute();
1837
-				} catch(PDOException $e) {
1837
+				} catch (PDOException $e) {
1838 1838
 					return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n";
1839 1839
 				}
1840 1840
 			}
1841
-			if (!$Connection->checkColumnName('marine_archive_output','type_id')) {
1841
+			if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) {
1842 1842
 				$query = "ALTER TABLE marine_archive_output ADD COLUMN type_id integer DEFAULT NULL";
1843 1843
 				try {
1844 1844
 					$sth = $Connection->db->prepare($query);
1845 1845
 					$sth->execute();
1846
-				} catch(PDOException $e) {
1846
+				} catch (PDOException $e) {
1847 1847
 					return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n";
1848 1848
 				}
1849 1849
 			}
1850
-			if (!$Connection->checkColumnName('marine_output','status_id')) {
1850
+			if (!$Connection->checkColumnName('marine_output', 'status_id')) {
1851 1851
 				$query = "ALTER TABLE marine_output ADD COLUMN status_id integer DEFAULT NULL";
1852 1852
 				try {
1853 1853
 					$sth = $Connection->db->prepare($query);
1854 1854
 					$sth->execute();
1855
-				} catch(PDOException $e) {
1855
+				} catch (PDOException $e) {
1856 1856
 					return "error (add column status_id in marine_output) : ".$e->getMessage()."\n";
1857 1857
 				}
1858 1858
 			}
1859
-			if (!$Connection->checkColumnName('marine_live','status_id')) {
1859
+			if (!$Connection->checkColumnName('marine_live', 'status_id')) {
1860 1860
 				$query = "ALTER TABLE marine_live ADD COLUMN status_id integer DEFAULT NULL";
1861 1861
 				try {
1862 1862
 					$sth = $Connection->db->prepare($query);
1863 1863
 					$sth->execute();
1864
-				} catch(PDOException $e) {
1864
+				} catch (PDOException $e) {
1865 1865
 					return "error (add column status_id in marine_live) : ".$e->getMessage()."\n";
1866 1866
 				}
1867 1867
 			}
1868
-			if (!$Connection->checkColumnName('marine_archive','status_id')) {
1868
+			if (!$Connection->checkColumnName('marine_archive', 'status_id')) {
1869 1869
 				$query = "ALTER TABLE marine_archive ADD COLUMN status_id integer DEFAULT NULL";
1870 1870
 				try {
1871 1871
 					$sth = $Connection->db->prepare($query);
1872 1872
 					$sth->execute();
1873
-				} catch(PDOException $e) {
1873
+				} catch (PDOException $e) {
1874 1874
 					return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n";
1875 1875
 				}
1876 1876
 			}
1877
-			if (!$Connection->checkColumnName('marine_archive_output','status_id')) {
1877
+			if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) {
1878 1878
 				$query = "ALTER TABLE marine_archive_output ADD COLUMN status_id integer DEFAULT NULL";
1879 1879
 				try {
1880 1880
 					$sth = $Connection->db->prepare($query);
1881 1881
 					$sth->execute();
1882
-				} catch(PDOException $e) {
1882
+				} catch (PDOException $e) {
1883 1883
 					return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n";
1884 1884
 				}
1885 1885
 			}
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
 		try {
1889 1889
 			$sth = $Connection->db->prepare($query);
1890 1890
 			$sth->execute();
1891
-		} catch(PDOException $e) {
1891
+		} catch (PDOException $e) {
1892 1892
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1893 1893
 		}
1894 1894
 		return $error;
@@ -1903,14 +1903,14 @@  discard block
 block discarded – undo
1903 1903
 			try {
1904 1904
 				$sth = $Connection->db->prepare($query);
1905 1905
 				$sth->execute();
1906
-			} catch(PDOException $e) {
1906
+			} catch (PDOException $e) {
1907 1907
 				return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n";
1908 1908
 			}
1909 1909
 			$query = "ALTER TABLE marine_identity MODIFY COLUMN mmsi varchar(255) DEFAULT NULL";
1910 1910
 			try {
1911 1911
 				$sth = $Connection->db->prepare($query);
1912 1912
 				$sth->execute();
1913
-			} catch(PDOException $e) {
1913
+			} catch (PDOException $e) {
1914 1914
 				return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n";
1915 1915
 			}
1916 1916
 		} else {
@@ -1918,14 +1918,14 @@  discard block
 block discarded – undo
1918 1918
 			try {
1919 1919
 				$sth = $Connection->db->prepare($query);
1920 1920
 				$sth->execute();
1921
-			} catch(PDOException $e) {
1921
+			} catch (PDOException $e) {
1922 1922
 				return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n";
1923 1923
 			}
1924 1924
 			$query = "alter table marine_identity alter column mmsi type varchar(255)";
1925 1925
 			try {
1926 1926
 				$sth = $Connection->db->prepare($query);
1927 1927
 				$sth->execute();
1928
-			} catch(PDOException $e) {
1928
+			} catch (PDOException $e) {
1929 1929
 				return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n";
1930 1930
 			}
1931 1931
 		}
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
 		try {
1934 1934
 			$sth = $Connection->db->prepare($query);
1935 1935
 			$sth->execute();
1936
-		} catch(PDOException $e) {
1936
+		} catch (PDOException $e) {
1937 1937
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1938 1938
 		}
1939 1939
 		return $error;
@@ -1943,32 +1943,32 @@  discard block
 block discarded – undo
1943 1943
 		global $globalDBdriver;
1944 1944
 		$Connection = new Connection();
1945 1945
 		$error = '';
1946
-		if (!$Connection->checkColumnName('source_location','last_seen')) {
1946
+		if (!$Connection->checkColumnName('source_location', 'last_seen')) {
1947 1947
 			$query = "ALTER TABLE source_location ADD COLUMN last_seen timestamp NULL DEFAULT NULL";
1948 1948
 			try {
1949 1949
 				$sth = $Connection->db->prepare($query);
1950 1950
 				$sth->execute();
1951
-			} catch(PDOException $e) {
1951
+			} catch (PDOException $e) {
1952 1952
 				return "error (add column last_seen in source_location) : ".$e->getMessage()."\n";
1953 1953
 			}
1954 1954
 		}
1955 1955
 		if ($globalDBdriver == 'mysql') {
1956
-			if (!$Connection->checkColumnName('source_location','location_id')) {
1956
+			if (!$Connection->checkColumnName('source_location', 'location_id')) {
1957 1957
 				$query = "ALTER TABLE source_location ADD COLUMN location_id int(11) DEFAULT NULL";
1958 1958
 				try {
1959 1959
 					$sth = $Connection->db->prepare($query);
1960 1960
 					$sth->execute();
1961
-				} catch(PDOException $e) {
1961
+				} catch (PDOException $e) {
1962 1962
 					return "error (add column location_id in source_location) : ".$e->getMessage()."\n";
1963 1963
 				}
1964 1964
 			}
1965 1965
 		} else {
1966
-			if (!$Connection->checkColumnName('source_location','location_id')) {
1966
+			if (!$Connection->checkColumnName('source_location', 'location_id')) {
1967 1967
 				$query = "ALTER TABLE source_location ADD COLUMN location_id integer DEFAULT NULL";
1968 1968
 				try {
1969 1969
 					$sth = $Connection->db->prepare($query);
1970 1970
 					$sth->execute();
1971
-				} catch(PDOException $e) {
1971
+				} catch (PDOException $e) {
1972 1972
 					return "error (add column location_id in source_location) : ".$e->getMessage()."\n";
1973 1973
 				}
1974 1974
 			}
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 		try {
1978 1978
 			$sth = $Connection->db->prepare($query);
1979 1979
 			$sth->execute();
1980
-		} catch(PDOException $e) {
1980
+		} catch (PDOException $e) {
1981 1981
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1982 1982
 		}
1983 1983
 		return $error;
@@ -1987,12 +1987,12 @@  discard block
 block discarded – undo
1987 1987
 		global $globalDBdriver;
1988 1988
 		$Connection = new Connection();
1989 1989
 		$error = '';
1990
-		if (!$Connection->checkColumnName('source_location','description')) {
1990
+		if (!$Connection->checkColumnName('source_location', 'description')) {
1991 1991
 			$query = "ALTER TABLE source_location ADD COLUMN description text DEFAULT NULL";
1992 1992
 			try {
1993 1993
 				$sth = $Connection->db->prepare($query);
1994 1994
 				$sth->execute();
1995
-			} catch(PDOException $e) {
1995
+			} catch (PDOException $e) {
1996 1996
 				return "error (add column description in source_location) : ".$e->getMessage()."\n";
1997 1997
 			}
1998 1998
 		}
@@ -2000,7 +2000,7 @@  discard block
 block discarded – undo
2000 2000
 		try {
2001 2001
 			$sth = $Connection->db->prepare($query);
2002 2002
 			$sth->execute();
2003
-		} catch(PDOException $e) {
2003
+		} catch (PDOException $e) {
2004 2004
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2005 2005
 		}
2006 2006
 		return $error;
@@ -2010,39 +2010,39 @@  discard block
 block discarded – undo
2010 2010
 		global $globalDBdriver;
2011 2011
 		$Connection = new Connection();
2012 2012
 		$error = '';
2013
-		if (!$Connection->checkColumnName('spotter_live','real_altitude')) {
2013
+		if (!$Connection->checkColumnName('spotter_live', 'real_altitude')) {
2014 2014
 			$query = "ALTER TABLE spotter_live ADD COLUMN real_altitude float DEFAULT NULL";
2015 2015
 			try {
2016 2016
 				$sth = $Connection->db->prepare($query);
2017 2017
 				$sth->execute();
2018
-			} catch(PDOException $e) {
2018
+			} catch (PDOException $e) {
2019 2019
 				return "error (add column real_altitude in spotter_live) : ".$e->getMessage()."\n";
2020 2020
 			}
2021 2021
 		}
2022
-		if (!$Connection->checkColumnName('spotter_output','real_altitude')) {
2022
+		if (!$Connection->checkColumnName('spotter_output', 'real_altitude')) {
2023 2023
 			$query = "ALTER TABLE spotter_output ADD COLUMN real_altitude float DEFAULT NULL";
2024 2024
 			try {
2025 2025
 				$sth = $Connection->db->prepare($query);
2026 2026
 				$sth->execute();
2027
-			} catch(PDOException $e) {
2027
+			} catch (PDOException $e) {
2028 2028
 				return "error (add column real_altitude in spotter_output) : ".$e->getMessage()."\n";
2029 2029
 			}
2030 2030
 		}
2031
-		if (!$Connection->checkColumnName('spotter_archive_output','real_altitude')) {
2031
+		if (!$Connection->checkColumnName('spotter_archive_output', 'real_altitude')) {
2032 2032
 			$query = "ALTER TABLE spotter_archive_output ADD COLUMN real_altitude float DEFAULT NULL";
2033 2033
 			try {
2034 2034
 				$sth = $Connection->db->prepare($query);
2035 2035
 				$sth->execute();
2036
-			} catch(PDOException $e) {
2036
+			} catch (PDOException $e) {
2037 2037
 				return "error (add column real_altitude in spotter_archive_output) : ".$e->getMessage()."\n";
2038 2038
 			}
2039 2039
 		}
2040
-		if (!$Connection->checkColumnName('spotter_archive','real_altitude')) {
2040
+		if (!$Connection->checkColumnName('spotter_archive', 'real_altitude')) {
2041 2041
 			$query = "ALTER TABLE spotter_archive ADD COLUMN real_altitude float DEFAULT NULL";
2042 2042
 			try {
2043 2043
 				$sth = $Connection->db->prepare($query);
2044 2044
 				$sth->execute();
2045
-			} catch(PDOException $e) {
2045
+			} catch (PDOException $e) {
2046 2046
 				return "error (add column real_altitude in spotter_archive) : ".$e->getMessage()."\n";
2047 2047
 			}
2048 2048
 		}
@@ -2050,7 +2050,7 @@  discard block
 block discarded – undo
2050 2050
 		try {
2051 2051
 			$sth = $Connection->db->prepare($query);
2052 2052
 			$sth->execute();
2053
-		} catch(PDOException $e) {
2053
+		} catch (PDOException $e) {
2054 2054
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2055 2055
 		}
2056 2056
 		return $error;
@@ -2072,14 +2072,14 @@  discard block
 block discarded – undo
2072 2072
 		try {
2073 2073
 			$sth = $Connection->db->prepare($query);
2074 2074
 			$sth->execute();
2075
-		} catch(PDOException $e) {
2075
+		} catch (PDOException $e) {
2076 2076
 			return "error (modify column altitude in tracker_*) : ".$e->getMessage()."\n";
2077 2077
 		}
2078 2078
 		$query = "UPDATE config SET value = '44' WHERE name = 'schema_version'";
2079 2079
 		try {
2080 2080
 			$sth = $Connection->db->prepare($query);
2081 2081
 			$sth->execute();
2082
-		} catch(PDOException $e) {
2082
+		} catch (PDOException $e) {
2083 2083
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2084 2084
 		}
2085 2085
 		return $error;
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
 		try {
2121 2121
 			$sth = $Connection->db->prepare($query);
2122 2122
 			$sth->execute();
2123
-		} catch(PDOException $e) {
2123
+		} catch (PDOException $e) {
2124 2124
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2125 2125
 		}
2126 2126
 		return $error;
@@ -2143,7 +2143,7 @@  discard block
 block discarded – undo
2143 2143
 		try {
2144 2144
 			$sth = $Connection->db->prepare($query);
2145 2145
 			$sth->execute();
2146
-		} catch(PDOException $e) {
2146
+		} catch (PDOException $e) {
2147 2147
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2148 2148
 		}
2149 2149
 		return $error;
@@ -2193,7 +2193,7 @@  discard block
 block discarded – undo
2193 2193
 		try {
2194 2194
 			$sth = $Connection->db->prepare($query);
2195 2195
 			$sth->execute();
2196
-		} catch(PDOException $e) {
2196
+		} catch (PDOException $e) {
2197 2197
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2198 2198
 		}
2199 2199
 		return $error;
@@ -2216,7 +2216,7 @@  discard block
 block discarded – undo
2216 2216
 		try {
2217 2217
 			$sth = $Connection->db->prepare($query);
2218 2218
 			$sth->execute();
2219
-		} catch(PDOException $e) {
2219
+		} catch (PDOException $e) {
2220 2220
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2221 2221
 		}
2222 2222
 		return $error;
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 					try {
2240 2240
 						$sth = $Connection->db->prepare($query);
2241 2241
 						$sth->execute();
2242
-					} catch(PDOException $e) {
2242
+					} catch (PDOException $e) {
2243 2243
 						return "error (check_version): ".$e->getMessage()."\n";
2244 2244
 					}
2245 2245
 					$result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.