Completed
Push — master ( 75e641...0485dc )
by Yannick
33:10
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 = 51;
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 = 51;
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.Language.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	/**
78 78
 	* Returns list of available locales
79 79
 	*
80
-	* @return array
80
+	* @return string[]
81 81
 	*/
82 82
 	public function listLocaleDir()
83 83
 	{
@@ -97,6 +97,9 @@  discard block
 block discarded – undo
97 97
 		return $result;
98 98
 	}
99 99
 
100
+	/**
101
+	 * @param string $locale
102
+	 */
100 103
 	public function getLocale($locale)
101 104
 	{
102 105
 		return array($locale,$this->all_languages[$locale][1],$this->all_languages[$locale][2],$locale.'.utf8',$locale.'.UTF8');
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -24,54 +24,54 @@  discard block
 block discarded – undo
24 24
 }
25 25
 
26 26
 class Language {
27
-	public $all_languages = array('ar_SA' => array('العَرَبِيَّةُ',	'ar',	'arabic'),
28
-				'bg_BG' => array('Български',		'bg',	'bulgarian'),
29
-				'id_ID' => array('Bahasa Indonesia',	'id',	'indonesian'),
30
-				'ms_MY' => array('Bahasa Melayu',	'ms',	'malay'),
31
-				'ca_ES' => array('Català',		'ca',	'catalan'), // ca_CA
32
-				'cs_CZ' => array('Čeština',		'cs',	'czech'),
33
-				'de_DE' => array('Deutsch',		'de',	'german'),
34
-				'da_DK' => array('Dansk',		'da',	'danish')     , // dk_DK
35
-				'et_EE' => array('Eesti',		'et',	'estonian'), // ee_ET
36
-				'en_GB' => array('English',		'en',	'english'),
37
-				'en_US' => array('English (US)',	'en',	'english'),
38
-				'es_AR' => array('Español (Argentina)',	'es',	'spanish'),
39
-				'es_CO' => array('Español (Colombia)',	'es',	'spanish'),
40
-				'es_ES' => array('Español (España)',	'es',	'spanish'),
41
-				'es_419' => array('Español (América Latina)',	'es',	'spanish'),
42
-				'es_MX' => array('Español (Mexico)',	'es',	'spanish'),
43
-				'es_VE' => array('Español (Venezuela)',	'es',	'spanish'),
44
-				'eu_ES' => array('Euskara',		'en',	'basque'),
45
-				'fr_FR' => array('Français',		'fr',	'french'),
46
-				'gl_ES' => array('Galego',		'gl',	'galician'),
47
-				'el_GR' => array('Ελληνικά',		'el',	'greek'), // el_EL
48
-				'he_IL' => array('עברית',		'he',	'hebrew'), // he_HE
49
-				'hr_HR' => array('Hrvatski',		'hr',	'croatian'),
50
-				'hu_HU' => array('Magyar',		'hu',	'hungarian'),
51
-				'it_IT' => array('Italiano',		'it',	'italian'),
52
-				'lv_LV' => array('Latviešu',		'lv',	'latvian'),
53
-				'lt_LT' => array('Lietuvių',		'lt',	'lithuanian'),
54
-				'nl_NL' => array('Nederlands',		'nl',	'dutch'),
55
-				'nb_NO' => array('Norsk (Bokmål)',	'nb',	'norwegian'), // no_NB
56
-				'nn_NO' => array('Norsk (Nynorsk)',	'nn',	'norwegian'), // no_NN
57
-				'fa_IR' => array('فارسی',		'fa',	'persian'),
58
-				'pl_PL' => array('Polski',		'pl',	'polish'),
59
-				'pt_PT' => array('Português',		'pt',	'portuguese'),
60
-				'pt_BR' => array('Português do Brasil',	'pt',	'brazilian portuguese'),
61
-				'ro_RO' => array('Română',		'en',	'romanian'),
62
-				'ru_RU' => array('Pусский',		'ru',	'russian'),
63
-				'sk_SK' => array('Slovenčina',		'sk',	'slovak'),
64
-				'sl_SI' => array('Slovenščina',		'sl',	'slovenian slovene'),
65
-				'sr_RS' => array('Srpski',		'sr',	'serbian'),
66
-				'fi_FI' => array('Suomi',		'fi',	'finish'),
67
-				'sv_SE' => array('Svenska',		'sv',	'swedish'),
68
-				'vi_VN' => array('Tiếng Việt',		'vi',	'vietnamese'),
69
-				'th_TH' => array('ภาษาไทย',		'th',	'thai'),
70
-				'tr_TR' => array('Türkçe',		'tr',	'turkish'),
71
-				'uk_UA' => array('Українська',		'en',	'ukrainian'), // ua_UA
72
-				'ja_JP' => array('日本語',		'ja',	'japanese'),
73
-				'zh_CN' => array('简体中文',		'zh',	'chinese'),
74
-				'zh_TW' => array('繁體中文',		'zh',	'chinese')
27
+	public $all_languages = array('ar_SA' => array('العَرَبِيَّةُ', 'ar', 'arabic'),
28
+				'bg_BG' => array('Български', 'bg', 'bulgarian'),
29
+				'id_ID' => array('Bahasa Indonesia', 'id', 'indonesian'),
30
+				'ms_MY' => array('Bahasa Melayu', 'ms', 'malay'),
31
+				'ca_ES' => array('Català', 'ca', 'catalan'), // ca_CA
32
+				'cs_CZ' => array('Čeština', 'cs', 'czech'),
33
+				'de_DE' => array('Deutsch', 'de', 'german'),
34
+				'da_DK' => array('Dansk', 'da', 'danish'), // dk_DK
35
+				'et_EE' => array('Eesti', 'et', 'estonian'), // ee_ET
36
+				'en_GB' => array('English', 'en', 'english'),
37
+				'en_US' => array('English (US)', 'en', 'english'),
38
+				'es_AR' => array('Español (Argentina)', 'es', 'spanish'),
39
+				'es_CO' => array('Español (Colombia)', 'es', 'spanish'),
40
+				'es_ES' => array('Español (España)', 'es', 'spanish'),
41
+				'es_419' => array('Español (América Latina)', 'es', 'spanish'),
42
+				'es_MX' => array('Español (Mexico)', 'es', 'spanish'),
43
+				'es_VE' => array('Español (Venezuela)', 'es', 'spanish'),
44
+				'eu_ES' => array('Euskara', 'en', 'basque'),
45
+				'fr_FR' => array('Français', 'fr', 'french'),
46
+				'gl_ES' => array('Galego', 'gl', 'galician'),
47
+				'el_GR' => array('Ελληνικά', 'el', 'greek'), // el_EL
48
+				'he_IL' => array('עברית', 'he', 'hebrew'), // he_HE
49
+				'hr_HR' => array('Hrvatski', 'hr', 'croatian'),
50
+				'hu_HU' => array('Magyar', 'hu', 'hungarian'),
51
+				'it_IT' => array('Italiano', 'it', 'italian'),
52
+				'lv_LV' => array('Latviešu', 'lv', 'latvian'),
53
+				'lt_LT' => array('Lietuvių', 'lt', 'lithuanian'),
54
+				'nl_NL' => array('Nederlands', 'nl', 'dutch'),
55
+				'nb_NO' => array('Norsk (Bokmål)', 'nb', 'norwegian'), // no_NB
56
+				'nn_NO' => array('Norsk (Nynorsk)', 'nn', 'norwegian'), // no_NN
57
+				'fa_IR' => array('فارسی', 'fa', 'persian'),
58
+				'pl_PL' => array('Polski', 'pl', 'polish'),
59
+				'pt_PT' => array('Português', 'pt', 'portuguese'),
60
+				'pt_BR' => array('Português do Brasil', 'pt', 'brazilian portuguese'),
61
+				'ro_RO' => array('Română', 'en', 'romanian'),
62
+				'ru_RU' => array('Pусский', 'ru', 'russian'),
63
+				'sk_SK' => array('Slovenčina', 'sk', 'slovak'),
64
+				'sl_SI' => array('Slovenščina', 'sl', 'slovenian slovene'),
65
+				'sr_RS' => array('Srpski', 'sr', 'serbian'),
66
+				'fi_FI' => array('Suomi', 'fi', 'finish'),
67
+				'sv_SE' => array('Svenska', 'sv', 'swedish'),
68
+				'vi_VN' => array('Tiếng Việt', 'vi', 'vietnamese'),
69
+				'th_TH' => array('ภาษาไทย', 'th', 'thai'),
70
+				'tr_TR' => array('Türkçe', 'tr', 'turkish'),
71
+				'uk_UA' => array('Українська', 'en', 'ukrainian'), // ua_UA
72
+				'ja_JP' => array('日本語', 'ja', 'japanese'),
73
+				'zh_CN' => array('简体中文', 'zh', 'chinese'),
74
+				'zh_TW' => array('繁體中文', 'zh', 'chinese')
75 75
 			);
76 76
 
77 77
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 	public function getLocale($locale)
101 101
 	{
102
-		return array($locale,$this->all_languages[$locale][1],$this->all_languages[$locale][2],$locale.'.utf8',$locale.'.UTF8');
102
+		return array($locale, $this->all_languages[$locale][1], $this->all_languages[$locale][2], $locale.'.utf8', $locale.'.UTF8');
103 103
 	}
104 104
 
105 105
 	/**
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 		$allAvailableLanguages = array();
114 114
 		$currentLocal = setlocale(LC_ALL, 0);
115 115
 		foreach ($available as $lang) {
116
-			if (isset($this->all_languages[$lang]) && (setlocale(LC_ALL,$this->getLocale($lang)) || $lang = 'en_GB')) $allAvailableLanguages[$lang] = $this->all_languages[$lang];
116
+			if (isset($this->all_languages[$lang]) && (setlocale(LC_ALL, $this->getLocale($lang)) || $lang = 'en_GB')) $allAvailableLanguages[$lang] = $this->all_languages[$lang];
117 117
 		}
118
-		setlocale(LC_ALL,$currentLocal);
118
+		setlocale(LC_ALL, $currentLocal);
119 119
 		return $allAvailableLanguages;
120 120
 	}
121 121
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 			return $result;
87 87
 		}
88 88
 		$handle = @opendir(dirname(__FILE__).'/../locale');
89
-		if ($handle === false) return $result;
89
+		if ($handle === false) {
90
+			return $result;
91
+		}
90 92
 		while (false !== ($file = readdir($handle))) {
91 93
 			$path = dirname(__FILE__).'/../locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
92 94
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -113,7 +115,9 @@  discard block
 block discarded – undo
113 115
 		$allAvailableLanguages = array();
114 116
 		$currentLocal = setlocale(LC_ALL, 0);
115 117
 		foreach ($available as $lang) {
116
-			if (isset($this->all_languages[$lang]) && (setlocale(LC_ALL,$this->getLocale($lang)) || $lang = 'en_GB')) $allAvailableLanguages[$lang] = $this->all_languages[$lang];
118
+			if (isset($this->all_languages[$lang]) && (setlocale(LC_ALL,$this->getLocale($lang)) || $lang = 'en_GB')) {
119
+				$allAvailableLanguages[$lang] = $this->all_languages[$lang];
120
+			}
117 121
 		}
118 122
 		setlocale(LC_ALL,$currentLocal);
119 123
 		return $allAvailableLanguages;
Please login to merge, or discard this patch.
js/map.3d.js.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 			break;
315 315
 		}
316 316
 	}
317
-	var tsk_geojson = Cesium.loadJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>");
317
+	var tsk_geojson = Cesium.loadJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>");
318 318
 	tsk_geojson.then(function(geojsondata) {
319 319
 		tsk = new Cesium.CustomDataSource('tsk');
320 320
 		for (var i =0;i < geojsondata.features.length; i++) {
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 <?php
390 390
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
391 391
 		if (isset($_COOKIE['lastcentercoord'])) {
392
-			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
392
+			$lastcentercoord = explode(',', $_COOKIE['lastcentercoord']);
393 393
 			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
394 394
 			else $zoom = $lastcentercoord[3];
395 395
 			$viewcenterlatitude = $lastcentercoord[0];
Please login to merge, or discard this patch.
Braces   +47 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,21 +5,30 @@  discard block
 block discarded – undo
5 5
 
6 6
 document.cookie =  'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
7 7
 <?php
8
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
9
-	else $MapType = $globalMapProvider;
10
-//	unset($_COOKIE['MapType']);
8
+	if (isset($_COOKIE['MapType'])) {
9
+		$MapType = $_COOKIE['MapType'];
10
+	} else {
11
+		$MapType = $globalMapProvider;
12
+	}
13
+	//	unset($_COOKIE['MapType']);
11 14
 
12 15
 	if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road' && $MapType != 'offline' && $MapType != 'ArcGIS-Streetmap' && $MapType != 'ArcGIS-Satellite' && $MapType != 'NatGeo-Street') {
13
-		if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial';
14
-		else $MapType = 'OpenStreetMap';
16
+		if (isset($globalBingMapKey) && $globalBingMapKey != '') {
17
+			$MapType = 'Bing-Aerial';
18
+		} else {
19
+			$MapType = 'OpenStreetMap';
20
+		}
15 21
 	}
16 22
 	if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) {
17 23
 		$MapType = 'OpenStreetMap';
18 24
 	}
19 25
 	if ($MapType == 'Mapbox') {
20
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
21
-		else $MapBoxId = $_COOKIE['MapTypeId'];
22
-?>
26
+		if ($_COOKIE['MapTypeId'] == 'default') {
27
+			$MapBoxId = $globalMapboxId;
28
+		} else {
29
+			$MapBoxId = $_COOKIE['MapTypeId'];
30
+		}
31
+		?>
23 32
 	var imProv = Cesium.MapboxImageryProvider({
24 33
 		credit: 'Map data © OpenStreetMap contributors, ' +
25 34
 	      'CC-BY-SA, ' +
@@ -86,13 +95,23 @@  discard block
 block discarded – undo
86 95
 		credit : 'Imagery courtesy Natural Earth'
87 96
 	});
88 97
 <?php
89
-	}  elseif (isset($globalMapCustomLayer[$MapType])) {
98
+	} elseif (isset($globalMapCustomLayer[$MapType])) {
90 99
 		$customid = $MapType;
91 100
 ?>
92 101
 	var imProv = Cesium.createOpenStreetMapImageryProvider({
93 102
 		url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>',
94
-		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>,
95
-		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
103
+		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
104
+	print $globalMapCustomLayer[$customid]['maxZoom'];
105
+} else {
106
+	print '99';
107
+}
108
+?>,
109
+		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
110
+	print $globalMapCustomLayer[$customid]['minZoom'];
111
+} else {
112
+	print '0';
113
+}
114
+?>,
96 115
 		credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
97 116
 	});
98 117
 <?php
@@ -376,7 +395,12 @@  discard block
 block discarded – undo
376 395
 	imageryProvider : imProv,
377 396
 	timeline : archive,
378 397
 	animation : false,
379
-	shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) print 'false'; else print 'true'; ?>,
398
+	shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) {
399
+	print 'false';
400
+} else {
401
+	print 'true';
402
+}
403
+?>,
380 404
 	infoBox : false,
381 405
 	navigationHelpButton : false,
382 406
 	geocoder : false,
@@ -390,8 +414,11 @@  discard block
 block discarded – undo
390 414
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
391 415
 		if (isset($_COOKIE['lastcentercoord'])) {
392 416
 			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
393
-			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
394
-			else $zoom = $lastcentercoord[3];
417
+			if (!isset($lastcentercoord[3])) {
418
+				$zoom = $lastcentercoord[2]*1000000.0;
419
+			} else {
420
+				$zoom = $lastcentercoord[3];
421
+			}
395 422
 			$viewcenterlatitude = $lastcentercoord[0];
396 423
 			$viewcenterlongitude = $lastcentercoord[1];
397 424
 		} else {
@@ -473,7 +500,12 @@  discard block
 block discarded – undo
473 500
 ?>
474 501
 
475 502
 update_locationsLayer();
476
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
503
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
504
+	print $globalMapRefresh*1000*2;
505
+} else {
506
+	print '60000';
507
+}
508
+?>);
477 509
 viewer.camera.moveEnd.addEventListener(function() { 
478 510
 <?php
479 511
 	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
Please login to merge, or discard this patch.
airspace-geojson.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 $Connection = new Connection();
12 12
 
13 13
 if (!$Connection->tableExists('airspace')) {
14
-    die;
14
+	die;
15 15
 }
16 16
 
17 17
 if (isset($_GET['coord'])) 
18 18
 {
19 19
 	$coords = explode(',',$_GET['coord']);
20
-        if ($globalDBdriver == 'mysql') {
20
+		if ($globalDBdriver == 'mysql') {
21 21
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
22 22
 		try {
23 23
 			$sth = $Connection->db->prepare($query);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 	}
39 39
 } else {
40
-        if ($globalDBdriver == 'mysql') {
40
+		if ($globalDBdriver == 'mysql') {
41 41
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace";
42 42
 	} else {
43 43
 		$query = "SELECT *, ST_AsBinary(wkb_geometry,'NDR') AS wkb FROM airspace";
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 }
52 52
 
53 53
 $geojson = array(
54
-    'type' => 'FeatureCollection',
55
-    'features' => array()
54
+	'type' => 'FeatureCollection',
55
+	'features' => array()
56 56
 );
57 57
 
58 58
 while ($row = $sth->fetch(PDO::FETCH_ASSOC))
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		}
116 116
 		if (isset($properties['type']) && $properties['type'] != '') {
117 117
 			$feature = array(
118
-			    'type' => 'Feature',
119
-			    'geometry' => json_decode($geom->out('json')),
120
-			    'properties' => $properties
118
+				'type' => 'Feature',
119
+				'geometry' => json_decode($geom->out('json')),
120
+				'properties' => $properties
121 121
 			);
122 122
 			array_push($geojson['features'], $feature);
123 123
 		}
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 
17 17
 if (isset($_GET['coord'])) 
18 18
 {
19
-	$coords = explode(',',$_GET['coord']);
19
+	$coords = explode(',', $_GET['coord']);
20 20
         if ($globalDBdriver == 'mysql') {
21 21
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
22 22
 		try {
23 23
 			$sth = $Connection->db->prepare($query);
24
-			$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3]));
24
+			$sth->execute(array(':minlon' => $coords[0], ':minlat' => $coords[1], ':maxlon' => $coords[2], ':maxlat' => $coords[3]));
25 25
 			//$sth->execute();
26
-		} catch(PDOException $e) {
26
+		} catch (PDOException $e) {
27 27
 			echo "error";
28 28
 		}
29 29
 	} else {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 			$sth = $Connection->db->prepare($query);
33 33
 			//$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3]));
34 34
 			$sth->execute();
35
-		} catch(PDOException $e) {
35
+		} catch (PDOException $e) {
36 36
 			echo "error";
37 37
 		}
38 38
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	try {
46 46
 		$sth = $Connection->db->prepare($query);
47 47
 		$sth->execute();
48
-	} catch(PDOException $e) {
48
+	} catch (PDOException $e) {
49 49
 		echo "error";
50 50
 	}
51 51
 }
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 		if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling'];
76 76
 		if (isset($properties['floor'])) $properties['base'] = $properties['floor'];
77 77
 		if (isset($properties['tops'])) {
78
-			if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) {
78
+			if (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['tops']), $matches)) {
79 79
 				$properties['upper_limit'] = round($matches['alt']*100*0.38048);
80
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['tops']),$matches)) {
80
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['tops']), $matches)) {
81 81
 				$properties['upper_limit'] = round($matches['alt']*0.38048);
82
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['tops']),$matches)) {
82
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['tops']), $matches)) {
83 83
 				$properties['upper_limit'] = $matches['alt'];
84 84
 			}
85 85
 		}
86 86
 		if (isset($properties['base'])) {
87 87
 			if ($properties['base'] == 'SFC' || $properties['base'] == 'MSL' || $properties['base'] == 'GROUND' || $properties['base'] == 'GND') {
88 88
 				$properties['lower_limit'] = 0;
89
-			} elseif (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['base']),$matches)) {
89
+			} elseif (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['base']), $matches)) {
90 90
 				$properties['lower_limit'] = round($matches['alt']*100*0.38048);
91
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['base']),$matches)) {
91
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['base']), $matches)) {
92 92
 				$properties['lower_limit'] = round($matches['alt']*0.38048);
93
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['base']),$matches)) {
93
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['base']), $matches)) {
94 94
 				$properties['lower_limit'] = $matches['alt'];
95 95
 			}
96 96
 		}
Please login to merge, or discard this patch.
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,12 +68,22 @@
 block discarded – undo
68 68
 		} else {
69 69
 			$geom = geoPHP::load(stream_get_contents($row['wkb']));
70 70
 		}
71
-		if (isset($properties['type'])) $properties['type'] = trim($properties['type']);
72
-		elseif (isset($properties['class'])) $properties['type'] = trim($properties['class']);
73
-		if (isset($properties['ogr_fid'])) $properties['id'] = $properties['ogr_fid'];
74
-		elseif (isset($properties['ogc_fid'])) $properties['id'] = $properties['ogc_fid'];
75
-		if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling'];
76
-		if (isset($properties['floor'])) $properties['base'] = $properties['floor'];
71
+		if (isset($properties['type'])) {
72
+			$properties['type'] = trim($properties['type']);
73
+		} elseif (isset($properties['class'])) {
74
+			$properties['type'] = trim($properties['class']);
75
+		}
76
+		if (isset($properties['ogr_fid'])) {
77
+			$properties['id'] = $properties['ogr_fid'];
78
+		} elseif (isset($properties['ogc_fid'])) {
79
+			$properties['id'] = $properties['ogc_fid'];
80
+		}
81
+		if (isset($properties['ceiling'])) {
82
+			$properties['tops'] = $properties['ceiling'];
83
+		}
84
+		if (isset($properties['floor'])) {
85
+			$properties['base'] = $properties['floor'];
86
+		}
77 87
 		if (isset($properties['tops'])) {
78 88
 			if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) {
79 89
 				$properties['upper_limit'] = round($matches['alt']*100*0.38048);
Please login to merge, or discard this patch.
require/class.SpotterImport.php 2 patches
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 		$currentdate = date('Y-m-d');
35 35
 		$sourcestat = $Stats->getStatsSource($currentdate);
36 36
 		if (!empty($sourcestat)) {
37
-		    foreach($sourcestat as $srcst) {
37
+		    foreach ($sourcestat as $srcst) {
38 38
 		    	$type = $srcst['stats_type'];
39 39
 			if ($type == 'polar' || $type == 'hist') {
40 40
 			    $source = $srcst['source_name'];
41 41
 			    $data = $srcst['source_data'];
42
-			    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
42
+			    $this->stats[$currentdate][$source][$type] = json_decode($data, true);
43 43
 	    		}
44 44
 		    }
45 45
 		}
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 	if (isset($globalGeoid) && $globalGeoid) {
52 52
 		try {
53 53
 			$GeoidClass = new GeoidHeight();
54
-		} catch(Exception $e) {
54
+		} catch (Exception $e) {
55 55
 			if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n";
56 56
 			$GeoidClass = FALSE;
57 57
 		}
58 58
 	}
59 59
     }
60 60
 
61
-    public function get_Schedule($id,$ident) {
61
+    public function get_Schedule($id, $ident) {
62 62
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
63 63
 	// Get schedule here, so it's done only one time
64 64
 	
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 		$schedule = $Schedule->fetchSchedule($operator);
84 84
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
85 85
 		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
86
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
87
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
86
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime']));
87
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime']));
88 88
 		    // Should also check if route schedule = route from DB
89 89
 		    if ($schedule['DepartureAirportIATA'] != '') {
90 90
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			    }
105 105
 			}
106 106
 		    }
107
-		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
107
+		    $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']);
108 108
 		}
109 109
 	    } else $scheduleexist = true;
110 110
 	} else $scheduleexist = true;
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
        if ($scheduleexist) {
113 113
 		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
114 114
     		$sch = $Schedule->getSchedule($operator);
115
-		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time']));
116
-		if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']);
115
+		$this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time']));
116
+		if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'], $sch['departure_airport_icao'], $sch['departure_airport_time'], $sch['arrival_airport_icao'], $sch['arrival_airport_time']);
117 117
        }
118 118
 	$Spotter->db = null;
119 119
 	$Schedule->db = null;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
141 141
     		    $Spotter = new Spotter($this->db);
142 142
         	    $real_arrival = $this->arrival($key);
143
-        	    if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
143
+        	    if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']);
144 144
         	}
145 145
 	    }
146 146
 	}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $airport_time = '';
155 155
         if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
156 156
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
157
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
157
+	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist);
158 158
     	    if (isset($closestAirports[0])) {
159 159
         	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
160 160
         	    $airport_icao = $closestAirports[0]['icao'];
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         		    break;
170 170
         		}
171 171
         	    }
172
-        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
172
+        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) {
173 173
         		$airport_icao = $closestAirports[0]['icao'];
174 174
         		$airport_time = $this->all_flights[$key]['datetime'];
175 175
         	} else {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         } else {
183 183
         	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
184 184
         }
185
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
185
+        return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time);
186 186
     }
187 187
 
188 188
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
194 194
 	foreach ($this->all_flights as $key => $flight) {
195 195
 	    if (isset($flight['lastupdate'])) {
196
-		if ($flight['lastupdate'] < (time()-1800)) {
196
+		if ($flight['lastupdate'] < (time() - 1800)) {
197 197
 		    $this->delKey($key);
198 198
 		}
199 199
 	    }
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 			$Spotter = new Spotter($this->db);
211 211
 			$SpotterLive = new SpotterLive($this->db);
212 212
 			if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
213
-				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
213
+				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']);
214 214
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
215 215
 				$this->all_flights[$key]['putinarchive'] = true;
216
-				$result = $SpotterLive->addLiveSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['aircraft_icao'], $this->all_flights[$key]['departure_airport'], $this->all_flights[$key]['arrival_airport'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['waypoints'], $this->all_flights[$key]['altitude'],$this->all_flights[$key]['altitude_real'], $this->all_flights[$key]['heading'], $this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'], $this->all_flights[$key]['departure_airport_time'], $this->all_flights[$key]['arrival_airport_time'], $this->all_flights[$key]['squawk'],$this->all_flights[$key]['route_stop'],$this->all_flights[$key]['hex'],$this->all_flights[$key]['putinarchive'],$this->all_flights[$key]['registration'],$this->all_flights[$key]['pilot_id'],$this->all_flights[$key]['pilot_name'], $this->all_flights[$key]['verticalrate'], $this->all_flights[$key]['noarchive'], $this->all_flights[$key]['ground'],$this->all_flights[$key]['format_source'],$this->all_flights[$key]['source_name'],$this->all_flights[$key]['over_country']);
216
+				$result = $SpotterLive->addLiveSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['aircraft_icao'], $this->all_flights[$key]['departure_airport'], $this->all_flights[$key]['arrival_airport'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['waypoints'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['altitude_real'], $this->all_flights[$key]['heading'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $this->all_flights[$key]['departure_airport_time'], $this->all_flights[$key]['arrival_airport_time'], $this->all_flights[$key]['squawk'], $this->all_flights[$key]['route_stop'], $this->all_flights[$key]['hex'], $this->all_flights[$key]['putinarchive'], $this->all_flights[$key]['registration'], $this->all_flights[$key]['pilot_id'], $this->all_flights[$key]['pilot_name'], $this->all_flights[$key]['verticalrate'], $this->all_flights[$key]['noarchive'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['format_source'], $this->all_flights[$key]['source_name'], $this->all_flights[$key]['over_country']);
217 217
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
218 218
 			}
219 219
 			$Spotter->db = null;
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 	$send = false;
249 249
 	
250 250
 	// SBS format is CSV format
251
-	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
251
+	if (is_array($line) && (isset($line['hex']) || isset($line['id']))) {
252 252
 	    //print_r($line);
253 253
 	    if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
254
-  	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
254
+  	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'], 0, 1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
255 255
 
256 256
 		// Increment message number
257 257
 		if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) {
@@ -284,25 +284,25 @@  discard block
 block discarded – undo
284 284
 		if (!isset($this->all_flights[$id])) {
285 285
 		    if ($globalDebug) echo 'New flight...'."\n";
286 286
 		    $this->all_flights[$id] = array();
287
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
288
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
289
-		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
287
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
288
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'altitude_previous' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true, 'source_type' => ''));
289
+		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time()));
290 290
 		    if (!isset($line['id'])) {
291 291
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
292 292
 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
293 293
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
294
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
294
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi')));
295 295
 		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
296
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
296
+		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
297 297
 		    if ($globalAllFlights !== FALSE) $dataFound = true;
298 298
 		}
299 299
 		if (isset($line['source_type']) && $line['source_type'] != '') {
300
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
300
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type']));
301 301
 		}
302 302
 		
303 303
 		//print_r($this->all_flights);
304 304
 		if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) {
305
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
305
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex'])));
306 306
 		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
307 307
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
308 308
 		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
@@ -311,20 +311,20 @@  discard block
 block discarded – undo
311 311
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
312 312
 			    $Spotter = new Spotter($this->db);
313 313
 			    if (isset($this->all_flights[$id]['source_type'])) {
314
-				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']);
314
+				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']);
315 315
 			    } else {
316 316
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']));
317 317
 			    }
318 318
 			    $Spotter->db = null;
319
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
320
-			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
319
+			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
320
+			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
321 321
 			}
322 322
 		    }
323 323
 		    if ($globalAllFlights !== FALSE) $dataFound = true;
324 324
 		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
325 325
 		}
326 326
 	        if (isset($line['id']) && !isset($line['hex'])) {
327
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
327
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => ''));
328 328
 	        }
329 329
 		if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') {
330 330
 			$icao = $line['aircraft_icao'];
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 				if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao];
334 334
 				$Spotter->db = null;
335 335
 			}
336
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao));
336
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao));
337 337
 		} elseif (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) {
338 338
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
339 339
 				// Get aircraft ICAO from aircraft name
340 340
 				$Spotter = new Spotter($this->db);
341 341
 				$aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']);
342 342
 				$Spotter->db = null;
343
-				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
343
+				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
344 344
 			}
345 345
 		}
346 346
 		if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) {
@@ -348,15 +348,15 @@  discard block
 block discarded – undo
348 348
 			elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
349 349
 			elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
350 350
 			elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
351
-			if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
351
+			if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
352 352
 		}
353 353
 		if (!isset($this->all_flights[$id]['aircraft_icao'])) {
354
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
354
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA'));
355 355
 		}
356 356
 		//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
357
-		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
357
+		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) {
358 358
 		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
359
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
359
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime']));
360 360
 		    } else {
361 361
 				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
362 362
 				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
@@ -367,31 +367,31 @@  discard block
 block discarded – undo
367 367
 				*/
368 368
 				return '';
369 369
 		    }
370
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
370
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) {
371 371
 			if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
372 372
 			return '';
373
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
373
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) {
374 374
 			if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
375 375
 			return '';
376 376
 		} elseif (!isset($line['datetime'])) {
377 377
 			date_default_timezone_set('UTC');
378
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
378
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s')));
379 379
 		} else {
380 380
 			if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!";
381 381
 			return '';
382 382
 		}
383 383
 
384 384
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') {
385
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
385
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration']));
386 386
 		}
387 387
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
388
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
388
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints']));
389 389
 		}
390 390
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
391
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id'])));
391
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id'])));
392 392
 		}
393 393
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
394
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name'])));
394
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name'])));
395 395
 		}
396 396
  
397 397
 		if (isset($line['ident']) && trim($line['ident']) != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
400 400
 			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
401 401
 				if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n";
402
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
403
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
404
-				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
405
-				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
406
-				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
402
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
403
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1));
404
+				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi')));
405
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
406
+				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
407 407
 			} else {
408
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
408
+			    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident'])));
409 409
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
410 410
 				$timeelapsed = microtime(true);
411 411
             			$Spotter = new Spotter($this->db);
@@ -415,13 +415,13 @@  discard block
 block discarded – undo
415 415
 				elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
416 416
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
417 417
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
418
-            			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
418
+            			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource);
419 419
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
420 420
 				$Spotter->db = null;
421
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
421
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
422 422
 			    }
423 423
 			}
424
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
424
+		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident'])));
425 425
 		    
426 426
 /*
427 427
 		    if (!isset($line['id'])) {
@@ -431,25 +431,25 @@  discard block
 block discarded – undo
431 431
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
432 432
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
433 433
   */
434
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
434
+		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
435 435
 
436 436
 		    //$putinarchive = true;
437 437
 		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
438
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
438
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time']));
439 439
 		    }
440 440
 		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
441
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
441
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time']));
442 442
 		    }
443 443
 		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
444
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
444
+		    		$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
445 445
 		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
446 446
 			$timeelapsed = microtime(true);
447 447
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
448 448
 				$Spotter = new Spotter($this->db);
449 449
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
450 450
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
451
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
452
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
451
+		    		$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
452
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
453 453
                         }
454 454
 		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
455 455
 			$timeelapsed = microtime(true);
@@ -463,35 +463,35 @@  discard block
 block discarded – undo
463 463
 				$Translation->db = null;
464 464
 			    }
465 465
 			    $Spotter->db = null;
466
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
466
+			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
467 467
                     	}
468 468
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
469 469
 			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
470 470
 			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
471 471
 				//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
472
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
472
+		    		$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop']));
473 473
 		    	    }
474 474
 			}
475 475
 			if (!isset($globalFork)) $globalFork = TRUE;
476 476
 			if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
477
-				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
477
+				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident']));
478 478
 			}
479 479
 		    }
480 480
 		}
481 481
 
482 482
 		if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) {
483 483
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
484
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
485
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
484
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed'])));
485
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true));
486 486
 		    //$dataFound = true;
487 487
 		} else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
488
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
488
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm');
489 489
 		    if ($distance > 1000 && $distance < 10000) {
490 490
 		    // use datetime
491 491
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
492 492
 			$speed = $speed*3.6;
493 493
 			if ($speed < 1000) {
494
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
494
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed)));
495 495
 	  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
496 496
 	  		} else {
497 497
 	  			if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
 	    	    	if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
507 507
 	    	    	return false;
508 508
 	    	    }
509
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
509
+	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']);
510 510
 	    	    else unset($timediff);
511
-	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
511
+	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']);
512 512
 	    	    else unset($timediff_archive);
513 513
 	    	    if ($this->tmd > 5
514 514
 	    	        || (isset($line['format_source']) 
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
 	    	    	|| ($timediff > 30 
534 534
 	    	    	    && isset($this->all_flights[$id]['latitude']) 
535 535
 	    	    	    && isset($this->all_flights[$id]['longitude']) 
536
-	    	    	    && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'))
536
+	    	    	    && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'))
537 537
 	    	    	    )
538 538
 	    	    	) {
539 539
 
540 540
 			if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) {
541 541
 			    if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate)
542 542
 				|| (isset($line['format_source']) && $line['format_source'] == 'airwhere') 
543
-				|| !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
543
+				|| !$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) {
544 544
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
545 545
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
546 546
 				$this->all_flights[$id]['putinarchive'] = true;
@@ -550,11 +550,11 @@  discard block
 block discarded – undo
550 550
 				    $timeelapsed = microtime(true);
551 551
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
552 552
 					$Spotter = new Spotter($this->db);
553
-					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
553
+					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
554 554
 					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
555 555
 					else $this->all_flights[$id]['over_country'] = '';
556 556
 					$Spotter->db = null;
557
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
557
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
558 558
 					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
559 559
 				    }
560 560
 				}
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
 					$this->all_flights[$id]['time_last_coord'] = time();
581 581
 				}
582 582
 				//if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) {
583
-				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) {
583
+				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.0001)) {
584 584
 				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
585 585
 				    $dataFound = true;
586 586
 				    $this->all_flights[$id]['time_last_coord'] = time();
587 587
 				}
588 588
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
589
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
589
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude']));
590 590
 				/*
591 591
 				if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) {
592 592
 				    $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
@@ -608,13 +608,13 @@  discard block
 block discarded – undo
608 608
 					$this->all_flights[$id]['time_last_coord'] = time();
609 609
 				}
610 610
 				//if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) {
611
-				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) {
611
+				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > 0.0001)) {
612 612
 				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
613 613
 				    $dataFound = true;
614 614
 				    $this->all_flights[$id]['time_last_coord'] = time();
615 615
 				}
616 616
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
617
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
617
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude']));
618 618
 				/*
619 619
 				if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) {
620 620
 				    $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
@@ -632,46 +632,46 @@  discard block
 block discarded – undo
632 632
 		    } else if ($globalDebug && $timediff > 30) {
633 633
 			$this->tmd = $this->tmd + 1;
634 634
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
635
-			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
636
-			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
635
+			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -";
636
+			echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
637 637
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
638 638
 		    }
639 639
 		}
640 640
 		if (isset($line['last_update']) && $line['last_update'] != '') {
641 641
 		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
642
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
642
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update']));
643 643
 		}
644 644
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
645
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
645
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate']));
646 646
 		    //$dataFound = true;
647 647
 		}
648 648
 		if (isset($line['format_source']) && $line['format_source'] != '') {
649
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
649
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source']));
650 650
 		}
651 651
 		if (isset($line['source_name']) && $line['source_name'] != '') {
652
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
652
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name']));
653 653
 		}
654 654
 		if (isset($line['emergency']) && $line['emergency'] != '') {
655
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
655
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency']));
656 656
 		    //$dataFound = true;
657 657
 		}
658 658
 		if (isset($line['ground']) && $line['ground'] != '') {
659 659
 		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
660 660
 			// Here we force archive of flight because after ground it's a new one (or should be)
661
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
662
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
663
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
664
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
665
-			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
661
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
662
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1));
663
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi')));
664
+		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
665
+			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
666 666
 		    }
667 667
 		    if ($line['ground'] != 1) $line['ground'] = 0;
668
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
668
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground']));
669 669
 		    //$dataFound = true;
670 670
 		}
671 671
 		if (isset($line['squawk']) && $line['squawk'] != '') {
672 672
 		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
673 673
 			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
674
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
674
+			    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk']));
675 675
 			    $highlight = '';
676 676
 			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
677 677
 			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
@@ -680,66 +680,66 @@  discard block
 block discarded – undo
680 680
 				$timeelapsed = microtime(true);
681 681
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
682 682
 				    $Spotter = new Spotter($this->db);
683
-				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
683
+				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight);
684 684
 				    $Spotter->db = null;
685
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
685
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
686 686
 				}
687 687
 				//$putinarchive = true;
688 688
 				//$highlight = '';
689 689
 			    }
690 690
 			    
691
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
691
+		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk']));
692 692
 		    //$dataFound = true;
693 693
 		}
694 694
 
695 695
 		if (isset($line['altitude']) && $line['altitude'] != '') {
696 696
 			if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) {
697 697
 				if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') {
698
-					$geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2);
698
+					$geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2);
699 699
 					//if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n";
700 700
 					$line['altitude'] = $line['altitude'] - $geoid;
701 701
 				}
702 702
 			}
703 703
 		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
704
-			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true;
705
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
706
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
704
+			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true;
705
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100)));
706
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude']));
707 707
 			//$dataFound = true;
708 708
 		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
709 709
 		    if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
710 710
 			if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
711 711
 				if ($globalDebug) echo '--- Reset because of altitude'."\n";
712
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
713
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
714
-				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
715
-				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
716
-				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
712
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
713
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1));
714
+				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi')));
715
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
716
+				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
717 717
 			}
718 718
 		    }
719
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
719
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude']));
720 720
 		}
721 721
 
722 722
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
723
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
723
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true));
724 724
 		}
725 725
 		
726 726
 		if (isset($line['heading']) && $line['heading'] != '') {
727
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
728
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
729
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
727
+		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
728
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading'])));
729
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true));
730 730
 		    //$dataFound = true;
731 731
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
732
-  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
733
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
734
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
732
+  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']);
733
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading)));
734
+		    if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
735 735
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
736 736
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
737 737
   		    // If not enough messages and ACARS set heading to 0
738
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
738
+  		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0));
739 739
   		}
740
-		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
741
-		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
742
-		elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false;
740
+		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
741
+		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
742
+		elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false;
743 743
 
744 744
 //		print_r($this->all_flights[$id]);
745 745
 		//gets the callsign from the last hour
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 		if ($dataFound === true && isset($this->all_flights[$id]['id'])) {
751 751
 		    $this->all_flights[$id]['lastupdate'] = time();
752 752
 		    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
753
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
753
+		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
754 754
 			    //print_r($this->all_flights);
755 755
 			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
756 756
 			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
@@ -761,61 +761,61 @@  discard block
 block discarded – undo
761 761
 				    $SpotterLive = new SpotterLive($this->db);
762 762
 				    if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
763 763
 					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
764
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
764
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
765 765
 				    } elseif (isset($line['id'])) {
766 766
 					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
767
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
767
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
768 768
 				    } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
769 769
 					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
770
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
770
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
771 771
 				    } else $recent_ident = '';
772
-				    $SpotterLive->db=null;
772
+				    $SpotterLive->db = null;
773 773
 				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
774 774
 				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
775 775
 				} else $recent_ident = '';
776 776
 			    } else {
777 777
 				$recent_ident = '';
778
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
778
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0));
779 779
 			    }
780 780
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
781
-			    if($recent_ident == "")
781
+			    if ($recent_ident == "")
782 782
 			    {
783 783
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
784 784
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
785 785
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
786 786
 				//adds the spotter data for the archive
787 787
 				$ignoreImport = false;
788
-				foreach($globalAirportIgnore as $airportIgnore) {
788
+				foreach ($globalAirportIgnore as $airportIgnore) {
789 789
 				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
790 790
 					$ignoreImport = true;
791 791
 				    }
792 792
 				}
793 793
 				if (count($globalAirportAccept) > 0) {
794 794
 				    $ignoreImport = true;
795
-				    foreach($globalAirportIgnore as $airportIgnore) {
795
+				    foreach ($globalAirportIgnore as $airportIgnore) {
796 796
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
797 797
 					    $ignoreImport = false;
798 798
 					}
799 799
 				    }
800 800
 				}
801 801
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
802
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
803
-					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
802
+				    foreach ($globalAirlineIgnore as $airlineIgnore) {
803
+					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) {
804 804
 					    $ignoreImport = true;
805 805
 					}
806 806
 				    }
807 807
 				}
808 808
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
809 809
 				    $ignoreImport = true;
810
-				    foreach($globalAirlineAccept as $airlineAccept) {
811
-					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
810
+				    foreach ($globalAirlineAccept as $airlineAccept) {
811
+					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) {
812 812
 					    $ignoreImport = false;
813 813
 					}
814 814
 				    }
815 815
 				}
816 816
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
817 817
 				    $ignoreImport = true;
818
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
818
+				    foreach ($globalPilotIdAccept as $pilotIdAccept) {
819 819
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
820 820
 					    $ignoreImport = false;
821 821
 					}
@@ -827,32 +827,32 @@  discard block
 block discarded – undo
827 827
 				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
828 828
 				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
829 829
 				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
830
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
830
+				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
831 831
 				    $timeelapsed = microtime(true);
832 832
 				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
833 833
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
834 834
 					    $Spotter = new Spotter($this->db);
835
-					    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
835
+					    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['source_type']);
836 836
 					    $Spotter->db = null;
837 837
 					    if ($globalDebug && isset($result)) echo $result."\n";
838 838
 					}
839 839
 				    }
840
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
840
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
841 841
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
842 842
 
843 843
 				    // Add source stat in DB
844 844
 				    $Stats = new Stats($this->db);
845 845
 				    if (!empty($this->stats)) {
846 846
 					if ($globalDebug) echo 'Add source stats : ';
847
-				        foreach($this->stats as $date => $data) {
848
-					    foreach($data as $source => $sourced) {
847
+				        foreach ($this->stats as $date => $data) {
848
+					    foreach ($data as $source => $sourced) {
849 849
 					        //print_r($sourced);
850
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
851
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
850
+				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date);
851
+				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date);
852 852
 				    		if (isset($sourced['msg'])) {
853 853
 				    		    if (time() - $sourced['msg']['date'] > 10) {
854 854
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
855
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
855
+				    		        echo $Stats->addStatSource($nbmsg, $source, 'msg', $date);
856 856
 			    			        unset($this->stats[$date][$source]['msg']);
857 857
 			    			    }
858 858
 			    			}
@@ -890,14 +890,14 @@  discard block
 block discarded – undo
890 890
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
891 891
 					    $SpotterLive = new SpotterLive($this->db);
892 892
 					    $SpotterLive->deleteLiveSpotterData();
893
-					    $SpotterLive->db=null;
893
+					    $SpotterLive->db = null;
894 894
 					}
895 895
 				    }
896 896
 				    if ($globalDebug) echo " Done\n";
897 897
 				    $this->last_delete = time();
898 898
 				}
899 899
 			    } else {
900
-				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa'  || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) {
900
+				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) {
901 901
 				    $this->all_flights[$id]['id'] = $recent_ident;
902 902
 				    $this->all_flights[$id]['addedSpotter'] = 1;
903 903
 				}
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
906 906
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
907 907
 					    $Spotter = new Spotter($this->db);
908
-					    $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']);
908
+					    $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']);
909 909
 					    $Spotter->db = null;
910 910
 					}
911 911
 				    }
@@ -931,37 +931,37 @@  discard block
 block discarded – undo
931 931
 		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
932 932
 		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
933 933
 
934
-		    foreach($globalAirportIgnore as $airportIgnore) {
934
+		    foreach ($globalAirportIgnore as $airportIgnore) {
935 935
 		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
936 936
 			    $ignoreImport = true;
937 937
 			}
938 938
 		    }
939 939
 		    if (count($globalAirportAccept) > 0) {
940 940
 		        $ignoreImport = true;
941
-		        foreach($globalAirportIgnore as $airportIgnore) {
941
+		        foreach ($globalAirportIgnore as $airportIgnore) {
942 942
 			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
943 943
 				$ignoreImport = false;
944 944
 			    }
945 945
 			}
946 946
 		    }
947 947
 		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
948
-			foreach($globalAirlineIgnore as $airlineIgnore) {
949
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
948
+			foreach ($globalAirlineIgnore as $airlineIgnore) {
949
+			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) {
950 950
 				$ignoreImport = true;
951 951
 			    }
952 952
 			}
953 953
 		    }
954 954
 		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
955 955
 			$ignoreImport = true;
956
-			foreach($globalAirlineAccept as $airlineAccept) {
957
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
956
+			foreach ($globalAirlineAccept as $airlineAccept) {
957
+			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) {
958 958
 				$ignoreImport = false;
959 959
 			    }
960 960
 			}
961 961
 		    }
962 962
 		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
963 963
 			$ignoreImport = true;
964
-			foreach($globalPilotIdAccept as $pilotIdAccept) {
964
+			foreach ($globalPilotIdAccept as $pilotIdAccept) {
965 965
 			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
966 966
 			        $ignoreImport = false;
967 967
 			    }
@@ -969,23 +969,23 @@  discard block
 block discarded – undo
969 969
 		    }
970 970
 
971 971
 		    if (!$ignoreImport) {
972
-			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
973
-				if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
972
+			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
973
+				if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
974 974
 				$timeelapsed = microtime(true);
975 975
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
976 976
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
977 977
 					if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
978 978
 					$SpotterLive = new SpotterLive($this->db);
979
-					$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
979
+					$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']);
980 980
 					$SpotterLive->db = null;
981 981
 					if ($globalDebug) echo $result."\n";
982 982
 				    }
983 983
 				}
984 984
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) {
985
-					$APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
985
+					$APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']);
986 986
 				}
987 987
 				$this->all_flights[$id]['putinarchive'] = false;
988
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
988
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
989 989
 
990 990
 				// Put statistics in $this->stats variable
991 991
 				//if ($line['format_source'] != 'aprs') {
@@ -1004,19 +1004,19 @@  discard block
 block discarded – undo
1004 1004
 							$latitude = $globalCenterLatitude;
1005 1005
 							$longitude = $globalCenterLongitude;
1006 1006
 						}
1007
-						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude);
1007
+						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude);
1008 1008
 					} else {
1009 1009
 						$latitude = $this->source_location[$source]['latitude'];
1010 1010
 						$longitude = $this->source_location[$source]['longitude'];
1011 1011
 					}
1012
-					$stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
1012
+					$stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']);
1013 1013
 					//$stats_heading = $stats_heading%22.5;
1014 1014
 					$stats_heading = round($stats_heading/22.5);
1015
-					$stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
1015
+					$stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']);
1016 1016
 					$current_date = date('Y-m-d');
1017 1017
 					if ($stats_heading == 16) $stats_heading = 0;
1018 1018
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
1019
-						for ($i=0;$i<=15;$i++) {
1019
+						for ($i = 0; $i <= 15; $i++) {
1020 1020
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
1021 1021
 						}
1022 1022
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
1032 1032
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
1033 1033
 						    end($this->stats[$current_date][$source]['hist']);
1034
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
1034
+						    $mini = key($this->stats[$current_date][$source]['hist']) + 10;
1035 1035
 						} else $mini = 0;
1036
-						for ($i=$mini;$i<=$distance;$i+=10) {
1036
+						for ($i = $mini; $i <= $distance; $i += 10) {
1037 1037
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
1038 1038
 						}
1039 1039
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 				$this->all_flights[$id]['lastupdate'] = time();
1047 1047
 				if ($this->all_flights[$id]['putinarchive']) $send = true;
1048 1048
 				//if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1049
-			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1049
+			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n";
1050 1050
 			//$this->del();
1051 1051
 			
1052 1052
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
Please login to merge, or discard this patch.
Braces   +407 added lines, -145 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 		try {
53 53
 			$GeoidClass = new GeoidHeight();
54 54
 		} catch(Exception $e) {
55
-			if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n";
55
+			if ($globalDebug) {
56
+				echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n";
57
+			}
56 58
 			$GeoidClass = FALSE;
57 59
 		}
58 60
 	}
@@ -71,7 +73,9 @@  discard block
 block discarded – undo
71 73
 	$dbc = $this->db;
72 74
 	$this->all_flights[$id]['schedule_check'] = true;
73 75
 	if ($globalSchedulesFetch) {
74
-	if ($globalDebug) echo 'Getting schedule info...'."\n";
76
+	if ($globalDebug) {
77
+		echo 'Getting schedule info...'."\n";
78
+	}
75 79
 	$Spotter = new Spotter($dbc);
76 80
 	$Schedule = new Schedule($dbc);
77 81
 	$Translation = new Translation($dbc);
@@ -82,7 +86,9 @@  discard block
 block discarded – undo
82 86
 	    if ($Schedule->checkSchedule($operator) == 0) {
83 87
 		$schedule = $Schedule->fetchSchedule($operator);
84 88
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
85
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
89
+		    if ($globalDebug) {
90
+		    	echo "-> Schedule info for ".$operator." (".$ident.")\n";
91
+		    }
86 92
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
87 93
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
88 94
 		    // Should also check if route schedule = route from DB
@@ -91,7 +97,9 @@  discard block
 block discarded – undo
91 97
 			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
92 98
 			    if (trim($airport_icao) != '') {
93 99
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
94
-				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
100
+				if ($globalDebug) {
101
+					echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
102
+				}
95 103
 			    }
96 104
 			}
97 105
 		    }
@@ -100,20 +108,30 @@  discard block
 block discarded – undo
100 108
 			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
101 109
 			    if (trim($airport_icao) != '') {
102 110
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
103
-				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
111
+				if ($globalDebug) {
112
+					echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
113
+				}
104 114
 			    }
105 115
 			}
106 116
 		    }
107 117
 		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
108 118
 		}
109
-	    } else $scheduleexist = true;
110
-	} else $scheduleexist = true;
119
+	    } else {
120
+	    	$scheduleexist = true;
121
+	    }
122
+	} else {
123
+		$scheduleexist = true;
124
+	}
111 125
 	// close connection, at least one way will work ?
112 126
        if ($scheduleexist) {
113
-		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
127
+		if ($globalDebug) {
128
+			echo "-> get arrival/departure airport info for ".$ident."\n";
129
+		}
114 130
     		$sch = $Schedule->getSchedule($operator);
115 131
 		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time']));
116
-		if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']);
132
+		if ($this->all_flights[$id]['addedSpotter'] == 1) {
133
+			$Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']);
134
+		}
117 135
        }
118 136
 	$Spotter->db = null;
119 137
 	$Schedule->db = null;
@@ -133,14 +151,18 @@  discard block
 block discarded – undo
133 151
 
134 152
     public function checkAll() {
135 153
 	global $globalDebug, $globalNoImport;
136
-	if ($globalDebug) echo "Update last seen flights data...\n";
154
+	if ($globalDebug) {
155
+		echo "Update last seen flights data...\n";
156
+	}
137 157
 	if (!isset($globalNoImport) || $globalNoImport === FALSE) {
138 158
 	    foreach ($this->all_flights as $key => $flight) {
139 159
 		if (isset($this->all_flights[$key]['id'])) {
140 160
 		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
141 161
     		    $Spotter = new Spotter($this->db);
142 162
         	    $real_arrival = $this->arrival($key);
143
-        	    if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
163
+        	    if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) {
164
+        	    	$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
165
+        	    }
144 166
         	}
145 167
 	    }
146 168
 	}
@@ -148,24 +170,32 @@  discard block
 block discarded – undo
148 170
 
149 171
     public function arrival($key) {
150 172
 	global $globalClosestMinDist, $globalDebug;
151
-	if ($globalDebug) echo 'Update arrival...'."\n";
173
+	if ($globalDebug) {
174
+		echo 'Update arrival...'."\n";
175
+	}
152 176
 	$Spotter = new Spotter($this->db);
153 177
         $airport_icao = '';
154 178
         $airport_time = '';
155
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
179
+        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') {
180
+        	$globalClosestMinDist = 50;
181
+        }
156 182
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
157 183
 	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
158 184
     	    if (isset($closestAirports[0])) {
159 185
         	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
160 186
         	    $airport_icao = $closestAirports[0]['icao'];
161 187
         	    $airport_time = $this->all_flights[$key]['datetime'];
162
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
188
+        	    if ($globalDebug) {
189
+        	    	echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
190
+        	    }
163 191
         	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
164 192
         	    foreach ($closestAirports as $airport) {
165 193
         		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
166 194
         		    $airport_icao = $airport['icao'];
167 195
         		    $airport_time = $this->all_flights[$key]['datetime'];
168
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
196
+        		    if ($globalDebug) {
197
+        		    	echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
198
+        		    }
169 199
         		    break;
170 200
         		}
171 201
         	    }
@@ -173,14 +203,20 @@  discard block
 block discarded – undo
173 203
         		$airport_icao = $closestAirports[0]['icao'];
174 204
         		$airport_time = $this->all_flights[$key]['datetime'];
175 205
         	} else {
176
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
206
+        		if ($globalDebug) {
207
+        			echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
208
+        		}
177 209
         	}
178 210
     	    } else {
179
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
211
+    		    if ($globalDebug) {
212
+    		    	echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
213
+    		    }
180 214
     	    }
181 215
 
182 216
         } else {
183
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
217
+        	if ($globalDebug) {
218
+        		echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
219
+        	}
184 220
         }
185 221
         return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
186 222
     }
@@ -190,7 +226,9 @@  discard block
 block discarded – undo
190 226
     public function del() {
191 227
 	global $globalDebug, $globalNoImport, $globalNoDB;
192 228
 	// Delete old infos
193
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
229
+	if ($globalDebug) {
230
+		echo 'Delete old values and update latest data...'."\n";
231
+	}
194 232
 	foreach ($this->all_flights as $key => $flight) {
195 233
 	    if (isset($flight['lastupdate'])) {
196 234
 		if ($flight['lastupdate'] < (time()-1800)) {
@@ -204,17 +242,23 @@  discard block
 block discarded – undo
204 242
 	global $globalDebug, $globalNoImport, $globalNoDB;
205 243
 	// Delete old infos
206 244
 	if (isset($this->all_flights[$key]['id'])) {
207
-		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
245
+		if ($globalDebug) {
246
+			echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
247
+		}
208 248
 		if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
209 249
 			$real_arrival = $this->arrival($key);
210 250
 			$Spotter = new Spotter($this->db);
211 251
 			$SpotterLive = new SpotterLive($this->db);
212 252
 			if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
213 253
 				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
214
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
254
+				if ($globalDebug && $result != 'success') {
255
+					echo '!!! ERROR : '.$result."\n";
256
+				}
215 257
 				$this->all_flights[$key]['putinarchive'] = true;
216 258
 				$result = $SpotterLive->addLiveSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['aircraft_icao'], $this->all_flights[$key]['departure_airport'], $this->all_flights[$key]['arrival_airport'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['waypoints'], $this->all_flights[$key]['altitude'],$this->all_flights[$key]['altitude_real'], $this->all_flights[$key]['heading'], $this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'], $this->all_flights[$key]['departure_airport_time'], $this->all_flights[$key]['arrival_airport_time'], $this->all_flights[$key]['squawk'],$this->all_flights[$key]['route_stop'],$this->all_flights[$key]['hex'],$this->all_flights[$key]['putinarchive'],$this->all_flights[$key]['registration'],$this->all_flights[$key]['pilot_id'],$this->all_flights[$key]['pilot_name'], $this->all_flights[$key]['verticalrate'], $this->all_flights[$key]['noarchive'], $this->all_flights[$key]['ground'],$this->all_flights[$key]['format_source'],$this->all_flights[$key]['source_name'],$this->all_flights[$key]['over_country']);
217
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
259
+				if ($globalDebug && $result != 'success') {
260
+					echo '!!! ERROR : '.$result."\n";
261
+				}
218 262
 			}
219 263
 			$Spotter->db = null;
220 264
 			$SpotterLive->db = null;
@@ -226,9 +270,13 @@  discard block
 block discarded – undo
226 270
     public function add($line) {
227 271
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive;
228 272
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
229
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01';
230
-	if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') $globalAircraftMaxUpdate = 3000;
231
-/*
273
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
274
+		$globalCoordMinChange = '0.01';
275
+	}
276
+	if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') {
277
+		$globalAircraftMaxUpdate = 3000;
278
+	}
279
+	/*
232 280
 	$Spotter = new Spotter();
233 281
 	$dbc = $Spotter->db;
234 282
 	$SpotterLive = new SpotterLive($dbc);
@@ -250,19 +298,28 @@  discard block
 block discarded – undo
250 298
 	// SBS format is CSV format
251 299
 	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
252 300
 	    //print_r($line);
253
-	    if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
301
+	    if (isset($line['hex'])) {
302
+	    	$line['hex'] = strtoupper($line['hex']);
303
+	    }
254 304
   	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
255 305
 
256 306
 		// Increment message number
257 307
 		if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) {
258 308
 		    $current_date = date('Y-m-d');
259
-		    if (isset($line['source_name'])) $source = $line['source_name'];
260
-		    else $source = '';
261
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
309
+		    if (isset($line['source_name'])) {
310
+		    	$source = $line['source_name'];
311
+		    } else {
312
+		    	$source = '';
313
+		    }
314
+		    if ($source == '' || $line['format_source'] == 'aprs') {
315
+		    	$source = $line['format_source'];
316
+		    }
262 317
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
263 318
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
264 319
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
265
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
320
+		    } else {
321
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
322
+		    }
266 323
 		}
267 324
 		
268 325
 		/*
@@ -278,23 +335,38 @@  discard block
 block discarded – undo
278 335
 		//$this->db = $dbc;
279 336
 
280 337
 		//$hex = trim($line['hex']);
281
-	        if (!isset($line['id'])) $id = trim($line['hex']);
282
-	        else $id = trim($line['id']);
338
+	        if (!isset($line['id'])) {
339
+	        	$id = trim($line['hex']);
340
+	        } else {
341
+	        	$id = trim($line['id']);
342
+	        }
283 343
 		
284 344
 		if (!isset($this->all_flights[$id])) {
285
-		    if ($globalDebug) echo 'New flight...'."\n";
345
+		    if ($globalDebug) {
346
+		    	echo 'New flight...'."\n";
347
+		    }
286 348
 		    $this->all_flights[$id] = array();
287 349
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
288 350
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
289
-		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
351
+		    if (isset($globalDaemon) && $globalDaemon === FALSE) {
352
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
353
+		    }
290 354
 		    if (!isset($line['id'])) {
291
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
292
-//			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
355
+			if (!isset($globalDaemon)) {
356
+				$globalDaemon = TRUE;
357
+			}
358
+			//			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
293 359
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
294
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
360
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
361
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
362
+			}
295 363
 		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
296
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
297
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
364
+		     } else {
365
+		     	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
366
+		     }
367
+		    if ($globalAllFlights !== FALSE) {
368
+		    	$dataFound = true;
369
+		    }
298 370
 		}
299 371
 		if (isset($line['source_type']) && $line['source_type'] != '') {
300 372
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
@@ -316,12 +388,20 @@  discard block
 block discarded – undo
316 388
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']));
317 389
 			    }
318 390
 			    $Spotter->db = null;
319
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
320
-			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
391
+			    if ($globalDebugTimeElapsed) {
392
+			    	echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
393
+			    }
394
+			    if ($aircraft_icao != '') {
395
+			    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
396
+			    }
321 397
 			}
322 398
 		    }
323
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
324
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
399
+		    if ($globalAllFlights !== FALSE) {
400
+		    	$dataFound = true;
401
+		    }
402
+		    if ($globalDebug) {
403
+		    	echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
404
+		    }
325 405
 		}
326 406
 	        if (isset($line['id']) && !isset($line['hex'])) {
327 407
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
@@ -330,7 +410,9 @@  discard block
 block discarded – undo
330 410
 			$icao = $line['aircraft_icao'];
331 411
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
332 412
 				$Spotter = new Spotter($this->db);
333
-				if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao];
413
+				if (isset($Spotter->aircraft_correct_icaotype[$icao])) {
414
+					$icao = $Spotter->aircraft_correct_icaotype[$icao];
415
+				}
334 416
 				$Spotter->db = null;
335 417
 			}
336 418
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao));
@@ -340,15 +422,24 @@  discard block
 block discarded – undo
340 422
 				$Spotter = new Spotter($this->db);
341 423
 				$aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']);
342 424
 				$Spotter->db = null;
343
-				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
425
+				if ($aircraft_icao != '') {
426
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
427
+				}
344 428
 			}
345 429
 		}
346 430
 		if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) {
347
-			if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
348
-			elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
349
-			elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
350
-			elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
351
-			if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
431
+			if ($line['aircraft_type'] == 'PARA_GLIDER') {
432
+				$aircraft_icao = 'GLID';
433
+			} elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') {
434
+				$aircraft_icao = 'UHEL';
435
+			} elseif ($line['aircraft_type'] == 'TOW_PLANE') {
436
+				$aircraft_icao = 'TOWPLANE';
437
+			} elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') {
438
+				$aircraft_icao = 'POWAIRC';
439
+			}
440
+			if (isset($aircraft_icao)) {
441
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
442
+			}
352 443
 		}
353 444
 		if (!isset($this->all_flights[$id]['aircraft_icao'])) {
354 445
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
@@ -358,8 +449,11 @@  discard block
 block discarded – undo
358 449
 		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
359 450
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
360 451
 		    } else {
361
-				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
362
-				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
452
+				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) {
453
+					echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
454
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) {
455
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
456
+				}
363 457
 				/*
364 458
 				echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']);
365 459
 				print_r($this->all_flights[$id]);
@@ -368,16 +462,22 @@  discard block
 block discarded – undo
368 462
 				return '';
369 463
 		    }
370 464
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
371
-			if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
465
+			if ($globalDebug) {
466
+				echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
467
+			}
372 468
 			return '';
373 469
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
374
-			if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
470
+			if ($globalDebug) {
471
+				echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
472
+			}
375 473
 			return '';
376 474
 		} elseif (!isset($line['datetime'])) {
377 475
 			date_default_timezone_set('UTC');
378 476
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
379 477
 		} else {
380
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!";
478
+			if ($globalDebug) {
479
+				echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!";
480
+			}
381 481
 			return '';
382 482
 		}
383 483
 
@@ -398,30 +498,48 @@  discard block
 block discarded – undo
398 498
 
399 499
 		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
400 500
 			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
401
-				if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n";
501
+				if ($globalDebug) {
502
+					echo '---!!!! New ident, reset aircraft data...'."\n";
503
+				}
402 504
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
403 505
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
404
-				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
405
-				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
406
-				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
506
+				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
507
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
508
+				} elseif (isset($line['id'])) {
509
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
510
+				} elseif (isset($this->all_flights[$id]['ident'])) {
511
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
512
+				}
407 513
 			} else {
408 514
 			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
409 515
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
410 516
 				$timeelapsed = microtime(true);
411 517
             			$Spotter = new Spotter($this->db);
412 518
             			$fromsource = NULL;
413
-            			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
414
-            			elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
415
-				elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
416
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
417
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
519
+            			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
520
+            				$fromsource = $globalAirlinesSource;
521
+            			} elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') {
522
+            				$fromsource = 'vatsim';
523
+            			} elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') {
524
+					$fromsource = 'ivao';
525
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
526
+					$fromsource = 'vatsim';
527
+				} elseif (isset($globalIVAO) && $globalIVAO) {
528
+					$fromsource = 'ivao';
529
+				}
418 530
             			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
419
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
531
+				if ($globalDebug && $result != 'success') {
532
+					echo '!!! ERROR : '.$result."\n";
533
+				}
420 534
 				$Spotter->db = null;
421
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
535
+				if ($globalDebugTimeElapsed) {
536
+					echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
537
+				}
422 538
 			    }
423 539
 			}
424
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
540
+		    } else {
541
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
542
+		    }
425 543
 		    
426 544
 /*
427 545
 		    if (!isset($line['id'])) {
@@ -431,7 +549,9 @@  discard block
 block discarded – undo
431 549
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
432 550
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
433 551
   */
434
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
552
+		    if (!isset($this->all_flights[$id]['id'])) {
553
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
554
+		    }
435 555
 
436 556
 		    //$putinarchive = true;
437 557
 		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
@@ -449,7 +569,9 @@  discard block
 block discarded – undo
449 569
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
450 570
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
451 571
 		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
452
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
572
+				if ($globalDebugTimeElapsed) {
573
+					echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
574
+				}
453 575
                         }
454 576
 		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
455 577
 			$timeelapsed = microtime(true);
@@ -463,7 +585,9 @@  discard block
 block discarded – undo
463 585
 				$Translation->db = null;
464 586
 			    }
465 587
 			    $Spotter->db = null;
466
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
588
+			    if ($globalDebugTimeElapsed) {
589
+			    	echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
590
+			    }
467 591
                     	}
468 592
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
469 593
 			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
@@ -472,9 +596,13 @@  discard block
 block discarded – undo
472 596
 		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
473 597
 		    	    }
474 598
 			}
475
-			if (!isset($globalFork)) $globalFork = TRUE;
599
+			if (!isset($globalFork)) {
600
+				$globalFork = TRUE;
601
+			}
476 602
 			if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
477
-				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
603
+				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) {
604
+					$this->get_Schedule($id,trim($line['ident']));
605
+				}
478 606
 			}
479 607
 		    }
480 608
 		}
@@ -492,9 +620,13 @@  discard block
 block discarded – undo
492 620
 			$speed = $speed*3.6;
493 621
 			if ($speed < 1000) {
494 622
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
495
-	  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
623
+	  			if ($globalDebug) {
624
+	  				echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
625
+	  			}
496 626
 	  		} else {
497
-	  			if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
627
+	  			if ($globalDebug) {
628
+	  				echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
629
+	  			}
498 630
 	  		}
499 631
 		    }
500 632
 		}
@@ -503,13 +635,21 @@  discard block
 block discarded – undo
503 635
 
504 636
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
505 637
 	    	    if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) {
506
-	    	    	if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
638
+	    	    	if ($globalDebug) {
639
+	    	    		echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
640
+	    	    	}
507 641
 	    	    	return false;
508 642
 	    	    }
509
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
510
-	    	    else unset($timediff);
511
-	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
512
-	    	    else unset($timediff_archive);
643
+	    	    if (isset($this->all_flights[$id]['time_last_coord'])) {
644
+	    	    	$timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
645
+	    	    } else {
646
+	    	    	unset($timediff);
647
+	    	    }
648
+	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) {
649
+	    	    	$timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
650
+	    	    } else {
651
+	    	    	unset($timediff_archive);
652
+	    	    }
513 653
 	    	    if ($this->tmd > 5
514 654
 	    	        || (isset($line['format_source']) 
515 655
 	    	    	    && $line['format_source'] == 'airwhere' 
@@ -546,16 +686,25 @@  discard block
 block discarded – undo
546 686
 				$this->all_flights[$id]['putinarchive'] = true;
547 687
 				$this->tmd = 0;
548 688
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
549
-				    if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
689
+				    if ($globalDebug) {
690
+				    	echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
691
+				    }
550 692
 				    $timeelapsed = microtime(true);
551 693
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
552 694
 					$Spotter = new Spotter($this->db);
553 695
 					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
554
-					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
555
-					else $this->all_flights[$id]['over_country'] = '';
696
+					if (!empty($all_country)) {
697
+						$this->all_flights[$id]['over_country'] = $all_country['iso2'];
698
+					} else {
699
+						$this->all_flights[$id]['over_country'] = '';
700
+					}
556 701
 					$Spotter->db = null;
557
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
558
-					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
702
+					if ($globalDebugTimeElapsed) {
703
+						echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
704
+					}
705
+					if ($globalDebug) {
706
+						echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
707
+					}
559 708
 				    }
560 709
 				}
561 710
 				$this->all_flights[$id]['time_last_archive_coord'] = time();
@@ -601,7 +750,9 @@  discard block
 block discarded – undo
601 750
 			    */
602 751
 			}
603 752
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
604
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
753
+			    if ($line['longitude'] > 180) {
754
+			    	$line['longitude'] = $line['longitude'] - 360;
755
+			    }
605 756
 			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
606 757
 				if (!isset($this->all_flights[$id]['archive_longitude'])) {
607 758
 					$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
@@ -638,7 +789,9 @@  discard block
 block discarded – undo
638 789
 		    }
639 790
 		}
640 791
 		if (isset($line['last_update']) && $line['last_update'] != '') {
641
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
792
+		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) {
793
+		    	$dataFound = true;
794
+		    }
642 795
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
643 796
 		}
644 797
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
@@ -660,35 +813,53 @@  discard block
 block discarded – undo
660 813
 			// Here we force archive of flight because after ground it's a new one (or should be)
661 814
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
662 815
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
663
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
664
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
665
-			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
816
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
817
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
818
+			} elseif (isset($line['id'])) {
819
+		        	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
820
+		        } elseif (isset($this->all_flights[$id]['ident'])) {
821
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
822
+			}
823
+		    }
824
+		    if ($line['ground'] != 1) {
825
+		    	$line['ground'] = 0;
666 826
 		    }
667
-		    if ($line['ground'] != 1) $line['ground'] = 0;
668 827
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
669 828
 		    //$dataFound = true;
670 829
 		}
671 830
 		if (isset($line['squawk']) && $line['squawk'] != '') {
672 831
 		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
673
-			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
832
+			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) {
833
+			    	$this->all_flights[$id]['putinarchive'] = true;
834
+			    }
674 835
 			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
675 836
 			    $highlight = '';
676
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
677
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
678
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
837
+			    if ($this->all_flights[$id]['squawk'] == '7500') {
838
+			    	$highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
839
+			    }
840
+			    if ($this->all_flights[$id]['squawk'] == '7600') {
841
+			    	$highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
842
+			    }
843
+			    if ($this->all_flights[$id]['squawk'] == '7700') {
844
+			    	$highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
845
+			    }
679 846
 			    if ($highlight != '') {
680 847
 				$timeelapsed = microtime(true);
681 848
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
682 849
 				    $Spotter = new Spotter($this->db);
683 850
 				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
684 851
 				    $Spotter->db = null;
685
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
852
+				    if ($globalDebugTimeElapsed) {
853
+				    	echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
854
+				    }
686 855
 				}
687 856
 				//$putinarchive = true;
688 857
 				//$highlight = '';
689 858
 			    }
690 859
 			    
691
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
860
+		    } else {
861
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
862
+		    }
692 863
 		    //$dataFound = true;
693 864
 		}
694 865
 
@@ -701,19 +872,27 @@  discard block
 block discarded – undo
701 872
 				}
702 873
 			}
703 874
 		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
704
-			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true;
875
+			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) {
876
+				$this->all_flights[$id]['putinarchive'] = true;
877
+			}
705 878
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
706 879
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
707 880
 			//$dataFound = true;
708 881
 		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
709 882
 		    if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
710 883
 			if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
711
-				if ($globalDebug) echo '--- Reset because of altitude'."\n";
884
+				if ($globalDebug) {
885
+					echo '--- Reset because of altitude'."\n";
886
+				}
712 887
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
713 888
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
714
-				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
715
-				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
716
-				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
889
+				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
890
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
891
+				} elseif (isset($line['id'])) {
892
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
893
+				} elseif (isset($this->all_flights[$id]['ident'])) {
894
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
895
+				}
717 896
 			}
718 897
 		    }
719 898
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
@@ -724,22 +903,32 @@  discard block
 block discarded – undo
724 903
 		}
725 904
 		
726 905
 		if (isset($line['heading']) && $line['heading'] != '') {
727
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
906
+		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) {
907
+		    	$this->all_flights[$id]['putinarchive'] = true;
908
+		    }
728 909
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
729 910
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
730 911
 		    //$dataFound = true;
731 912
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
732 913
   		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
733 914
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
734
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
735
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
915
+		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) {
916
+		    	$this->all_flights[$id]['putinarchive'] = true;
917
+		    }
918
+  		    if ($globalDebug) {
919
+  		    	echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
920
+  		    }
736 921
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
737 922
   		    // If not enough messages and ACARS set heading to 0
738 923
   		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
739 924
   		}
740
-		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
741
-		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
742
-		elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false;
925
+		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) {
926
+			$dataFound = false;
927
+		} elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) {
928
+			$dataFound = false;
929
+		} elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) {
930
+			$dataFound = false;
931
+		}
743 932
 
744 933
 //		print_r($this->all_flights[$id]);
745 934
 		//gets the callsign from the last hour
@@ -756,23 +945,38 @@  discard block
 block discarded – undo
756 945
 			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
757 946
 			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
758 947
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
759
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
948
+				    if ($globalDebug) {
949
+				    	echo "Check if aircraft is already in DB...";
950
+				    }
760 951
 				    $timeelapsed = microtime(true);
761 952
 				    $SpotterLive = new SpotterLive($this->db);
762 953
 				    if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
763 954
 					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
764
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
955
+					if ($globalDebugTimeElapsed) {
956
+						echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
957
+					}
765 958
 				    } elseif (isset($line['id'])) {
766 959
 					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
767
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
960
+					if ($globalDebugTimeElapsed) {
961
+						echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
962
+					}
768 963
 				    } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
769 964
 					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
770
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
771
-				    } else $recent_ident = '';
965
+					if ($globalDebugTimeElapsed) {
966
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
967
+					}
968
+				    } else {
969
+				    	$recent_ident = '';
970
+				    }
772 971
 				    $SpotterLive->db=null;
773
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
774
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
775
-				} else $recent_ident = '';
972
+				    if ($globalDebug && $recent_ident == '') {
973
+				    	echo " Not in DB.\n";
974
+				    } elseif ($globalDebug && $recent_ident != '') {
975
+				    	echo " Already in DB.\n";
976
+				    }
977
+				} else {
978
+					$recent_ident = '';
979
+				}
776 980
 			    } else {
777 981
 				$recent_ident = '';
778 982
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
@@ -780,7 +984,9 @@  discard block
 block discarded – undo
780 984
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
781 985
 			    if($recent_ident == "")
782 986
 			    {
783
-				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
987
+				if ($globalDebug) {
988
+					echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
989
+				}
784 990
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
785 991
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
786 992
 				//adds the spotter data for the archive
@@ -824,31 +1030,49 @@  discard block
 block discarded – undo
824 1030
 				
825 1031
 				if (!$ignoreImport) {
826 1032
 				    $highlight = '';
827
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
828
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
829
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
830
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1033
+				    if ($this->all_flights[$id]['squawk'] == '7500') {
1034
+				    	$highlight = 'Squawk 7500 : Hijack';
1035
+				    }
1036
+				    if ($this->all_flights[$id]['squawk'] == '7600') {
1037
+				    	$highlight = 'Squawk 7600 : Lost Comm (radio failure)';
1038
+				    }
1039
+				    if ($this->all_flights[$id]['squawk'] == '7700') {
1040
+				    	$highlight = 'Squawk 7700 : Emergency';
1041
+				    }
1042
+				    if (!isset($this->all_flights[$id]['id'])) {
1043
+				    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1044
+				    }
831 1045
 				    $timeelapsed = microtime(true);
832 1046
 				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
833 1047
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
834 1048
 					    $Spotter = new Spotter($this->db);
835 1049
 					    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
836 1050
 					    $Spotter->db = null;
837
-					    if ($globalDebug && isset($result)) echo $result."\n";
1051
+					    if ($globalDebug && isset($result)) {
1052
+					    	echo $result."\n";
1053
+					    }
838 1054
 					}
839 1055
 				    }
840
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
1056
+				    if ($globalDebugTimeElapsed) {
1057
+				    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
1058
+				    }
841 1059
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
842 1060
 
843 1061
 				    // Add source stat in DB
844 1062
 				    $Stats = new Stats($this->db);
845 1063
 				    if (!empty($this->stats)) {
846
-					if ($globalDebug) echo 'Add source stats : ';
1064
+					if ($globalDebug) {
1065
+						echo 'Add source stats : ';
1066
+					}
847 1067
 				        foreach($this->stats as $date => $data) {
848 1068
 					    foreach($data as $source => $sourced) {
849 1069
 					        //print_r($sourced);
850
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
851
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
1070
+				    	        if (isset($sourced['polar'])) {
1071
+				    	        	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
1072
+				    	        }
1073
+				    	        if (isset($sourced['hist'])) {
1074
+				    	        	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
1075
+				    	        }
852 1076
 				    		if (isset($sourced['msg'])) {
853 1077
 				    		    if (time() - $sourced['msg']['date'] > 10) {
854 1078
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -861,13 +1085,17 @@  discard block
 block discarded – undo
861 1085
 			    			unset($this->stats[$date]);
862 1086
 			    		    }
863 1087
 				    	}
864
-				    	if ($globalDebug) echo 'Done'."\n";
1088
+				    	if ($globalDebug) {
1089
+				    		echo 'Done'."\n";
1090
+				    	}
865 1091
 
866 1092
 				    }
867 1093
 				    $Stats->db = null;
868 1094
 				    }
869 1095
 				    $this->del();
870
-				} elseif ($globalDebug) echo 'Ignore data'."\n";
1096
+				} elseif ($globalDebug) {
1097
+					echo 'Ignore data'."\n";
1098
+				}
871 1099
 				//$ignoreImport = false;
872 1100
 				$this->all_flights[$id]['addedSpotter'] = 1;
873 1101
 				//print_r($this->all_flights[$id]);
@@ -884,7 +1112,9 @@  discard block
 block discarded – undo
884 1112
 			*/
885 1113
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
886 1114
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
887
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
1115
+				    if ($globalDebug) {
1116
+				    	echo "---- Deleting Live Spotter data older than 9 hours...";
1117
+				    }
888 1118
 				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
889 1119
 				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
890 1120
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -893,7 +1123,9 @@  discard block
 block discarded – undo
893 1123
 					    $SpotterLive->db=null;
894 1124
 					}
895 1125
 				    }
896
-				    if ($globalDebug) echo " Done\n";
1126
+				    if ($globalDebug) {
1127
+				    	echo " Done\n";
1128
+				    }
897 1129
 				    $this->last_delete = time();
898 1130
 				}
899 1131
 			    } else {
@@ -920,11 +1152,17 @@  discard block
 block discarded – undo
920 1152
 		    //echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
921 1153
 		    if ($globalDebug) {
922 1154
 			if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
923
-				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
924
-				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
1155
+				if (isset($this->all_flights[$id]['source_name'])) {
1156
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
1157
+				} else {
1158
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
1159
+				}
925 1160
 			} else {
926
-				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
927
-				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
1161
+				if (isset($this->all_flights[$id]['source_name'])) {
1162
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
1163
+				} else {
1164
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
1165
+				}
928 1166
 			}
929 1167
 		    }
930 1168
 		    $ignoreImport = false;
@@ -970,22 +1208,30 @@  discard block
 block discarded – undo
970 1208
 
971 1209
 		    if (!$ignoreImport) {
972 1210
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
973
-				if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1211
+				if (!isset($this->all_flights[$id]['id'])) {
1212
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1213
+				}
974 1214
 				$timeelapsed = microtime(true);
975 1215
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
976 1216
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
977
-					if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
1217
+					if ($globalDebug) {
1218
+						echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
1219
+					}
978 1220
 					$SpotterLive = new SpotterLive($this->db);
979 1221
 					$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
980 1222
 					$SpotterLive->db = null;
981
-					if ($globalDebug) echo $result."\n";
1223
+					if ($globalDebug) {
1224
+						echo $result."\n";
1225
+					}
982 1226
 				    }
983 1227
 				}
984 1228
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) {
985 1229
 					$APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
986 1230
 				}
987 1231
 				$this->all_flights[$id]['putinarchive'] = false;
988
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
1232
+				if ($globalDebugTimeElapsed) {
1233
+					echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
1234
+				}
989 1235
 
990 1236
 				// Put statistics in $this->stats variable
991 1237
 				//if ($line['format_source'] != 'aprs') {
@@ -993,7 +1239,9 @@  discard block
 block discarded – undo
993 1239
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
994 1240
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
995 1241
 					$source = $this->all_flights[$id]['source_name'];
996
-					if ($source == '') $source = $this->all_flights[$id]['format_source'];
1242
+					if ($source == '') {
1243
+						$source = $this->all_flights[$id]['format_source'];
1244
+					}
997 1245
 					if (!isset($this->source_location[$source])) {
998 1246
 						$Location = new Source($this->db);
999 1247
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -1014,7 +1262,9 @@  discard block
 block discarded – undo
1014 1262
 					$stats_heading = round($stats_heading/22.5);
1015 1263
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
1016 1264
 					$current_date = date('Y-m-d');
1017
-					if ($stats_heading == 16) $stats_heading = 0;
1265
+					if ($stats_heading == 16) {
1266
+						$stats_heading = 0;
1267
+					}
1018 1268
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
1019 1269
 						for ($i=0;$i<=15;$i++) {
1020 1270
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -1032,7 +1282,9 @@  discard block
 block discarded – undo
1032 1282
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
1033 1283
 						    end($this->stats[$current_date][$source]['hist']);
1034 1284
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
1035
-						} else $mini = 0;
1285
+						} else {
1286
+							$mini = 0;
1287
+						}
1036 1288
 						for ($i=$mini;$i<=$distance;$i+=10) {
1037 1289
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
1038 1290
 						}
@@ -1044,19 +1296,27 @@  discard block
 block discarded – undo
1044 1296
 				}
1045 1297
 
1046 1298
 				$this->all_flights[$id]['lastupdate'] = time();
1047
-				if ($this->all_flights[$id]['putinarchive']) $send = true;
1299
+				if ($this->all_flights[$id]['putinarchive']) {
1300
+					$send = true;
1301
+				}
1048 1302
 				//if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1049
-			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1303
+			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
1304
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1305
+			}
1050 1306
 			//$this->del();
1051 1307
 			
1052 1308
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
1053 1309
 			    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
1054
-				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1310
+				if ($globalDebug) {
1311
+					echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1312
+				}
1055 1313
 				$SpotterLive = new SpotterLive($this->db);
1056 1314
 				$SpotterLive->deleteLiveSpotterDataNotUpdated();
1057 1315
 				$SpotterLive->db = null;
1058 1316
 				//SpotterLive->deleteLiveSpotterData();
1059
-				if ($globalDebug) echo " Done\n";
1317
+				if ($globalDebug) {
1318
+					echo " Done\n";
1319
+				}
1060 1320
 				$this->last_delete_hourly = time();
1061 1321
 			    } else {
1062 1322
 				$this->del();
@@ -1068,7 +1328,9 @@  discard block
 block discarded – undo
1068 1328
 		    //$ignoreImport = false;
1069 1329
 		}
1070 1330
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
1071
-		if ($send) return $this->all_flights[$id];
1331
+		if ($send) {
1332
+			return $this->all_flights[$id];
1333
+		}
1072 1334
 	    }
1073 1335
 	}
1074 1336
     }
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 2 patches
Indentation   +528 added lines, -528 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 	}
11 11
 
12 12
 	/**
13
-	* Get SQL query part for filter used
14
-	* @param Array $filter the filter
15
-	* @return Array the SQL part
16
-	*/
13
+	 * Get SQL query part for filter used
14
+	 * @param Array $filter the filter
15
+	 * @return Array the SQL part
16
+	 */
17 17
 	public function getFilter($filter = array(),$where = false,$and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
@@ -158,44 +158,44 @@  discard block
 block discarded – undo
158 158
 	}
159 159
 
160 160
 
161
-        /**
162
-        * Gets all the spotter information based on a particular callsign
163
-        *
164
-        * @return Array the spotter information
165
-        *
166
-        */
167
-        public function getLastArchiveSpotterDataByIdent($ident)
168
-        {
161
+		/**
162
+		 * Gets all the spotter information based on a particular callsign
163
+		 *
164
+		 * @return Array the spotter information
165
+		 *
166
+		 */
167
+		public function getLastArchiveSpotterDataByIdent($ident)
168
+		{
169 169
 		$Spotter = new Spotter($this->db);
170
-                date_default_timezone_set('UTC');
170
+				date_default_timezone_set('UTC');
171 171
 
172
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
173
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
174
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
172
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
173
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
174
+				$query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
175 175
 
176
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
176
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
177 177
 
178
-                return $spotter_array;
179
-        }
178
+				return $spotter_array;
179
+		}
180 180
 
181 181
 
182
-        /**
183
-        * Gets last the spotter information based on a particular id
184
-        *
185
-        * @return Array the spotter information
186
-        *
187
-        */
188
-        public function getLastArchiveSpotterDataById($id)
189
-        {
190
-    		$Spotter = new Spotter($this->db);
191
-                date_default_timezone_set('UTC');
192
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
193
-                //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
194
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
195
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
182
+		/**
183
+		 * Gets last the spotter information based on a particular id
184
+		 *
185
+		 * @return Array the spotter information
186
+		 *
187
+		 */
188
+		public function getLastArchiveSpotterDataById($id)
189
+		{
190
+			$Spotter = new Spotter($this->db);
191
+				date_default_timezone_set('UTC');
192
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
193
+				//$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
194
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
195
+				$query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
196 196
 
197 197
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
198
-                  /*
198
+				  /*
199 199
                 try {
200 200
                         $Connection = new Connection();
201 201
                         $sth = Connection->$db->prepare($query);
@@ -205,118 +205,118 @@  discard block
 block discarded – undo
205 205
                 }
206 206
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
207 207
                 */
208
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
209
-
210
-                return $spotter_array;
211
-        }
212
-
213
-        /**
214
-        * Gets all the spotter information based on a particular id
215
-        *
216
-        * @return Array the spotter information
217
-        *
218
-        */
219
-        public function getAllArchiveSpotterDataById($id)
208
+				$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
209
+
210
+				return $spotter_array;
211
+		}
212
+
213
+		/**
214
+		 * Gets all the spotter information based on a particular id
215
+		 *
216
+		 * @return Array the spotter information
217
+		 *
218
+		 */
219
+		public function getAllArchiveSpotterDataById($id)
220 220
 	{
221
-                date_default_timezone_set('UTC');
222
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
223
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
221
+				date_default_timezone_set('UTC');
222
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
223
+				$query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
224 224
 
225 225
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
226 226
 
227
-                try {
228
-                        $sth = $this->db->prepare($query);
229
-                        $sth->execute(array(':id' => $id));
230
-                } catch(PDOException $e) {
231
-                        echo $e->getMessage();
232
-                        die;
233
-                }
234
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
235
-
236
-                return $spotter_array;
237
-        }
238
-
239
-        /**
240
-        * Gets coordinate & time spotter information based on a particular id
241
-        *
242
-        * @return Array the spotter information
243
-        *
244
-        */
245
-        public function getCoordArchiveSpotterDataById($id)
246
-        {
247
-                date_default_timezone_set('UTC');
248
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
249
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC";
250
-                try {
251
-                        $sth = $this->db->prepare($query);
252
-                        $sth->execute(array(':id' => $id));
253
-                } catch(PDOException $e) {
254
-                        echo $e->getMessage();
255
-                        die;
256
-                }
257
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
258
-                return $spotter_array;
259
-        }
227
+				try {
228
+						$sth = $this->db->prepare($query);
229
+						$sth->execute(array(':id' => $id));
230
+				} catch(PDOException $e) {
231
+						echo $e->getMessage();
232
+						die;
233
+				}
234
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
260 235
 
236
+				return $spotter_array;
237
+		}
261 238
 
262
-        /**
263
-        * Gets altitude information based on a particular callsign
264
-        *
265
-        * @return Array the spotter information
266
-        *
267
-        */
268
-        public function getAltitudeArchiveSpotterDataByIdent($ident)
269
-        {
239
+		/**
240
+		 * Gets coordinate & time spotter information based on a particular id
241
+		 *
242
+		 * @return Array the spotter information
243
+		 *
244
+		 */
245
+		public function getCoordArchiveSpotterDataById($id)
246
+		{
247
+				date_default_timezone_set('UTC');
248
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
249
+				$query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC";
250
+				try {
251
+						$sth = $this->db->prepare($query);
252
+						$sth->execute(array(':id' => $id));
253
+				} catch(PDOException $e) {
254
+						echo $e->getMessage();
255
+						die;
256
+				}
257
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
258
+				return $spotter_array;
259
+		}
270 260
 
271
-                date_default_timezone_set('UTC');
272 261
 
273
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
274
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
262
+		/**
263
+		 * Gets altitude information based on a particular callsign
264
+		 *
265
+		 * @return Array the spotter information
266
+		 *
267
+		 */
268
+		public function getAltitudeArchiveSpotterDataByIdent($ident)
269
+		{
275 270
 
276
-                try {
277
-                        $sth = $this->db->prepare($query);
278
-                        $sth->execute(array(':ident' => $ident));
279
-                } catch(PDOException $e) {
280
-                        echo $e->getMessage();
281
-                        die;
282
-                }
283
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
271
+				date_default_timezone_set('UTC');
284 272
 
285
-                return $spotter_array;
286
-        }
273
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
274
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
287 275
 
288
-        /**
289
-        * Gets altitude information based on a particular id
290
-        *
291
-        * @return Array the spotter information
292
-        *
293
-        */
294
-        public function getAltitudeArchiveSpotterDataById($id)
295
-        {
276
+				try {
277
+						$sth = $this->db->prepare($query);
278
+						$sth->execute(array(':ident' => $ident));
279
+				} catch(PDOException $e) {
280
+						echo $e->getMessage();
281
+						die;
282
+				}
283
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
296 284
 
297
-                date_default_timezone_set('UTC');
285
+				return $spotter_array;
286
+		}
298 287
 
299
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
300
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
288
+		/**
289
+		 * Gets altitude information based on a particular id
290
+		 *
291
+		 * @return Array the spotter information
292
+		 *
293
+		 */
294
+		public function getAltitudeArchiveSpotterDataById($id)
295
+		{
301 296
 
302
-                try {
303
-                        $sth = $this->db->prepare($query);
304
-                        $sth->execute(array(':id' => $id));
305
-                } catch(PDOException $e) {
306
-                        echo $e->getMessage();
307
-                        die;
308
-                }
309
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
297
+				date_default_timezone_set('UTC');
298
+
299
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
300
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
301
+
302
+				try {
303
+						$sth = $this->db->prepare($query);
304
+						$sth->execute(array(':id' => $id));
305
+				} catch(PDOException $e) {
306
+						echo $e->getMessage();
307
+						die;
308
+				}
309
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
310 310
 
311
-                return $spotter_array;
312
-        }
311
+				return $spotter_array;
312
+		}
313 313
 
314
-        /**
315
-        * Gets altitude & speed information based on a particular id
316
-        *
317
-        * @return Array the spotter information
318
-        *
319
-        */
314
+		/**
315
+		 * Gets altitude & speed information based on a particular id
316
+		 *
317
+		 * @return Array the spotter information
318
+		 *
319
+		 */
320 320
 	public function getAltitudeSpeedArchiveSpotterDataById($id)
321 321
 	{
322 322
 		date_default_timezone_set('UTC');
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
 		return $spotter_array;
334 334
 	}
335 335
 
336
-        /**
337
-        * Gets altitude information based on a particular callsign
338
-        *
339
-        * @return Array the spotter information
340
-        *
341
-        */
336
+		/**
337
+		 * Gets altitude information based on a particular callsign
338
+		 *
339
+		 * @return Array the spotter information
340
+		 *
341
+		 */
342 342
 	public function getLastAltitudeArchiveSpotterDataByIdent($ident)
343 343
 	{
344 344
 		date_default_timezone_set('UTC');
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 
359 359
 
360 360
 
361
-       /**
362
-        * Gets all the archive spotter information
363
-        *
364
-        * @return Array the spotter information
365
-        *
366
-        */
361
+	   /**
362
+	    * Gets all the archive spotter information
363
+	    *
364
+	    * @return Array the spotter information
365
+	    *
366
+	    */
367 367
 	public function getSpotterArchiveData($ident,$flightaware_id,$date)
368 368
 	{
369 369
 		$Spotter = new Spotter($this->db);
@@ -391,34 +391,34 @@  discard block
 block discarded – undo
391 391
 	}
392 392
 
393 393
 	/**
394
-        * Gets Minimal Live Spotter data
395
-        *
396
-        * @return Array the spotter information
397
-        *
398
-        */
399
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
400
-        {
401
-                global $globalDBdriver, $globalLiveInterval;
402
-                date_default_timezone_set('UTC');
403
-
404
-                $filter_query = '';
405
-                if (isset($filter['source']) && !empty($filter['source'])) {
406
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
407
-                }
408
-                // Use spotter_output also ?
409
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
410
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
411
-                }
412
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
413
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
414
-                }
415
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
416
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
417
-                }
394
+	 * Gets Minimal Live Spotter data
395
+	 *
396
+	 * @return Array the spotter information
397
+	 *
398
+	 */
399
+		public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
400
+		{
401
+				global $globalDBdriver, $globalLiveInterval;
402
+				date_default_timezone_set('UTC');
403
+
404
+				$filter_query = '';
405
+				if (isset($filter['source']) && !empty($filter['source'])) {
406
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
407
+				}
408
+				// Use spotter_output also ?
409
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
410
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
411
+				}
412
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
413
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
414
+				}
415
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
416
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
417
+				}
418 418
 
419
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
420
-                if ($globalDBdriver == 'mysql') {
421
-                        /*
419
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
420
+				if ($globalDBdriver == 'mysql') {
421
+						/*
422 422
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
423 423
                     		    FROM spotter_archive 
424 424
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -437,56 +437,56 @@  discard block
 block discarded – undo
437 437
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
438 438
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
439 439
                         	    '.$filter_query.' ORDER BY flightaware_id';
440
-                } else {
441
-                        //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
442
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
440
+				} else {
441
+						//$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
442
+						$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
443 443
                         	    FROM spotter_archive 
444 444
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
445 445
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
446 446
                         	    '.$filter_query.' ORDER BY flightaware_id';
447
-                }
448
-                //echo $query;
449
-                try {
450
-                        $sth = $this->db->prepare($query);
451
-                        $sth->execute();
452
-                } catch(PDOException $e) {
453
-                        echo $e->getMessage();
454
-                        die;
455
-                }
456
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
447
+				}
448
+				//echo $query;
449
+				try {
450
+						$sth = $this->db->prepare($query);
451
+						$sth->execute();
452
+				} catch(PDOException $e) {
453
+						echo $e->getMessage();
454
+						die;
455
+				}
456
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
457 457
 
458
-                return $spotter_array;
459
-        }
458
+				return $spotter_array;
459
+		}
460 460
 
461 461
 	/**
462
-        * Gets Minimal Live Spotter data
463
-        *
464
-        * @return Array the spotter information
465
-        *
466
-        */
467
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
468
-        {
469
-                global $globalDBdriver, $globalLiveInterval;
470
-                date_default_timezone_set('UTC');
471
-
472
-                $filter_query = '';
473
-                if (isset($filter['source']) && !empty($filter['source'])) {
474
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
475
-                }
476
-                // Should use spotter_output also ?
477
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
478
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
479
-                }
480
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
481
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
482
-                }
483
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
484
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
485
-                }
462
+	 * Gets Minimal Live Spotter data
463
+	 *
464
+	 * @return Array the spotter information
465
+	 *
466
+	 */
467
+		public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
468
+		{
469
+				global $globalDBdriver, $globalLiveInterval;
470
+				date_default_timezone_set('UTC');
471
+
472
+				$filter_query = '';
473
+				if (isset($filter['source']) && !empty($filter['source'])) {
474
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
475
+				}
476
+				// Should use spotter_output also ?
477
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
478
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
479
+				}
480
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
481
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
482
+				}
483
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
484
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
485
+				}
486 486
 
487
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
488
-                if ($globalDBdriver == 'mysql') {
489
-                        /*
487
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
488
+				if ($globalDBdriver == 'mysql') {
489
+						/*
490 490
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
491 491
                     		    FROM spotter_archive 
492 492
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -497,95 +497,95 @@  discard block
 block discarded – undo
497 497
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
498 498
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
499 499
 
500
-                } else {
501
-                        //$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
502
-                       /*
500
+				} else {
501
+						//$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
502
+					   /*
503 503
                         $query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
504 504
                         	    FROM spotter_archive_output 
505 505
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
506 506
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
507 507
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
508 508
                         */
509
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
509
+						$query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
510 510
                         	    FROM spotter_archive_output 
511 511
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
512 512
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
513 513
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
514 514
 //                        	    .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
515 515
                         	    
516
-                }
517
-                //echo $query;
518
-                try {
519
-                        $sth = $this->db->prepare($query);
520
-                        $sth->execute();
521
-                } catch(PDOException $e) {
522
-                        echo $e->getMessage();
523
-                        die;
524
-                }
525
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
516
+				}
517
+				//echo $query;
518
+				try {
519
+						$sth = $this->db->prepare($query);
520
+						$sth->execute();
521
+				} catch(PDOException $e) {
522
+						echo $e->getMessage();
523
+						die;
524
+				}
525
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
526 526
 
527
-                return $spotter_array;
528
-        }
527
+				return $spotter_array;
528
+		}
529 529
 
530 530
 	 /**
531
-        * Gets count Live Spotter data
532
-        *
533
-        * @return Array the spotter information
534
-        *
535
-        */
536
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
537
-        {
538
-                global $globalDBdriver, $globalLiveInterval;
539
-                date_default_timezone_set('UTC');
540
-
541
-                $filter_query = '';
542
-                if (isset($filter['source']) && !empty($filter['source'])) {
543
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
544
-                }
545
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
546
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
547
-                }
548
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
549
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
550
-                }
551
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
552
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
553
-                }
531
+	  * Gets count Live Spotter data
532
+	  *
533
+	  * @return Array the spotter information
534
+	  *
535
+	  */
536
+		public function getLiveSpotterCount($begindate,$enddate,$filter = array())
537
+		{
538
+				global $globalDBdriver, $globalLiveInterval;
539
+				date_default_timezone_set('UTC');
554 540
 
555
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
556
-                if ($globalDBdriver == 'mysql') {
541
+				$filter_query = '';
542
+				if (isset($filter['source']) && !empty($filter['source'])) {
543
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
544
+				}
545
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
546
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
547
+				}
548
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
549
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
550
+				}
551
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
552
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
553
+				}
554
+
555
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
556
+				if ($globalDBdriver == 'mysql') {
557 557
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb 
558 558
 			FROM spotter_archive l 
559 559
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
560
-                } else {
560
+				} else {
561 561
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
562
-                }
563
-                //echo $query;
564
-                try {
565
-                        $sth = $this->db->prepare($query);
566
-                        $sth->execute();
567
-                } catch(PDOException $e) {
568
-                        echo $e->getMessage();
569
-                        die;
570
-                }
562
+				}
563
+				//echo $query;
564
+				try {
565
+						$sth = $this->db->prepare($query);
566
+						$sth->execute();
567
+				} catch(PDOException $e) {
568
+						echo $e->getMessage();
569
+						die;
570
+				}
571 571
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
572 572
 		$sth->closeCursor();
573
-                return $result['nb'];
573
+				return $result['nb'];
574 574
 
575
-        }
575
+		}
576 576
 
577 577
 
578 578
 
579 579
 	// Spotter_Archive_output
580 580
 	
581
-    /**
582
-    * Gets all the spotter information
583
-    *
584
-    * @return Array the spotter information
585
-    *
586
-    */
587
-    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
588
-    {
581
+	/**
582
+	 * Gets all the spotter information
583
+	 *
584
+	 * @return Array the spotter information
585
+	 *
586
+	 */
587
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
588
+	{
589 589
 	global $globalTimezone, $globalDBdriver;
590 590
 	require_once(dirname(__FILE__).'/class.Translation.php');
591 591
 	$Translation = new Translation($this->db);
@@ -599,159 +599,159 @@  discard block
 block discarded – undo
599 599
 	$filter_query = $this->getFilter($filters);
600 600
 	if ($q != "")
601 601
 	{
602
-	    if (!is_string($q))
603
-	    {
602
+		if (!is_string($q))
603
+		{
604 604
 		return false;
605
-	    } else {
605
+		} else {
606 606
 	        
607 607
 		$q_array = explode(" ", $q);
608 608
 		
609 609
 		foreach ($q_array as $q_item){
610
-		    $additional_query .= " AND (";
611
-		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
612
-		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
613
-		    $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
614
-		    $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
615
-		    $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
616
-		    $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
617
-		    $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
618
-		    $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
619
-		    $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
620
-		    $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
621
-		    $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
622
-		    $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
623
-		    $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
624
-		    $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
625
-		    $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
626
-		    $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
627
-		    $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
628
-		    $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
629
-		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
630
-		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
631
-		    $translate = $Translation->ident2icao($q_item);
632
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
633
-		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
634
-		    $additional_query .= ")";
610
+			$additional_query .= " AND (";
611
+			$additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
612
+			$additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
613
+			$additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
614
+			$additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
615
+			$additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
616
+			$additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
617
+			$additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
618
+			$additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
619
+			$additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
620
+			$additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
621
+			$additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
622
+			$additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
623
+			$additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
624
+			$additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
625
+			$additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
626
+			$additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
627
+			$additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
628
+			$additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
629
+			$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
630
+			$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
631
+			$translate = $Translation->ident2icao($q_item);
632
+			if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
633
+			$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
634
+			$additional_query .= ")";
635
+		}
635 636
 		}
636
-	    }
637 637
 	}
638 638
 	
639 639
 	if ($registration != "")
640 640
 	{
641
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
642
-	    if (!is_string($registration))
643
-	    {
641
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
642
+		if (!is_string($registration))
643
+		{
644 644
 		return false;
645
-	    } else {
645
+		} else {
646 646
 		$additional_query .= " AND (spotter_archive_output.registration = '".$registration."')";
647
-	    }
647
+		}
648 648
 	}
649 649
 	
650 650
 	if ($aircraft_icao != "")
651 651
 	{
652
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
653
-	    if (!is_string($aircraft_icao))
654
-	    {
652
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
653
+		if (!is_string($aircraft_icao))
654
+		{
655 655
 		return false;
656
-	    } else {
656
+		} else {
657 657
 		$additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')";
658
-	    }
658
+		}
659 659
 	}
660 660
 	
661 661
 	if ($aircraft_manufacturer != "")
662 662
 	{
663
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
664
-	    if (!is_string($aircraft_manufacturer))
665
-	    {
663
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
664
+		if (!is_string($aircraft_manufacturer))
665
+		{
666 666
 		return false;
667
-	    } else {
667
+		} else {
668 668
 		$additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
669
-	    }
669
+		}
670 670
 	}
671 671
 	
672 672
 	if ($highlights == "true")
673 673
 	{
674
-	    if (!is_string($highlights))
675
-	    {
674
+		if (!is_string($highlights))
675
+		{
676 676
 		return false;
677
-	    } else {
677
+		} else {
678 678
 		$additional_query .= " AND (spotter_archive_output.highlight <> '')";
679
-	    }
679
+		}
680 680
 	}
681 681
 	
682 682
 	if ($airline_icao != "")
683 683
 	{
684
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
685
-	    if (!is_string($airline_icao))
686
-	    {
684
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
685
+		if (!is_string($airline_icao))
686
+		{
687 687
 		return false;
688
-	    } else {
688
+		} else {
689 689
 		$additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')";
690
-	    }
690
+		}
691 691
 	}
692 692
 	
693 693
 	if ($airline_country != "")
694 694
 	{
695
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
696
-	    if (!is_string($airline_country))
697
-	    {
695
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
696
+		if (!is_string($airline_country))
697
+		{
698 698
 		return false;
699
-	    } else {
699
+		} else {
700 700
 		$additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')";
701
-	    }
701
+		}
702 702
 	}
703 703
 	
704 704
 	if ($airline_type != "")
705 705
 	{
706
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
707
-	    if (!is_string($airline_type))
708
-	    {
706
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
707
+		if (!is_string($airline_type))
708
+		{
709 709
 		return false;
710
-	    } else {
710
+		} else {
711 711
 		if ($airline_type == "passenger")
712 712
 		{
713
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
713
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
714 714
 		}
715 715
 		if ($airline_type == "cargo")
716 716
 		{
717
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
717
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
718 718
 		}
719 719
 		if ($airline_type == "military")
720 720
 		{
721
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
721
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
722
+		}
722 723
 		}
723
-	    }
724 724
 	}
725 725
 	
726 726
 	if ($airport != "")
727 727
 	{
728
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
729
-	    if (!is_string($airport))
730
-	    {
728
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
729
+		if (!is_string($airport))
730
+		{
731 731
 		return false;
732
-	    } else {
732
+		} else {
733 733
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))";
734
-	    }
734
+		}
735 735
 	}
736 736
 	
737 737
 	if ($airport_country != "")
738 738
 	{
739
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
740
-	    if (!is_string($airport_country))
741
-	    {
739
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
740
+		if (!is_string($airport_country))
741
+		{
742 742
 		return false;
743
-	    } else {
743
+		} else {
744 744
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))";
745
-	    }
745
+		}
746 746
 	}
747 747
     
748 748
 	if ($callsign != "")
749 749
 	{
750
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
751
-	    if (!is_string($callsign))
752
-	    {
750
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
751
+		if (!is_string($callsign))
752
+		{
753 753
 		return false;
754
-	    } else {
754
+		} else {
755 755
 		$translate = $Translation->ident2icao($callsign);
756 756
 		if ($translate != $callsign) {
757 757
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
@@ -759,81 +759,81 @@  discard block
 block discarded – undo
759 759
 		} else {
760 760
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
761 761
 		}
762
-	    }
762
+		}
763 763
 	}
764 764
 
765 765
 	if ($owner != "")
766 766
 	{
767
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
768
-	    if (!is_string($owner))
769
-	    {
767
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
768
+		if (!is_string($owner))
769
+		{
770 770
 		return false;
771
-	    } else {
771
+		} else {
772 772
 		$additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')";
773
-	    }
773
+		}
774 774
 	}
775 775
 
776 776
 	if ($pilot_name != "")
777 777
 	{
778
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
779
-	    if (!is_string($pilot_name))
780
-	    {
778
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
779
+		if (!is_string($pilot_name))
780
+		{
781 781
 		return false;
782
-	    } else {
782
+		} else {
783 783
 		$additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')";
784
-	    }
784
+		}
785 785
 	}
786 786
 	
787 787
 	if ($pilot_id != "")
788 788
 	{
789
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
790
-	    if (!is_string($pilot_id))
791
-	    {
789
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
790
+		if (!is_string($pilot_id))
791
+		{
792 792
 		return false;
793
-	    } else {
793
+		} else {
794 794
 		$additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')";
795
-	    }
795
+		}
796 796
 	}
797 797
 	
798 798
 	if ($departure_airport_route != "")
799 799
 	{
800
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
801
-	    if (!is_string($departure_airport_route))
802
-	    {
800
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
801
+		if (!is_string($departure_airport_route))
802
+		{
803 803
 		return false;
804
-	    } else {
804
+		} else {
805 805
 		$additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')";
806
-	    }
806
+		}
807 807
 	}
808 808
 	
809 809
 	if ($arrival_airport_route != "")
810 810
 	{
811
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
812
-	    if (!is_string($arrival_airport_route))
813
-	    {
811
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
812
+		if (!is_string($arrival_airport_route))
813
+		{
814 814
 		return false;
815
-	    } else {
815
+		} else {
816 816
 		$additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
817
-	    }
817
+		}
818 818
 	}
819 819
 	
820 820
 	if ($altitude != "")
821 821
 	{
822
-	    $altitude_array = explode(",", $altitude);
822
+		$altitude_array = explode(",", $altitude);
823 823
 	    
824
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
825
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
824
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
825
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
826 826
 	    
827 827
 
828
-	    if ($altitude_array[1] != "")
829
-	    {                
828
+		if ($altitude_array[1] != "")
829
+		{                
830 830
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
831 831
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
832 832
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
833
-	    } else {
833
+		} else {
834 834
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
835 835
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
836
-	    }
836
+		}
837 837
 	}
838 838
 	
839 839
 	if ($date_posted != "")
@@ -918,14 +918,14 @@  discard block
 block discarded – undo
918 918
 		}
919 919
 	}
920 920
 
921
-    /**
922
-    * Gets all the spotter information based on the callsign
923
-    *
924
-    * @return Array the spotter information
925
-    *
926
-    */
927
-    public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
928
-    {
921
+	/**
922
+	 * Gets all the spotter information based on the callsign
923
+	 *
924
+	 * @return Array the spotter information
925
+	 *
926
+	 */
927
+	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
928
+	{
929 929
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
930 930
 	
931 931
 	date_default_timezone_set('UTC');
@@ -937,35 +937,35 @@  discard block
 block discarded – undo
937 937
 	
938 938
 	if ($ident != "")
939 939
 	{
940
-	    if (!is_string($ident))
941
-	    {
940
+		if (!is_string($ident))
941
+		{
942 942
 		return false;
943
-	    } else {
943
+		} else {
944 944
 		$additional_query = " AND spotter_archive_output.ident = :ident";
945 945
 		$query_values = array(':ident' => $ident);
946
-	    }
946
+		}
947 947
 	}
948 948
 	
949 949
 	if ($limit != "")
950 950
 	{
951
-	    $limit_array = explode(",", $limit);
951
+		$limit_array = explode(",", $limit);
952 952
 	    
953
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
954
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
953
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
954
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
955 955
 	    
956
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
957
-	    {
956
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
957
+		{
958 958
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
959 959
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
960
-	    }
960
+		}
961 961
 	}
962 962
 
963 963
 	if ($sort != "")
964 964
 	{
965
-	    $search_orderby_array = $Spotter->getOrderBy();
966
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
965
+		$search_orderby_array = $Spotter->getOrderBy();
966
+		$orderby_query = $search_orderby_array[$sort]['sql'];
967 967
 	} else {
968
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
968
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
969 969
 	}
970 970
 
971 971
 	$query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -973,17 +973,17 @@  discard block
 block discarded – undo
973 973
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
974 974
 
975 975
 	return $spotter_array;
976
-    }
976
+	}
977 977
 
978 978
 
979
-    /**
980
-    * Gets all the spotter information based on the owner
981
-    *
982
-    * @return Array the spotter information
983
-    *
984
-    */
985
-    public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
986
-    {
979
+	/**
980
+	 * Gets all the spotter information based on the owner
981
+	 *
982
+	 * @return Array the spotter information
983
+	 *
984
+	 */
985
+	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
986
+	{
987 987
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
988 988
 	
989 989
 	date_default_timezone_set('UTC');
@@ -996,35 +996,35 @@  discard block
 block discarded – undo
996 996
 	
997 997
 	if ($owner != "")
998 998
 	{
999
-	    if (!is_string($owner))
1000
-	    {
999
+		if (!is_string($owner))
1000
+		{
1001 1001
 		return false;
1002
-	    } else {
1002
+		} else {
1003 1003
 		$additional_query = " AND (spotter_archive_output.owner_name = :owner)";
1004 1004
 		$query_values = array(':owner' => $owner);
1005
-	    }
1005
+		}
1006 1006
 	}
1007 1007
 	
1008 1008
 	if ($limit != "")
1009 1009
 	{
1010
-	    $limit_array = explode(",", $limit);
1010
+		$limit_array = explode(",", $limit);
1011 1011
 	    
1012
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1013
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1012
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1013
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1014 1014
 	    
1015
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1016
-	    {
1015
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1016
+		{
1017 1017
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1018 1018
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1019
-	    }
1019
+		}
1020 1020
 	}
1021 1021
 
1022 1022
 	if ($sort != "")
1023 1023
 	{
1024
-	    $search_orderby_array = $Spotter->getOrderBy();
1025
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1024
+		$search_orderby_array = $Spotter->getOrderBy();
1025
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1026 1026
 	} else {
1027
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1027
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1028 1028
 	}
1029 1029
 
1030 1030
 	$query = $global_query.$filter_query." spotter_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1032,16 +1032,16 @@  discard block
 block discarded – undo
1032 1032
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1033 1033
 
1034 1034
 	return $spotter_array;
1035
-    }
1036
-
1037
-    /**
1038
-    * Gets all the spotter information based on the pilot
1039
-    *
1040
-    * @return Array the spotter information
1041
-    *
1042
-    */
1043
-    public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1044
-    {
1035
+	}
1036
+
1037
+	/**
1038
+	 * Gets all the spotter information based on the pilot
1039
+	 *
1040
+	 * @return Array the spotter information
1041
+	 *
1042
+	 */
1043
+	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1044
+	{
1045 1045
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
1046 1046
 	
1047 1047
 	date_default_timezone_set('UTC');
@@ -1060,24 +1060,24 @@  discard block
 block discarded – undo
1060 1060
 	
1061 1061
 	if ($limit != "")
1062 1062
 	{
1063
-	    $limit_array = explode(",", $limit);
1063
+		$limit_array = explode(",", $limit);
1064 1064
 	    
1065
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1066
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1065
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1066
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1067 1067
 	    
1068
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1069
-	    {
1068
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1069
+		{
1070 1070
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1071 1071
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1072
-	    }
1072
+		}
1073 1073
 	}
1074 1074
 
1075 1075
 	if ($sort != "")
1076 1076
 	{
1077
-	    $search_orderby_array = $Spotter->getOrderBy();
1078
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1077
+		$search_orderby_array = $Spotter->getOrderBy();
1078
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1079 1079
 	} else {
1080
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1080
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1081 1081
 	}
1082 1082
 
1083 1083
 	$query = $global_query.$filter_query." spotter_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1085,16 +1085,16 @@  discard block
 block discarded – undo
1085 1085
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1086 1086
 
1087 1087
 	return $spotter_array;
1088
-    }
1089
-
1090
-    /**
1091
-    * Gets all number of flight over countries
1092
-    *
1093
-    * @return Array the airline country list
1094
-    *
1095
-    */
1096
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1097
-    {
1088
+	}
1089
+
1090
+	/**
1091
+	 * Gets all number of flight over countries
1092
+	 *
1093
+	 * @return Array the airline country list
1094
+	 *
1095
+	 */
1096
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1097
+	{
1098 1098
 	global $globalDBdriver;
1099 1099
 	/*
1100 1100
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1104,14 +1104,14 @@  discard block
 block discarded – undo
1104 1104
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1105 1105
 		    FROM countries c, spotter_archive s
1106 1106
 		    WHERE c.iso2 = s.over_country ";
1107
-                if ($olderthanmonths > 0) {
1108
-            		if ($globalDBdriver == 'mysql') {
1107
+				if ($olderthanmonths > 0) {
1108
+					if ($globalDBdriver == 'mysql') {
1109 1109
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1110 1110
 			} else {
1111 1111
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1112 1112
 			}
1113 1113
 		}
1114
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1114
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1115 1115
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1116 1116
 	if ($limit) $query .= " LIMIT 0,10";
1117 1117
       
@@ -1124,23 +1124,23 @@  discard block
 block discarded – undo
1124 1124
         
1125 1125
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1126 1126
 	{
1127
-	    $temp_array['flight_count'] = $row['nb'];
1128
-	    $temp_array['flight_country'] = $row['name'];
1129
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1130
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1131
-	    $flight_array[] = $temp_array;
1127
+		$temp_array['flight_count'] = $row['nb'];
1128
+		$temp_array['flight_country'] = $row['name'];
1129
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1130
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1131
+		$flight_array[] = $temp_array;
1132 1132
 	}
1133 1133
 	return $flight_array;
1134
-    }
1135
-
1136
-    /**
1137
-    * Gets all number of flight over countries
1138
-    *
1139
-    * @return Array the airline country list
1140
-    *
1141
-    */
1142
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1143
-    {
1134
+	}
1135
+
1136
+	/**
1137
+	 * Gets all number of flight over countries
1138
+	 *
1139
+	 * @return Array the airline country list
1140
+	 *
1141
+	 */
1142
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1143
+	{
1144 1144
 	global $globalDBdriver;
1145 1145
 	/*
1146 1146
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1150,14 +1150,14 @@  discard block
 block discarded – undo
1150 1150
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1151 1151
 		    FROM countries c, spotter_archive s, spotter_output o
1152 1152
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.flightaware_id = s.flightaware_id ";
1153
-                if ($olderthanmonths > 0) {
1154
-            		if ($globalDBdriver == 'mysql') {
1153
+				if ($olderthanmonths > 0) {
1154
+					if ($globalDBdriver == 'mysql') {
1155 1155
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1156 1156
 			} else {
1157 1157
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1158 1158
 			}
1159 1159
 		}
1160
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1160
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1161 1161
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1162 1162
 	if ($limit) $query .= " LIMIT 0,10";
1163 1163
       
@@ -1170,24 +1170,24 @@  discard block
 block discarded – undo
1170 1170
         
1171 1171
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1172 1172
 	{
1173
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1174
-	    $temp_array['flight_count'] = $row['nb'];
1175
-	    $temp_array['flight_country'] = $row['name'];
1176
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1177
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1178
-	    $flight_array[] = $temp_array;
1173
+		$temp_array['airline_icao'] = $row['airline_icao'];
1174
+		$temp_array['flight_count'] = $row['nb'];
1175
+		$temp_array['flight_country'] = $row['name'];
1176
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1177
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1178
+		$flight_array[] = $temp_array;
1179 1179
 	}
1180 1180
 	return $flight_array;
1181
-    }
1182
-
1183
-    /**
1184
-    * Gets last spotter information based on a particular callsign
1185
-    *
1186
-    * @return Array the spotter information
1187
-    *
1188
-    */
1189
-    public function getDateArchiveSpotterDataById($id,$date)
1190
-    {
1181
+	}
1182
+
1183
+	/**
1184
+	 * Gets last spotter information based on a particular callsign
1185
+	 *
1186
+	 * @return Array the spotter information
1187
+	 *
1188
+	 */
1189
+	public function getDateArchiveSpotterDataById($id,$date)
1190
+	{
1191 1191
 	$Spotter = new Spotter($this->db);
1192 1192
 	date_default_timezone_set('UTC');
1193 1193
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1195,16 +1195,16 @@  discard block
 block discarded – undo
1195 1195
 	$date = date('c',$date);
1196 1196
 	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1197 1197
 	return $spotter_array;
1198
-    }
1199
-
1200
-    /**
1201
-    * Gets all the spotter information based on a particular callsign
1202
-    *
1203
-    * @return Array the spotter information
1204
-    *
1205
-    */
1206
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1207
-    {
1198
+	}
1199
+
1200
+	/**
1201
+	 * Gets all the spotter information based on a particular callsign
1202
+	 *
1203
+	 * @return Array the spotter information
1204
+	 *
1205
+	 */
1206
+	public function getDateArchiveSpotterDataByIdent($ident,$date)
1207
+	{
1208 1208
 	$Spotter = new Spotter($this->db);
1209 1209
 	date_default_timezone_set('UTC');
1210 1210
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1212,16 +1212,16 @@  discard block
 block discarded – undo
1212 1212
 	$date = date('c',$date);
1213 1213
 	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1214 1214
 	return $spotter_array;
1215
-    }
1216
-
1217
-    /**
1218
-    * Gets all the spotter information based on the airport
1219
-    *
1220
-    * @return Array the spotter information
1221
-    *
1222
-    */
1223
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1224
-    {
1215
+	}
1216
+
1217
+	/**
1218
+	 * Gets all the spotter information based on the airport
1219
+	 *
1220
+	 * @return Array the spotter information
1221
+	 *
1222
+	 */
1223
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1224
+	{
1225 1225
 	global $global_query;
1226 1226
 	$Spotter = new Spotter($this->db);
1227 1227
 	date_default_timezone_set('UTC');
@@ -1232,35 +1232,35 @@  discard block
 block discarded – undo
1232 1232
 	
1233 1233
 	if ($airport != "")
1234 1234
 	{
1235
-	    if (!is_string($airport))
1236
-	    {
1235
+		if (!is_string($airport))
1236
+		{
1237 1237
 		return false;
1238
-	    } else {
1238
+		} else {
1239 1239
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))";
1240 1240
 		$query_values = array(':airport' => $airport);
1241
-	    }
1241
+		}
1242 1242
 	}
1243 1243
 	
1244 1244
 	if ($limit != "")
1245 1245
 	{
1246
-	    $limit_array = explode(",", $limit);
1246
+		$limit_array = explode(",", $limit);
1247 1247
 	    
1248
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1249
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1248
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1249
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1250 1250
 	    
1251
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1252
-	    {
1251
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1252
+		{
1253 1253
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1254 1254
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1255
-	    }
1255
+		}
1256 1256
 	}
1257 1257
 	
1258 1258
 	if ($sort != "")
1259 1259
 	{
1260
-	    $search_orderby_array = $Spotter->getOrderBy();
1261
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1260
+		$search_orderby_array = $Spotter->getOrderBy();
1261
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1262 1262
 	} else {
1263
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1263
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1264 1264
 	}
1265 1265
 
1266 1266
 	$query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1268,6 +1268,6 @@  discard block
 block discarded – undo
1268 1268
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1269 1269
 
1270 1270
 	return $spotter_array;
1271
-    }
1271
+	}
1272 1272
 }
1273 1273
 ?>
1274 1274
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -14,75 +14,75 @@  discard block
 block discarded – undo
14 14
 	* @param Array $filter the filter
15 15
 	* @return Array the SQL part
16 16
 	*/
17
-	public function getFilter($filter = array(),$where = false,$and = false) {
17
+	public function getFilter($filter = array(), $where = false, $and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
20 20
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21 21
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22 22
 				$filters = $globalStatsFilters[$globalFilterName];
23 23
 			} else {
24
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
24
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
25 25
 			}
26 26
 		}
27 27
 		if (isset($filter[0]['source'])) {
28
-			$filters = array_merge($filters,$filter);
28
+			$filters = array_merge($filters, $filter);
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
35 35
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
36 36
 					if (isset($flt['source'])) {
37
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
37
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
38 38
 					} else {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
40 40
 					}
41 41
 				}
42 42
 			}
43 43
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
44 44
 				if (isset($flt['source'])) {
45
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
45
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
46 46
 				} else {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
48 48
 				}
49 49
 			}
50 50
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
51 51
 				if (isset($flt['source'])) {
52
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
52
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
53 53
 				} else {
54
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
54
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
55 55
 				}
56 56
 			}
57 57
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
58 58
 				if (isset($flt['source'])) {
59
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
59
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
60 60
 				} else {
61
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
61
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
62 62
 				}
63 63
 			}
64 64
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
65 65
 				if (isset($flt['source'])) {
66
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
66
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
67 67
 				}
68 68
 			}
69 69
 		}
70 70
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
71 71
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
72
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
72
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
73 73
 			}
74 74
 		}
75 75
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
76 76
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
77 77
 		}
78 78
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
79
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
79
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
80 80
 		}
81 81
 		if (isset($filter['source']) && !empty($filter['source'])) {
82 82
 			if (count($filter['source']) == 1) {
83 83
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
84 84
 			} else {
85
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
85
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
86 86
 			}
87 87
 		}
88 88
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 			$filter_query_where .= " AND flightaware_id = '".$filter['id']."'";
93 93
 		}
94 94
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
95
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
95
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
96 96
 		}
97 97
 		if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) {
98 98
 			$filter_query_date = '';
@@ -117,41 +117,41 @@  discard block
 block discarded – undo
117 117
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'";
118 118
 				}
119 119
 			}
120
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
120
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
121 121
 		}
122 122
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
123 123
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
124 124
 		if ($filter_query_where != '') {
125
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
125
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
126 126
 		}
127 127
 		$filter_query = $filter_query_join.$filter_query_where;
128 128
 		return $filter_query;
129 129
 	}
130 130
 
131 131
 	// Spotter_archive
132
-	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
132
+	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') {
133 133
 		require_once(dirname(__FILE__).'/class.Spotter.php');
134 134
 		if ($over_country == '') {
135 135
 			$Spotter = new Spotter($this->db);
136
-			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
136
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
137 137
 			if (!empty($data_country)) $country = $data_country['iso2'];
138 138
 			else $country = '';
139 139
 		} else $country = $over_country;
140
-		if ($airline_type === NULL) $airline_type ='';
140
+		if ($airline_type === NULL) $airline_type = '';
141 141
 	
142 142
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
143 143
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
144 144
 
145 145
 		// Route is not added in spotter_archive
146
-		$query  = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude)
146
+		$query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude)
147 147
 		        VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)";
148 148
 
149
-		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude);
149
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude);
150 150
 		try {
151 151
 			$sth = $this->db->prepare($query);
152 152
 			$sth->execute($query_values);
153 153
 			$sth->closeCursor();
154
-		} catch(PDOException $e) {
154
+		} catch (PDOException $e) {
155 155
 			return "error : ".$e->getMessage();
156 156
 		}
157 157
 		return "success";
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 
172 172
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
173 173
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
174
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
174
+                $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
175 175
 
176
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
176
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
177 177
 
178 178
                 return $spotter_array;
179 179
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
193 193
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
194 194
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
195
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
195
+                $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
196 196
 
197 197
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
198 198
                   /*
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                 }
206 206
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
207 207
                 */
208
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
208
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
209 209
 
210 210
                 return $spotter_array;
211 211
         }
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
 	{
221 221
                 date_default_timezone_set('UTC');
222 222
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
223
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
223
+                $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
224 224
 
225 225
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
226 226
 
227 227
                 try {
228 228
                         $sth = $this->db->prepare($query);
229 229
                         $sth->execute(array(':id' => $id));
230
-                } catch(PDOException $e) {
230
+                } catch (PDOException $e) {
231 231
                         echo $e->getMessage();
232 232
                         die;
233 233
                 }
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
         {
247 247
                 date_default_timezone_set('UTC');
248 248
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
249
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC";
249
+                $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC";
250 250
                 try {
251 251
                         $sth = $this->db->prepare($query);
252 252
                         $sth->execute(array(':id' => $id));
253
-                } catch(PDOException $e) {
253
+                } catch (PDOException $e) {
254 254
                         echo $e->getMessage();
255 255
                         die;
256 256
                 }
@@ -271,12 +271,12 @@  discard block
 block discarded – undo
271 271
                 date_default_timezone_set('UTC');
272 272
 
273 273
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
274
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
274
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
275 275
 
276 276
                 try {
277 277
                         $sth = $this->db->prepare($query);
278 278
                         $sth->execute(array(':ident' => $ident));
279
-                } catch(PDOException $e) {
279
+                } catch (PDOException $e) {
280 280
                         echo $e->getMessage();
281 281
                         die;
282 282
                 }
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
                 date_default_timezone_set('UTC');
298 298
 
299 299
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
300
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
300
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
301 301
 
302 302
                 try {
303 303
                         $sth = $this->db->prepare($query);
304 304
                         $sth->execute(array(':id' => $id));
305
-                } catch(PDOException $e) {
305
+                } catch (PDOException $e) {
306 306
                         echo $e->getMessage();
307 307
                         die;
308 308
                 }
@@ -321,11 +321,11 @@  discard block
 block discarded – undo
321 321
 	{
322 322
 		date_default_timezone_set('UTC');
323 323
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
324
-		$query  = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
324
+		$query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
325 325
 		try {
326 326
 			$sth = $this->db->prepare($query);
327 327
 			$sth->execute(array(':id' => $id));
328
-		} catch(PDOException $e) {
328
+		} catch (PDOException $e) {
329 329
 			echo $e->getMessage();
330 330
 			die;
331 331
 		}
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
 	{
344 344
 		date_default_timezone_set('UTC');
345 345
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
346
-		$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
346
+		$query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
347 347
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
348 348
 		try {
349 349
 			$sth = $this->db->prepare($query);
350 350
 			$sth->execute(array(':ident' => $ident));
351
-		} catch(PDOException $e) {
351
+		} catch (PDOException $e) {
352 352
 			echo $e->getMessage();
353 353
 			die;
354 354
 		}
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
         * @return Array the spotter information
365 365
         *
366 366
         */
367
-	public function getSpotterArchiveData($ident,$flightaware_id,$date)
367
+	public function getSpotterArchiveData($ident, $flightaware_id, $date)
368 368
 	{
369 369
 		$Spotter = new Spotter($this->db);
370 370
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
371
-		$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
372
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
371
+		$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
372
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%'));
373 373
 		return $spotter_array;
374 374
 	}
375 375
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		try {
385 385
 			$sth = $this->db->prepare($query);
386 386
 			$sth->execute();
387
-		} catch(PDOException $e) {
387
+		} catch (PDOException $e) {
388 388
 			echo $e->getMessage();
389 389
 			die;
390 390
 		}
@@ -396,24 +396,24 @@  discard block
 block discarded – undo
396 396
         * @return Array the spotter information
397 397
         *
398 398
         */
399
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
399
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
400 400
         {
401 401
                 global $globalDBdriver, $globalLiveInterval;
402 402
                 date_default_timezone_set('UTC');
403 403
 
404 404
                 $filter_query = '';
405 405
                 if (isset($filter['source']) && !empty($filter['source'])) {
406
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
406
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
407 407
                 }
408 408
                 // Use spotter_output also ?
409 409
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
410
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
410
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
411 411
                 }
412 412
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
413 413
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
414 414
                 }
415 415
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
416
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
416
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
417 417
                 }
418 418
 
419 419
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -432,14 +432,14 @@  discard block
 block discarded – undo
432 432
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
433 433
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
434 434
 */
435
-			$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
435
+			$query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
436 436
 				    FROM spotter_archive 
437 437
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
438 438
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
439 439
                         	    '.$filter_query.' ORDER BY flightaware_id';
440 440
                 } else {
441 441
                         //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
442
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
442
+                        $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
443 443
                         	    FROM spotter_archive 
444 444
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
445 445
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
                 try {
450 450
                         $sth = $this->db->prepare($query);
451 451
                         $sth->execute();
452
-                } catch(PDOException $e) {
452
+                } catch (PDOException $e) {
453 453
                         echo $e->getMessage();
454 454
                         die;
455 455
                 }
@@ -464,24 +464,24 @@  discard block
 block discarded – undo
464 464
         * @return Array the spotter information
465 465
         *
466 466
         */
467
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
467
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
468 468
         {
469 469
                 global $globalDBdriver, $globalLiveInterval;
470 470
                 date_default_timezone_set('UTC');
471 471
 
472 472
                 $filter_query = '';
473 473
                 if (isset($filter['source']) && !empty($filter['source'])) {
474
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
474
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
475 475
                 }
476 476
                 // Should use spotter_output also ?
477 477
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
478
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
478
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
479 479
                 }
480 480
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
481 481
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
482 482
                 }
483 483
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
484
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
484
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
485 485
                 }
486 486
 
487 487
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                     		    FROM spotter_archive 
492 492
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
493 493
 			*/
494
-			$query  = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
494
+			$query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
495 495
 				    FROM spotter_archive_output 
496 496
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
497 497
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
507 507
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
508 508
                         */
509
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
509
+                        $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
510 510
                         	    FROM spotter_archive_output 
511 511
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
512 512
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                 try {
519 519
                         $sth = $this->db->prepare($query);
520 520
                         $sth->execute();
521
-                } catch(PDOException $e) {
521
+                } catch (PDOException $e) {
522 522
                         echo $e->getMessage();
523 523
                         die;
524 524
                 }
@@ -533,23 +533,23 @@  discard block
 block discarded – undo
533 533
         * @return Array the spotter information
534 534
         *
535 535
         */
536
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
536
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
537 537
         {
538 538
                 global $globalDBdriver, $globalLiveInterval;
539 539
                 date_default_timezone_set('UTC');
540 540
 
541 541
                 $filter_query = '';
542 542
                 if (isset($filter['source']) && !empty($filter['source'])) {
543
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
543
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
544 544
                 }
545 545
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
546
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
546
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
547 547
                 }
548 548
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
549 549
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
550 550
                 }
551 551
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
552
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
552
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
553 553
                 }
554 554
 
555 555
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                 try {
565 565
                         $sth = $this->db->prepare($query);
566 566
                         $sth->execute();
567
-                } catch(PDOException $e) {
567
+                } catch (PDOException $e) {
568 568
                         echo $e->getMessage();
569 569
                         die;
570 570
                 }
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
     * @return Array the spotter information
585 585
     *
586 586
     */
587
-    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
587
+    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
588 588
     {
589 589
 	global $globalTimezone, $globalDBdriver;
590 590
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 	        
607 607
 		$q_array = explode(" ", $q);
608 608
 		
609
-		foreach ($q_array as $q_item){
609
+		foreach ($q_array as $q_item) {
610 610
 		    $additional_query .= " AND (";
611 611
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
612 612
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 	
639 639
 	if ($registration != "")
640 640
 	{
641
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
641
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
642 642
 	    if (!is_string($registration))
643 643
 	    {
644 644
 		return false;
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 	
650 650
 	if ($aircraft_icao != "")
651 651
 	{
652
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
652
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
653 653
 	    if (!is_string($aircraft_icao))
654 654
 	    {
655 655
 		return false;
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	
661 661
 	if ($aircraft_manufacturer != "")
662 662
 	{
663
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
663
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
664 664
 	    if (!is_string($aircraft_manufacturer))
665 665
 	    {
666 666
 		return false;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	
682 682
 	if ($airline_icao != "")
683 683
 	{
684
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
684
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
685 685
 	    if (!is_string($airline_icao))
686 686
 	    {
687 687
 		return false;
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	
693 693
 	if ($airline_country != "")
694 694
 	{
695
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
695
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
696 696
 	    if (!is_string($airline_country))
697 697
 	    {
698 698
 		return false;
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	
704 704
 	if ($airline_type != "")
705 705
 	{
706
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
706
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
707 707
 	    if (!is_string($airline_type))
708 708
 	    {
709 709
 		return false;
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	
726 726
 	if ($airport != "")
727 727
 	{
728
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
728
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
729 729
 	    if (!is_string($airport))
730 730
 	    {
731 731
 		return false;
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 	
737 737
 	if ($airport_country != "")
738 738
 	{
739
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
739
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
740 740
 	    if (!is_string($airport_country))
741 741
 	    {
742 742
 		return false;
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
     
748 748
 	if ($callsign != "")
749 749
 	{
750
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
750
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
751 751
 	    if (!is_string($callsign))
752 752
 	    {
753 753
 		return false;
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 		$translate = $Translation->ident2icao($callsign);
756 756
 		if ($translate != $callsign) {
757 757
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
758
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
758
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
759 759
 		} else {
760 760
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
761 761
 		}
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
 	if ($owner != "")
766 766
 	{
767
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
767
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
768 768
 	    if (!is_string($owner))
769 769
 	    {
770 770
 		return false;
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 
776 776
 	if ($pilot_name != "")
777 777
 	{
778
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
778
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
779 779
 	    if (!is_string($pilot_name))
780 780
 	    {
781 781
 		return false;
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 	
787 787
 	if ($pilot_id != "")
788 788
 	{
789
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
789
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
790 790
 	    if (!is_string($pilot_id))
791 791
 	    {
792 792
 		return false;
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	
798 798
 	if ($departure_airport_route != "")
799 799
 	{
800
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
800
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
801 801
 	    if (!is_string($departure_airport_route))
802 802
 	    {
803 803
 		return false;
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 	
809 809
 	if ($arrival_airport_route != "")
810 810
 	{
811
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
811
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
812 812
 	    if (!is_string($arrival_airport_route))
813 813
 	    {
814 814
 		return false;
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 	{
822 822
 	    $altitude_array = explode(",", $altitude);
823 823
 	    
824
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
825
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
824
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
825
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
826 826
 	    
827 827
 
828 828
 	    if ($altitude_array[1] != "")
@@ -839,8 +839,8 @@  discard block
 block discarded – undo
839 839
 	if ($date_posted != "")
840 840
 	{
841 841
 		$date_array = explode(",", $date_posted);
842
-		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
843
-		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
842
+		$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
843
+		$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
844 844
 		if ($globalTimezone != '') {
845 845
 			date_default_timezone_set($globalTimezone);
846 846
 			$datetime = new DateTime();
@@ -867,8 +867,8 @@  discard block
 block discarded – undo
867 867
 		if ($limit != "")
868 868
 		{
869 869
 			$limit_array = explode(",", $limit);
870
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
871
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
870
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
871
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
872 872
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
873 873
 			{
874 874
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 			}
877 877
 		}
878 878
 		if ($origLat != "" && $origLon != "" && $dist != "") {
879
-			$dist = number_format($dist*0.621371,2,'.','');
880
-			$query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
879
+			$dist = number_format($dist*0.621371, 2, '.', '');
880
+			$query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
881 881
 			      FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
882 882
 			      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance";
883 883
 		} else {
@@ -893,12 +893,12 @@  discard block
 block discarded – undo
893 893
 				$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
894 894
 			}
895 895
 
896
-			$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
896
+			$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
897 897
 			    WHERE spotter_archive_output.ident <> '' 
898 898
 			    ".$additional_query."
899 899
 			    ".$filter_query.$orderby_query;
900 900
 		}
901
-		$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
901
+		$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
902 902
 		return $spotter_array;
903 903
 	}
904 904
 
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 		try {
914 914
 			$sth = $this->db->prepare($query);
915 915
 			$sth->execute();
916
-		} catch(PDOException $e) {
916
+		} catch (PDOException $e) {
917 917
 			return "error";
918 918
 		}
919 919
 	}
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
 	{
951 951
 	    $limit_array = explode(",", $limit);
952 952
 	    
953
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
954
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
953
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
954
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
955 955
 	    
956 956
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
957 957
 	    {
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 	$query_values = array();
993 993
 	$limit_query = '';
994 994
 	$additional_query = '';
995
-	$filter_query = $this->getFilter($filter,true,true);
995
+	$filter_query = $this->getFilter($filter, true, true);
996 996
 	
997 997
 	if ($owner != "")
998 998
 	{
@@ -1009,8 +1009,8 @@  discard block
 block discarded – undo
1009 1009
 	{
1010 1010
 	    $limit_array = explode(",", $limit);
1011 1011
 	    
1012
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1013
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1012
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1013
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1014 1014
 	    
1015 1015
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1016 1016
 	    {
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 	$query_values = array();
1051 1051
 	$limit_query = '';
1052 1052
 	$additional_query = '';
1053
-	$filter_query = $this->getFilter($filter,true,true);
1053
+	$filter_query = $this->getFilter($filter, true, true);
1054 1054
 	
1055 1055
 	if ($pilot != "")
1056 1056
 	{
@@ -1062,8 +1062,8 @@  discard block
 block discarded – undo
1062 1062
 	{
1063 1063
 	    $limit_array = explode(",", $limit);
1064 1064
 	    
1065
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1066
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1065
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1066
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1067 1067
 	    
1068 1068
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1069 1069
 	    {
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
     * @return Array the airline country list
1094 1094
     *
1095 1095
     */
1096
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1096
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1097 1097
     {
1098 1098
 	global $globalDBdriver;
1099 1099
 	/*
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 	$flight_array = array();
1123 1123
 	$temp_array = array();
1124 1124
         
1125
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1125
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1126 1126
 	{
1127 1127
 	    $temp_array['flight_count'] = $row['nb'];
1128 1128
 	    $temp_array['flight_country'] = $row['name'];
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
     * @return Array the airline country list
1140 1140
     *
1141 1141
     */
1142
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1142
+    public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
1143 1143
     {
1144 1144
 	global $globalDBdriver;
1145 1145
 	/*
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 	$flight_array = array();
1169 1169
 	$temp_array = array();
1170 1170
         
1171
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1171
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1172 1172
 	{
1173 1173
 	    $temp_array['airline_icao'] = $row['airline_icao'];
1174 1174
 	    $temp_array['flight_count'] = $row['nb'];
@@ -1186,14 +1186,14 @@  discard block
 block discarded – undo
1186 1186
     * @return Array the spotter information
1187 1187
     *
1188 1188
     */
1189
-    public function getDateArchiveSpotterDataById($id,$date)
1189
+    public function getDateArchiveSpotterDataById($id, $date)
1190 1190
     {
1191 1191
 	$Spotter = new Spotter($this->db);
1192 1192
 	date_default_timezone_set('UTC');
1193 1193
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1194
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1195
-	$date = date('c',$date);
1196
-	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1194
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1195
+	$date = date('c', $date);
1196
+	$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1197 1197
 	return $spotter_array;
1198 1198
     }
1199 1199
 
@@ -1203,14 +1203,14 @@  discard block
 block discarded – undo
1203 1203
     * @return Array the spotter information
1204 1204
     *
1205 1205
     */
1206
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1206
+    public function getDateArchiveSpotterDataByIdent($ident, $date)
1207 1207
     {
1208 1208
 	$Spotter = new Spotter($this->db);
1209 1209
 	date_default_timezone_set('UTC');
1210 1210
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1211
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1212
-	$date = date('c',$date);
1213
-	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1211
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1212
+	$date = date('c', $date);
1213
+	$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1214 1214
 	return $spotter_array;
1215 1215
     }
1216 1216
 
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
     * @return Array the spotter information
1221 1221
     *
1222 1222
     */
1223
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1223
+    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1224 1224
     {
1225 1225
 	global $global_query;
1226 1226
 	$Spotter = new Spotter($this->db);
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 	$query_values = array();
1229 1229
 	$limit_query = '';
1230 1230
 	$additional_query = '';
1231
-	$filter_query = $this->getFilter($filters,true,true);
1231
+	$filter_query = $this->getFilter($filters, true, true);
1232 1232
 	
1233 1233
 	if ($airport != "")
1234 1234
 	{
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 	{
1246 1246
 	    $limit_array = explode(",", $limit);
1247 1247
 	    
1248
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1249
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1248
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1249
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1250 1250
 	    
1251 1251
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1252 1252
 	    {
Please login to merge, or discard this patch.
index.php 3 patches
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
50 50
 </tr></table></div>
51 51
 <?php
52
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
52
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
53 53
 ?>
54 54
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
55 55
 <?php
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
74 74
 <?php
75 75
 	}
76
-    }
76
+	}
77 77
 ?>
78 78
 
79 79
 <div id="sidebar" class="sidebar collapsed">
@@ -84,34 +84,34 @@  discard block
 block discarded – undo
84 84
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
85 85
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
86 86
 <?php
87
-    if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
87
+	if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
88 88
 	if (isset($globalArchive) && $globalArchive == TRUE) {
89 89
 ?>
90 90
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
91 91
 <?php
92 92
 	}
93
-    }
93
+	}
94 94
 ?>
95 95
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
96 96
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
97 97
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
98 98
 <?php
99
-    if (isset($globalMap3D) && $globalMap3D) {
99
+	if (isset($globalMap3D) && $globalMap3D) {
100 100
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
101 101
 ?>
102 102
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
103 103
 <?php
104 104
 	} else {
105
-	    if (isset($globalSatellite) && $globalSatellite) {
105
+		if (isset($globalSatellite) && $globalSatellite) {
106 106
 ?>
107 107
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
108 108
 <?php
109
-	    }
109
+		}
110 110
 ?>
111 111
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
112 112
 <?php
113 113
 	}
114
-    }
114
+	}
115 115
 ?>
116 116
     </ul>
117 117
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 ?>
187 187
         </div>
188 188
 <?php
189
-    if (isset($globalArchive) && $globalArchive == TRUE) {
189
+	if (isset($globalArchive) && $globalArchive == TRUE) {
190 190
 ?>
191 191
         <div class="sidebar-pane" id="archive">
192 192
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	    </form>
246 246
 	</div>
247 247
 <?php
248
-    }
248
+	}
249 249
 ?>
250 250
         <div class="sidebar-pane" id="settings">
251 251
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -256,72 +256,72 @@  discard block
 block discarded – undo
256 256
 			    <?php
257 257
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
258 258
 				else $MapType = $_COOKIE['MapType'];
259
-			    ?>
259
+				?>
260 260
 			    <?php
261 261
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
262
-			    ?>
262
+				?>
263 263
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
264 264
 			    <?php
265 265
 				} else {
266
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
267
-			    ?>
266
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
267
+				?>
268 268
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
269 269
 			    <?php
270
-				    }
271
-			    ?>
270
+					}
271
+				?>
272 272
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
273 273
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
274 274
 			    <?php
275
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
276
-			    ?>
275
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
276
+				?>
277 277
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
278 278
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
279 279
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
280 280
 			    <?php
281
-				    }
282
-			    ?>
281
+					}
282
+				?>
283 283
 			    <?php
284
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
285
-			    ?>
284
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
285
+				?>
286 286
 			    <?php
287 287
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
288
-			    ?>
288
+				?>
289 289
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
290 290
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
291 291
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
292 292
 			    <?php
293 293
 					}
294
-			    ?>
294
+				?>
295 295
 			    <?php
296 296
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
297
-			    ?>
297
+				?>
298 298
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
299 299
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
300 300
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
301 301
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
302 302
 			    <?php
303 303
 					}
304
-			    ?>
304
+				?>
305 305
 			    <?php
306 306
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
307
-			    ?>
307
+				?>
308 308
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
309 309
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
310 310
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
311 311
 			    <?php
312 312
 					}
313
-			    ?>
313
+				?>
314 314
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
315 315
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
316 316
 			    <?php
317
-				    }
318
-			    ?>
317
+					}
318
+				?>
319 319
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
320 320
 			    <?php
321
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
321
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
322 322
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
323 323
 					else $MapBoxId = $_COOKIE['MapTypeId'];
324
-			    ?>
324
+				?>
325 325
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
326 326
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
327 327
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -336,16 +336,16 @@  discard block
 block discarded – undo
336 336
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
337 337
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
338 338
 			    <?php
339
-				    }
340
-			    ?>
339
+					}
340
+				?>
341 341
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
342 342
 			    <?php
343 343
 				}
344
-			    ?>
344
+				?>
345 345
 			</select>
346 346
 		    </li>
347 347
 <?php
348
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
348
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
349 349
 ?>
350 350
 		    <li><?php echo _("Type of Terrain:"); ?>
351 351
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 			</select>
357 357
 		    </li>
358 358
 <?php
359
-    }
359
+	}
360 360
 ?>
361 361
 <?php
362
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
362
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
363 363
 ?>
364 364
 		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
365 365
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
383 383
 <?php
384 384
 	}
385
-    }
385
+	}
386 386
 ?>
387 387
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
388 388
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
@@ -401,80 +401,80 @@  discard block
 block discarded – undo
401 401
 	}
402 402
 ?>
403 403
 <?php
404
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
404
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
405 405
 ?>
406 406
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
407 407
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
408 408
 <?php
409
-    }
410
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
409
+	}
410
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
411 411
 ?>
412 412
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
413 413
 <?php
414
-    }
414
+	}
415 415
 ?>
416 416
 		    <?php
417 417
 			if (function_exists('array_column')) {
418
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
419
-		    ?>
418
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
419
+			?>
420 420
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
421 421
 		    <?php
422
-			    }
422
+				}
423 423
 			} elseif (isset($globalSources)) {
424
-			    $dispolar = false;
425
-			    foreach ($globalSources as $testsource) {
426
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
427
-			    }
428
-			    if ($dispolar) {
429
-		    ?>
424
+				$dispolar = false;
425
+				foreach ($globalSources as $testsource) {
426
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
427
+				}
428
+				if ($dispolar) {
429
+			?>
430 430
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
431 431
 		    <?php
432
-			    }
433
-		        }
434
-		    ?>
432
+				}
433
+				}
434
+			?>
435 435
 <?php
436
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
436
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
437 437
 ?>
438 438
 
439 439
 		    <?php
440 440
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
441
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
442
-		    ?>
441
+					if (extension_loaded('gd') && function_exists('gd_info')) {
442
+			?>
443 443
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
444 444
 		    <?php 
445 445
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
446
-		    ?>
446
+			?>
447 447
 			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
448 448
 		    <?php
449 449
 				}
450
-			    }
451
-		        }
452
-		    ?>
450
+				}
451
+				}
452
+			?>
453 453
 		    <?php
454 454
 			if (isset($globalMarine) && $globalMarine === TRUE) {
455
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
456
-		    ?>
455
+				if (extension_loaded('gd') && function_exists('gd_info')) {
456
+			?>
457 457
 		    <li><?php echo _("Marine icon color:"); ?>
458 458
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
459 459
 		    </li>
460 460
 		    <?php
461
-			    }
462
-		        }
463
-		    ?>
461
+				}
462
+				}
463
+			?>
464 464
 		    <?php
465 465
 			if (isset($globalTracker) && $globalTracker === TRUE) {
466
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
467
-		    ?>
466
+				if (extension_loaded('gd') && function_exists('gd_info')) {
467
+			?>
468 468
 		    <li><?php echo _("Tracker icon color:"); ?>
469 469
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
470 470
 		    </li>
471 471
 		    <?php
472
-			    }
473
-		        }
474
-		    ?>
472
+				}
473
+				}
474
+			?>
475 475
 		    <?php
476 476
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
477
-		    ?>
477
+			?>
478 478
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
479 479
 			<div class="range">
480 480
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 		    </li>
484 484
 		    <?php
485 485
 			}
486
-		    ?>
486
+			?>
487 487
 <?php
488
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
488
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
489 489
 ?>
490 490
 <?php
491 491
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		    </li>
518 518
 <?php
519 519
 	}
520
-    }
520
+	}
521 521
 ?>
522 522
 		    <li><?php echo _("Distance unit:"); ?>
523 523
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -550,19 +550,19 @@  discard block
 block discarded – undo
550 550
 		    <ul>
551 551
 		    <?php
552 552
 			if (!isset($globalAircraft) || $globalAircraft) {
553
-		    ?>
553
+			?>
554 554
 		    <?php
555 555
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
556
-		    ?>
556
+			?>
557 557
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
558 558
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
559 559
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
560 560
 		    <?php
561 561
 			}
562
-		    ?>
562
+			?>
563 563
 		    <?php
564 564
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
565
-		    ?>
565
+			?>
566 566
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
567 567
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
568 568
 			<?php } ?>
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 			<?php } ?>
572 572
 		    <?php
573 573
 			}
574
-		    ?>
574
+			?>
575 575
 		    <li><?php echo _("Display airlines:"); ?>
576 576
 		    <br/>
577 577
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -591,14 +591,14 @@  discard block
 block discarded – undo
591 591
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
592 592
 					}
593 593
 				}
594
-			    ?>
594
+				?>
595 595
 			</select>
596 596
 		    </li>
597 597
 		    <?php
598 598
 			$Spotter = new Spotter();
599 599
 			$allalliancenames = $Spotter->getAllAllianceNames();
600 600
 			if (!empty($allalliancenames)) {
601
-		    ?>
601
+			?>
602 602
 		    <li><?php echo _("Display alliance:"); ?>
603 603
 		    <br/>
604 604
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -612,18 +612,18 @@  discard block
 block discarded – undo
612 612
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
613 613
 					}
614 614
 				}
615
-			    ?>
615
+				?>
616 616
 			</select>
617 617
 		    </li>
618 618
 		    <?php
619 619
 			}
620
-		    ?>
620
+			?>
621 621
 		    <?php
622 622
 			}
623
-		    ?>
623
+			?>
624 624
 		    <?php
625 625
 			if (isset($globalAPRS) && $globalAPRS) {
626
-		    ?>
626
+			?>
627 627
 		    <li><?php echo _("Display APRS sources name:"); ?>
628 628
 			<select class="selectpicker" multiple onchange="sources(this);">
629 629
 			    <?php
@@ -647,18 +647,18 @@  discard block
 block discarded – undo
647 647
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
648 648
 					}
649 649
 				}
650
-			    ?>
650
+				?>
651 651
 			</select>
652 652
 		    </li>
653 653
 		    <?php
654 654
 			}
655
-		    ?>
655
+			?>
656 656
 		    <?php
657 657
 			if (!isset($globalAircraft) || $globalAircraft) {
658
-		    ?>
658
+			?>
659 659
 		    <?php
660
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
661
-		    ?>
660
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
661
+			?>
662 662
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
663 663
 			<select class="selectpicker" onchange="airlinestype(this);">
664 664
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -668,21 +668,21 @@  discard block
 block discarded – undo
668 668
 			</select>
669 669
 		    </li>
670 670
 		    <?php
671
-			    }
672
-		    ?>
671
+				}
672
+			?>
673 673
 		    <?php
674 674
 			}
675
-		    ?>
675
+			?>
676 676
 		    <?php
677 677
 			if (isset($globalMarine) && $globalMarine) {
678
-		    ?>
678
+			?>
679 679
 		    <li>
680 680
 			<?php echo _("Display vessels with MMSI:"); ?>
681 681
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
682 682
 		    </li>
683 683
 		    <?php
684 684
 			}
685
-		    ?>
685
+			?>
686 686
 		    <li>
687 687
 			<?php echo _("Display with ident:"); ?>
688 688
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 	    </form>
696 696
     	</div>
697 697
 <?php
698
-    if (isset($globalSatellite) && $globalSatellite) {
698
+	if (isset($globalSatellite) && $globalSatellite) {
699 699
 ?>
700 700
         <div class="sidebar-pane" id="satellites">
701 701
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -735,14 +735,14 @@  discard block
 block discarded – undo
735 735
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
736 736
 					}
737 737
 				}
738
-			    ?>
738
+				?>
739 739
 			</select>
740 740
 		    </li>
741 741
 		</ul>
742 742
 	    </form>
743 743
 	</div>
744 744
 <?php
745
-    }
745
+	}
746 746
 ?>
747 747
     </div>
748 748
 </div>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 /*
20 20
 } else {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		        <div class="form-group">
198 198
 			    <label><?php echo _("From (UTC):"); ?></label>
199 199
 		            <div class='input-group date' id='datetimepicker1'>
200
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
200
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
201 201
 		                <span class="input-group-addon">
202 202
             			    <span class="glyphicon glyphicon-calendar"></span>
203 203
 		                </span>
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		        <div class="form-group">
207 207
 			    <label><?php echo _("To (UTC):"); ?></label>
208 208
 		            <div class='input-group date' id='datetimepicker2'>
209
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
209
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
210 210
             			<span class="input-group-addon">
211 211
 		                    <span class="glyphicon glyphicon-calendar"></span>
212 212
             			</span>
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
 		    <li><?php echo _("Type of Terrain:"); ?>
351 351
 			<select  class="selectpicker" onchange="terrainType(this);">
352 352
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
353
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
354
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
355
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
353
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
354
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
355
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option>
356 356
 			</select>
357 357
 		    </li>
358 358
 <?php
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
408 408
 <?php
409 409
     }
410
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
410
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
411 411
 ?>
412 412
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
413 413
 <?php
@@ -582,10 +582,10 @@  discard block
 block discarded – undo
582 582
 					$Spotter = new Spotter();
583 583
 					$allairlinenames = $Spotter->getAllAirlineNames();
584 584
 				}
585
-				foreach($allairlinenames as $airline) {
585
+				foreach ($allairlinenames as $airline) {
586 586
 					$airline_name = $airline['airline_name'];
587
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
588
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
587
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
588
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
589 589
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
590 590
 					} else {
591 591
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
605 605
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
606 606
 			    <?php
607
-				foreach($allalliancenames as $alliance) {
607
+				foreach ($allalliancenames as $alliance) {
608 608
 					$alliance_name = $alliance['alliance'];
609 609
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
610 610
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 				*/
641 641
 				$Source = new Source();
642 642
 				$datasource = $Source->getLocationInfoByType('gs');
643
-				foreach($datasource as $src) {
644
-					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) {
643
+				foreach ($datasource as $src) {
644
+					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) {
645 645
 						echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>';
646 646
 					} else {
647 647
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
730 730
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
731 731
 					
732
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
732
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
733 733
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
734 734
 					} else {
735 735
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Braces   +517 added lines, -130 removed lines patch added patch discarded remove patch
@@ -51,7 +51,10 @@  discard block
 block discarded – undo
51 51
 <?php
52 52
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
53 53
 ?>
54
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
54
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
55
+	print '?tsk='.$tsk;
56
+}
57
+?>"></script>
55 58
 <?php
56 59
 	if (!isset($globalAircraft) || $globalAircraft) {
57 60
 ?>
@@ -141,8 +144,14 @@  discard block
 block discarded – undo
141 144
 ?>
142 145
 		<form>
143 146
 			<ul>
144
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
145
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
151
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("Display airspace"); ?></label></div></li>
146 155
 			</ul>
147 156
 		</form>
148 157
 <?php
@@ -150,8 +159,14 @@  discard block
 block discarded – undo
150 159
 ?>
151 160
 		<form>
152 161
 			<ul>
153
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
154
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
162
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
163
+	print 'checked';
164
+}
165
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
166
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
167
+	print 'checked';
168
+}
169
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
155 170
 			</ul>
156 171
 			<p>This layers are in Beta, this can and will crash.</p>
157 172
 		</form>
@@ -162,14 +177,32 @@  discard block
 block discarded – undo
162 177
 		<h1>NOTAM</h1>
163 178
 		<form>
164 179
 			<ul>
165
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
181
+	print 'checked';
182
+}
183
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
166 184
 				<li><?php echo _("NOTAM scope:"); ?>
167 185
 					<select class="selectpicker" onchange="notamscope(this);">
168
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
170
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
171
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
172
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
186
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
187
+	print ' selected';
188
+}
189
+?>>All</option>
190
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
191
+	print ' selected';
192
+}
193
+?>>Airport/Enroute warning</option>
194
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
195
+	print ' selected';
196
+}
197
+?>>Airport warning</option>
198
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
199
+	print ' selected';
200
+}
201
+?>>Navigation warning</option>
202
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
203
+	print ' selected';
204
+}
205
+?>>Enroute warning</option>
173 206
 					</select
174 207
 				</li>
175 208
 			</ul>
@@ -197,7 +230,12 @@  discard block
 block discarded – undo
197 230
 		        <div class="form-group">
198 231
 			    <label><?php echo _("From (UTC):"); ?></label>
199 232
 		            <div class='input-group date' id='datetimepicker1'>
200
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
233
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
234
+	print $_POST['start_date'];
235
+} elseif (isset($_COOKIE['archive_begin'])) {
236
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
237
+}
238
+?>" required />
201 239
 		                <span class="input-group-addon">
202 240
             			    <span class="glyphicon glyphicon-calendar"></span>
203 241
 		                </span>
@@ -206,7 +244,12 @@  discard block
 block discarded – undo
206 244
 		        <div class="form-group">
207 245
 			    <label><?php echo _("To (UTC):"); ?></label>
208 246
 		            <div class='input-group date' id='datetimepicker2'>
209
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
247
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
248
+	print $_POST['end_date'];
249
+} elseif (isset($_COOKIE['archive_end'])) {
250
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
251
+}
252
+?>" />
210 253
             			<span class="input-group-addon">
211 254
 		                    <span class="glyphicon glyphicon-calendar"></span>
212 255
             			</span>
@@ -231,8 +274,20 @@  discard block
 block discarded – undo
231 274
 			</script>
232 275
 		    <li><?php echo _("Playback speed:"); ?>
233 276
 			<div class="range">
234
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
235
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
277
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
278
+	print $_POST['archivespeed'];
279
+} elseif (isset($_COOKIE['archive_speed'])) {
280
+	print $_COOKIE['archive_speed'];
281
+} else {
282
+	print '1';
283
+}
284
+?>">
285
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
286
+	print $_COOKIE['archive_speed'];
287
+} else {
288
+	print '1';
289
+}
290
+?></output>
236 291
 			</div>
237 292
 		    </li>
238 293
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -254,29 +309,53 @@  discard block
 block discarded – undo
254 309
 		    <li><?php echo _("Type of Map:"); ?>
255 310
 			<select  class="selectpicker" onchange="mapType(this);">
256 311
 			    <?php
257
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
258
-				else $MapType = $_COOKIE['MapType'];
312
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
313
+					$MapType = $globalMapProvider;
314
+				} else {
315
+					$MapType = $_COOKIE['MapType'];
316
+				}
259 317
 			    ?>
260 318
 			    <?php
261 319
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
262 320
 			    ?>
263
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
321
+			    <option value="offline"<?php if ($MapType == 'offline') {
322
+	print ' selected';
323
+}
324
+?>>Natural Earth (local)</option>
264 325
 			    <?php
265 326
 				} else {
266 327
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
267 328
 			    ?>
268
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
329
+			    <option value="offline"<?php if ($MapType == 'offline') {
330
+	print ' selected';
331
+}
332
+?>>Natural Earth (local)</option>
269 333
 			    <?php
270 334
 				    }
271 335
 			    ?>
272
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
273
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
336
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
337
+	print ' selected';
338
+}
339
+?>>ArcGIS Streetmap</option>
340
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
341
+	print ' selected';
342
+}
343
+?>>ArcGIS Satellite</option>
274 344
 			    <?php
275 345
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
276 346
 			    ?>
277
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
278
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
279
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
347
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
348
+	print ' selected';
349
+}
350
+?>>Bing-Aerial</option>
351
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
352
+	print ' selected';
353
+}
354
+?>>Bing-Hybrid</option>
355
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
356
+	print ' selected';
357
+}
358
+?>>Bing-Road</option>
280 359
 			    <?php
281 360
 				    }
282 361
 			    ?>
@@ -286,59 +365,143 @@  discard block
 block discarded – undo
286 365
 			    <?php
287 366
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
288 367
 			    ?>
289
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
290
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
291
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
368
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
369
+	print ' selected';
370
+}
371
+?>>Here-Aerial</option>
372
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
373
+	print ' selected';
374
+}
375
+?>>Here-Hybrid</option>
376
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
377
+	print ' selected';
378
+}
379
+?>>Here-Road</option>
292 380
 			    <?php
293 381
 					}
294 382
 			    ?>
295 383
 			    <?php
296 384
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
297 385
 			    ?>
298
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
299
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
300
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
301
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
386
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
387
+	print ' selected';
388
+}
389
+?>>Google Roadmap</option>
390
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
391
+	print ' selected';
392
+}
393
+?>>Google Satellite</option>
394
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
395
+	print ' selected';
396
+}
397
+?>>Google Hybrid</option>
398
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
399
+	print ' selected';
400
+}
401
+?>>Google Terrain</option>
302 402
 			    <?php
303 403
 					}
304 404
 			    ?>
305 405
 			    <?php
306 406
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
307 407
 			    ?>
308
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
309
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
310
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
408
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
409
+	print ' selected';
410
+}
411
+?>>MapQuest-OSM</option>
412
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
413
+	print ' selected';
414
+}
415
+?>>MapQuest-Aerial</option>
416
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
417
+	print ' selected';
418
+}
419
+?>>MapQuest-Hybrid</option>
311 420
 			    <?php
312 421
 					}
313 422
 			    ?>
314
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
315
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
423
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
424
+	print ' selected';
425
+}
426
+?>>Yandex</option>
427
+			    <option value="offline"<?php if ($MapType == 'offline') {
428
+	print ' selected';
429
+}
430
+?>>Natural Earth</option>
316 431
 			    <?php
317 432
 				    }
318 433
 			    ?>
319
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
434
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
435
+	print ' selected';
436
+}
437
+?>>National Geographic Street</option>
320 438
 			    <?php
321 439
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
322
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
323
-					else $MapBoxId = $_COOKIE['MapTypeId'];
440
+					if (!isset($_COOKIE['MapTypeId'])) {
441
+						$MapBoxId = 'default';
442
+					} else {
443
+						$MapBoxId = $_COOKIE['MapTypeId'];
444
+					}
324 445
 			    ?>
325
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
326
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
327
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
328
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
329
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
330
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
331
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
332
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
333
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
334
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
335
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
336
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
337
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
446
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
447
+	print ' selected';
448
+}
449
+?>>Mapbox GL</option>
450
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
451
+	print ' selected';
452
+}
453
+?>>Mapbox default</option>
454
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
455
+	print ' selected';
456
+}
457
+?>>Mapbox streets</option>
458
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
459
+	print ' selected';
460
+}
461
+?>>Mapbox light</option>
462
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
463
+	print ' selected';
464
+}
465
+?>>Mapbox dark</option>
466
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
467
+	print ' selected';
468
+}
469
+?>>Mapbox satellite</option>
470
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
471
+	print ' selected';
472
+}
473
+?>>Mapbox streets-satellite</option>
474
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
475
+	print ' selected';
476
+}
477
+?>>Mapbox streets-basic</option>
478
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
479
+	print ' selected';
480
+}
481
+?>>Mapbox comic</option>
482
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
483
+	print ' selected';
484
+}
485
+?>>Mapbox outdoors</option>
486
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
487
+	print ' selected';
488
+}
489
+?>>Mapbox pencil</option>
490
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
491
+	print ' selected';
492
+}
493
+?>>Mapbox pirates</option>
494
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
495
+	print ' selected';
496
+}
497
+?>>Mapbox emerald</option>
338 498
 			    <?php
339 499
 				    }
340 500
 			    ?>
341
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
501
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
502
+	print ' selected';
503
+}
504
+?>>OpenStreetMap</option>
342 505
 			    <?php
343 506
 				}
344 507
 			    ?>
@@ -349,10 +512,22 @@  discard block
 block discarded – undo
349 512
 ?>
350 513
 		    <li><?php echo _("Type of Terrain:"); ?>
351 514
 			<select  class="selectpicker" onchange="terrainType(this);">
352
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
353
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
354
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
355
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
515
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
516
+	print ' selected';
517
+}
518
+?>>stk terrain</option>
519
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
520
+	print ' selected';
521
+}
522
+?>>ellipsoid</option>
523
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
524
+	print ' selected';
525
+}
526
+?>>vr terrain</option>
527
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
528
+	print ' selected';
529
+}
530
+?>>ArticDEM</option>
356 531
 			</select>
357 532
 		    </li>
358 533
 <?php
@@ -361,50 +536,98 @@  discard block
 block discarded – undo
361 536
 <?php
362 537
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
363 538
 ?>
364
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
539
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
540
+	print 'checked';
541
+}
542
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
365 543
 
366 544
 <?php
367 545
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
368 546
 ?>
369
-		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
370
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
371
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
372
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
373
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
547
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
548
+	print 'checked';
549
+}
550
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
551
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
552
+	print 'checked';
553
+}
554
+?> ><?php echo _("Display flight path"); ?></label></div></li>
555
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) {
556
+	print 'checked';
557
+}
558
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
559
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
560
+	print 'checked';
561
+}
562
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
563
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
564
+	print 'checked';
565
+}
566
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
374 567
 <?php
375 568
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
376 569
 ?>
377
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
570
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
571
+	print 'checked';
572
+}
573
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
378 574
 <?php
379 575
 	}
380 576
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
381 577
 ?>
382
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
578
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
579
+	print 'checked';
580
+}
581
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
383 582
 <?php
384 583
 	}
385 584
     }
386 585
 ?>
387
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
388
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
389
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
390
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
586
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
587
+	print 'checked';
588
+}
589
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
590
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
591
+	print 'checked';
592
+}
593
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
594
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
595
+	print 'checked';
596
+}
597
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
598
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
599
+	print 'checked';
600
+}
601
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
391 602
 <?php
392 603
 	if (isset($globalFires)) {
393 604
 ?>
394
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
605
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
606
+	print 'checked';
607
+}
608
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
395 609
 <?php
396 610
 	}
397 611
 	if (isset($globalMap3D) && $globalMap3D) {
398 612
 ?>
399
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
613
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') {
614
+	print 'checked';
615
+}
616
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
400 617
 <?php
401 618
 	}
402 619
 ?>
403 620
 <?php
404 621
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
405 622
 ?>
406
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
407
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
623
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
624
+	print 'checked';
625
+}
626
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
627
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
628
+	print 'checked';
629
+}
630
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
408 631
 <?php
409 632
     }
410 633
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -417,17 +640,25 @@  discard block
 block discarded – undo
417 640
 			if (function_exists('array_column')) {
418 641
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
419 642
 		    ?>
420
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
643
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
644
+	print 'checked';
645
+}
646
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
421 647
 		    <?php
422 648
 			    }
423 649
 			} elseif (isset($globalSources)) {
424 650
 			    $dispolar = false;
425 651
 			    foreach ($globalSources as $testsource) {
426
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
652
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
653
+			        	$dispolar = true;
654
+			        }
427 655
 			    }
428 656
 			    if ($dispolar) {
429 657
 		    ?>
430
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
658
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
659
+	print 'checked';
660
+}
661
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
431 662
 		    <?php
432 663
 			    }
433 664
 		        }
@@ -440,11 +671,21 @@  discard block
 block discarded – undo
440 671
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
441 672
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
442 673
 		    ?>
443
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
674
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
675
+	print 'checked';
676
+}
677
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
444 678
 		    <?php 
445 679
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
446 680
 		    ?>
447
-			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
681
+			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
682
+	print $_COOKIE['IconColor'];
683
+} elseif (isset($globalAircraftIconColor)) {
684
+	print $globalAircraftIconColor;
685
+} else {
686
+	print '1a3151';
687
+}
688
+?>"></li>
448 689
 		    <?php
449 690
 				}
450 691
 			    }
@@ -455,7 +696,14 @@  discard block
 block discarded – undo
455 696
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
456 697
 		    ?>
457 698
 		    <li><?php echo _("Marine icon color:"); ?>
458
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
699
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
700
+	print $_COOKIE['MarineIconColor'];
701
+} elseif (isset($globalMarineIconColor)) {
702
+	print $globalMarineIconColor;
703
+} else {
704
+	print '1a3151';
705
+}
706
+?>">
459 707
 		    </li>
460 708
 		    <?php
461 709
 			    }
@@ -466,7 +714,14 @@  discard block
 block discarded – undo
466 714
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
467 715
 		    ?>
468 716
 		    <li><?php echo _("Tracker icon color:"); ?>
469
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
717
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
718
+	print $_COOKIE['TrackerIconColor'];
719
+} elseif (isset($globalTrackerIconColor)) {
720
+	print $globalTrackerIconColor;
721
+} else {
722
+	print '1a3151';
723
+}
724
+?>">
470 725
 		    </li>
471 726
 		    <?php
472 727
 			    }
@@ -477,8 +732,22 @@  discard block
 block discarded – undo
477 732
 		    ?>
478 733
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
479 734
 			<div class="range">
480
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
481
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
735
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
736
+	print $_COOKIE['AirportZoom'];
737
+} elseif (isset($globalAirportZoom)) {
738
+	print $globalAirportZoom;
739
+} else {
740
+	print '7';
741
+}
742
+?>">
743
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
744
+	print $_COOKIE['AirportZoom'];
745
+} elseif (isset($globalAirportZoom)) {
746
+	print $globalAirportZoom;
747
+} else {
748
+	print '7';
749
+}
750
+?></output>
482 751
 			</div>
483 752
 		    </li>
484 753
 		    <?php
@@ -490,10 +759,23 @@  discard block
 block discarded – undo
490 759
 <?php
491 760
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
492 761
 ?>
493
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> ><?php echo _("Use airlines liveries"); ?></li>
494
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?>&nbsp;
762
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
763
+	print 'checked';
764
+}
765
+?> ><?php echo _("Use airlines liveries"); ?></li>
766
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
767
+	print 'checked';
768
+}
769
+?> ><?php echo _("Force Aircraft color"); ?>&nbsp;
495 770
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
496
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
771
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
772
+	print $_COOKIE['IconColor'];
773
+} elseif (isset($globalAircraftIconColor)) {
774
+	print $globalAircraftIconColor;
775
+} else {
776
+	print 'ff0000';
777
+}
778
+?>">
497 779
 		    </li>
498 780
 <?php
499 781
 	}
@@ -501,9 +783,19 @@  discard block
 block discarded – undo
501 783
 <?php
502 784
 	if (isset($globalMarine) && $globalMarine === TRUE) {
503 785
 ?>
504
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
786
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
787
+	print 'checked';
788
+}
789
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
505 790
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
506
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
791
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
792
+	print $_COOKIE['MarineIconColor'];
793
+} elseif (isset($globalMarineIconColor)) {
794
+	print $globalMarineIconColor;
795
+} else {
796
+	print 'ff0000';
797
+}
798
+?>">
507 799
 		    </li>
508 800
 <?php
509 801
 	}
@@ -511,9 +803,19 @@  discard block
 block discarded – undo
511 803
 <?php
512 804
 	if (isset($globalTracker) && $globalTracker === TRUE) {
513 805
 ?>
514
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
806
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
807
+	print 'checked';
808
+}
809
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
515 810
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
516
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
811
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
812
+	print $_COOKIE['TrackerIconColor'];
813
+} elseif (isset($globalTrackerIconColor)) {
814
+	print $globalTrackerIconColor;
815
+} else {
816
+	print 'ff0000';
817
+}
818
+?>">
517 819
 		    </li>
518 820
 <?php
519 821
 	}
@@ -521,22 +823,46 @@  discard block
 block discarded – undo
521 823
 ?>
522 824
 		    <li><?php echo _("Distance unit:"); ?>
523 825
 			<select class="selectpicker" onchange="unitdistance(this);">
524
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
525
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
526
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
826
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
827
+	echo ' selected';
828
+}
829
+?>>km</option>
830
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
831
+	echo ' selected';
832
+}
833
+?>>nm</option>
834
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
835
+	echo ' selected';
836
+}
837
+?>>mi</option>
527 838
 		        </select>
528 839
 		    </li>
529 840
 		    <li><?php echo _("Altitude unit:"); ?>
530 841
 			<select class="selectpicker" onchange="unitaltitude(this);">
531
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
532
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
842
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
843
+	echo ' selected';
844
+}
845
+?>>m</option>
846
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
847
+	echo ' selected';
848
+}
849
+?>>feet</option>
533 850
 		        </select>
534 851
 		    </li>
535 852
 		    <li><?php echo _("Speed unit:"); ?>
536 853
 			<select class="selectpicker" onchange="unitspeed(this);">
537
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
538
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
539
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
854
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
855
+	echo ' selected';
856
+}
857
+?>>km/h</option>
858
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
859
+	echo ' selected';
860
+}
861
+?>>mph</option>
862
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
863
+	echo ' selected';
864
+}
865
+?>>knots</option>
540 866
 		        </select>
541 867
 		    </li>
542 868
 
@@ -554,9 +880,18 @@  discard block
 block discarded – undo
554 880
 		    <?php
555 881
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
556 882
 		    ?>
557
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
558
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
559
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
883
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
884
+	print 'checked';
885
+}
886
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
887
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
888
+	print 'checked';
889
+}
890
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
891
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
892
+	print 'checked';
893
+}
894
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
560 895
 		    <?php
561 896
 			}
562 897
 		    ?>
@@ -564,10 +899,16 @@  discard block
 block discarded – undo
564 899
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
565 900
 		    ?>
566 901
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
567
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
902
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
903
+	print 'checked';
904
+}
905
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
568 906
 			<?php } ?>
569 907
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
570
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
908
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
909
+	print 'checked';
910
+}
911
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
571 912
 			<?php } ?>
572 913
 		    <?php
573 914
 			}
@@ -584,7 +925,9 @@  discard block
 block discarded – undo
584 925
 				}
585 926
 				foreach($allairlinenames as $airline) {
586 927
 					$airline_name = $airline['airline_name'];
587
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
928
+					if (strlen($airline_name) > 30) {
929
+						$airline_name = substr($airline_name,0,30).'...';
930
+					}
588 931
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
589 932
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
590 933
 					} else {
@@ -602,7 +945,10 @@  discard block
 block discarded – undo
602 945
 		    <li><?php echo _("Display alliance:"); ?>
603 946
 		    <br/>
604 947
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
605
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
948
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
949
+	echo ' selected';
950
+}
951
+?>><?php echo _("All"); ?></option>
606 952
 			    <?php
607 953
 				foreach($allalliancenames as $alliance) {
608 954
 					$alliance_name = $alliance['alliance'];
@@ -661,10 +1007,22 @@  discard block
 block discarded – undo
661 1007
 		    ?>
662 1008
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
663 1009
 			<select class="selectpicker" onchange="airlinestype(this);">
664
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
665
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
666
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
667
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1010
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1011
+	echo ' selected';
1012
+}
1013
+?>><?php echo _("All"); ?></option>
1014
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1015
+	echo ' selected';
1016
+}
1017
+?>><?php echo _("Passenger"); ?></option>
1018
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1019
+	echo ' selected';
1020
+}
1021
+?>><?php echo _("Cargo"); ?></option>
1022
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1023
+	echo ' selected';
1024
+}
1025
+?>><?php echo _("Military"); ?></option>
668 1026
 			</select>
669 1027
 		    </li>
670 1028
 		    <?php
@@ -678,14 +1036,20 @@  discard block
 block discarded – undo
678 1036
 		    ?>
679 1037
 		    <li>
680 1038
 			<?php echo _("Display vessels with MMSI:"); ?>
681
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1039
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1040
+	print $_COOKIE['filter_mmsi'];
1041
+}
1042
+?>" />
682 1043
 		    </li>
683 1044
 		    <?php
684 1045
 			}
685 1046
 		    ?>
686 1047
 		    <li>
687 1048
 			<?php echo _("Display with ident:"); ?>
688
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1049
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1050
+	print $_COOKIE['filter_ident'];
1051
+}
1052
+?>" />
689 1053
 		    </li>
690 1054
 		</ul>
691 1055
 	    </form>
@@ -701,7 +1065,10 @@  discard block
 block discarded – undo
701 1065
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
702 1066
 	    <form>
703 1067
 		<ul>
704
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1068
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1069
+	print 'checked';
1070
+}
1071
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
705 1072
 		    <li><?php echo _("Type:"); ?>
706 1073
 			<select class="selectpicker" multiple onchange="sattypes(this);">
707 1074
 			    <?php
@@ -709,25 +1076,45 @@  discard block
 block discarded – undo
709 1076
 				$types = $Satellite->get_tle_types();
710 1077
 				foreach ($types as $type) {
711 1078
 					$type_name = $type['tle_type'];
712
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
713
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
714
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
715
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
716
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
717
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
718
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
719
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
720
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
721
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
722
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
723
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
724
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
725
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
726
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
727
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
728
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
729
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
730
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1079
+					if ($type_name == 'musson') {
1080
+						$type_name = 'Russian LEO Navigation';
1081
+					} else if ($type_name == 'nnss') {
1082
+						$type_name = 'Navi Navigation Satellite System';
1083
+					} else if ($type_name == 'sbas') {
1084
+						$type_name = 'Satellite-Based Augmentation System';
1085
+					} else if ($type_name == 'glo-ops') {
1086
+						$type_name = 'Glonass Operational';
1087
+					} else if ($type_name == 'gps-ops') {
1088
+						$type_name = 'GPS Operational';
1089
+					} else if ($type_name == 'argos') {
1090
+						$type_name = 'ARGOS Data Collection System';
1091
+					} else if ($type_name == 'tdrss') {
1092
+						$type_name = 'Tracking and Data Relay Satellite System';
1093
+					} else if ($type_name == 'sarsat') {
1094
+						$type_name = 'Search & Rescue';
1095
+					} else if ($type_name == 'dmc') {
1096
+						$type_name = 'Disaster Monitoring';
1097
+					} else if ($type_name == 'resource') {
1098
+						$type_name = 'Earth Resources';
1099
+					} else if ($type_name == 'stations') {
1100
+						$type_name = 'Space Stations';
1101
+					} else if ($type_name == 'geo') {
1102
+						$type_name = 'Geostationary';
1103
+					} else if ($type_name == 'amateur') {
1104
+						$type_name = 'Amateur Radio';
1105
+					} else if ($type_name == 'x-comm') {
1106
+						$type_name = 'Experimental';
1107
+					} else if ($type_name == 'other-comm') {
1108
+						$type_name = 'Other Comm';
1109
+					} else if ($type_name == 'science') {
1110
+						$type_name = 'Space & Earth Science';
1111
+					} else if ($type_name == 'military') {
1112
+						$type_name = 'Miscellaneous Military';
1113
+					} else if ($type_name == 'radar') {
1114
+						$type_name = 'Radar Calibration';
1115
+					} else if ($type_name == 'tle-new') {
1116
+						$type_name = 'Last 30 days launches';
1117
+					}
731 1118
 					
732 1119
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
733 1120
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
install/class.update_schema.php 2 patches
Spacing   +239 added lines, -239 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 (update schema_version) : ".$e->getMessage()."\n";
2244 2244
 		}
2245 2245
 		return $error;
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
 		try {
2261 2261
 			$sth = $Connection->db->prepare($query);
2262 2262
 			$sth->execute();
2263
-		} catch(PDOException $e) {
2263
+		} catch (PDOException $e) {
2264 2264
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2265 2265
 		}
2266 2266
 		return $error;
@@ -2285,7 +2285,7 @@  discard block
 block discarded – undo
2285 2285
 		try {
2286 2286
 			$sth = $Connection->db->prepare($query);
2287 2287
 			$sth->execute();
2288
-		} catch(PDOException $e) {
2288
+		} catch (PDOException $e) {
2289 2289
 			return "error (update schema_version) : ".$e->getMessage()."\n";
2290 2290
 		}
2291 2291
 		return $error;
@@ -2308,7 +2308,7 @@  discard block
 block discarded – undo
2308 2308
 					try {
2309 2309
 						$sth = $Connection->db->prepare($query);
2310 2310
 						$sth->execute();
2311
-					} catch(PDOException $e) {
2311
+					} catch (PDOException $e) {
2312 2312
 						return "error (check_version): ".$e->getMessage()."\n";
2313 2313
 					}
2314 2314
 					$result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +507 added lines, -186 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -803,12 +855,16 @@  discard block
 block discarded – undo
803 855
 		if ($globalDBdriver == 'mysql') {
804 856
 			if (!$Connection->tableExists('tle')) {
805 857
 				$error .= create_db::import_file('../db/tle.sql');
806
-				if ($error != '') return $error;
858
+				if ($error != '') {
859
+					return $error;
860
+				}
807 861
 			}
808 862
 		} else {
809 863
 			if (!$Connection->tableExists('tle')) {
810 864
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
811
-				if ($error != '') return $error;
865
+				if ($error != '') {
866
+					return $error;
867
+				}
812 868
 			}
813 869
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
814 870
 			try {
@@ -848,7 +904,9 @@  discard block
 block discarded – undo
848 904
 		} else {
849 905
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
850 906
 		}
851
-		if ($error != '') return 'Import airlines.sql : '.$error;
907
+		if ($error != '') {
908
+			return 'Import airlines.sql : '.$error;
909
+		}
852 910
 		if (!$Connection->checkColumnName('airlines','forsource')) {
853 911
 			// Add forsource to airlines
854 912
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1331,20 +1389,28 @@  discard block
 block discarded – undo
1331 1389
 		}
1332 1390
 		if ($globalDBdriver == 'mysql') {
1333 1391
 			$error .= create_db::import_file('../db/airlines.sql');
1334
-			if ($error != '') return $error;
1392
+			if ($error != '') {
1393
+				return $error;
1394
+			}
1335 1395
 		} else {
1336 1396
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1337
-			if ($error != '') return $error;
1397
+			if ($error != '') {
1398
+				return $error;
1399
+			}
1338 1400
 		}
1339 1401
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1340 1402
 			include_once(dirname(__FILE__).'/class.update_db.php');
1341 1403
 			if (isset($globalVATSIM) && $globalVATSIM) {
1342 1404
 				$error .= update_db::update_vatsim();
1343
-				if ($error != '') return $error;
1405
+				if ($error != '') {
1406
+					return $error;
1407
+				}
1344 1408
 			}
1345 1409
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1346 1410
 				$error .= update_db::update_IVAO();
1347
-				if ($error != '') return $error;
1411
+				if ($error != '') {
1412
+					return $error;
1413
+				}
1348 1414
 			}
1349 1415
 		}
1350 1416
 
@@ -1607,41 +1673,65 @@  discard block
 block discarded – undo
1607 1673
 		if ($globalDBdriver == 'mysql') {
1608 1674
 			if (!$Connection->tableExists('tracker_output')) {
1609 1675
 				$error .= create_db::import_file('../db/tracker_output.sql');
1610
-				if ($error != '') return $error;
1676
+				if ($error != '') {
1677
+					return $error;
1678
+				}
1611 1679
 			}
1612 1680
 			if (!$Connection->tableExists('tracker_live')) {
1613 1681
 				$error .= create_db::import_file('../db/tracker_live.sql');
1614
-				if ($error != '') return $error;
1682
+				if ($error != '') {
1683
+					return $error;
1684
+				}
1615 1685
 			}
1616 1686
 			if (!$Connection->tableExists('marine_output')) {
1617 1687
 				$error .= create_db::import_file('../db/marine_output.sql');
1618
-				if ($error != '') return $error;
1688
+				if ($error != '') {
1689
+					return $error;
1690
+				}
1619 1691
 			}
1620 1692
 			if (!$Connection->tableExists('marine_live')) {
1621 1693
 				$error .= create_db::import_file('../db/marine_live.sql');
1622
-				if ($error != '') return $error;
1694
+				if ($error != '') {
1695
+					return $error;
1696
+				}
1623 1697
 			}
1624 1698
 			if (!$Connection->tableExists('marine_identity')) {
1625 1699
 				$error .= create_db::import_file('../db/marine_identity.sql');
1626
-				if ($error != '') return $error;
1700
+				if ($error != '') {
1701
+					return $error;
1702
+				}
1627 1703
 			}
1628 1704
 			if (!$Connection->tableExists('marine_mid')) {
1629 1705
 				$error .= create_db::import_file('../db/marine_mid.sql');
1630
-				if ($error != '') return $error;
1706
+				if ($error != '') {
1707
+					return $error;
1708
+				}
1631 1709
 			}
1632 1710
 		} else {
1633 1711
 			$error .= create_db::import_file('../db/pgsql/tracker_output.sql');
1634
-			if ($error != '') return $error;
1712
+			if ($error != '') {
1713
+				return $error;
1714
+			}
1635 1715
 			$error .= create_db::import_file('../db/pgsql/tracker_live.sql');
1636
-			if ($error != '') return $error;
1716
+			if ($error != '') {
1717
+				return $error;
1718
+			}
1637 1719
 			$error .= create_db::import_file('../db/pgsql/marine_output.sql');
1638
-			if ($error != '') return $error;
1720
+			if ($error != '') {
1721
+				return $error;
1722
+			}
1639 1723
 			$error .= create_db::import_file('../db/pgsql/marine_live.sql');
1640
-			if ($error != '') return $error;
1724
+			if ($error != '') {
1725
+				return $error;
1726
+			}
1641 1727
 			$error .= create_db::import_file('../db/pgsql/marine_identity.sql');
1642
-			if ($error != '') return $error;
1728
+			if ($error != '') {
1729
+				return $error;
1730
+			}
1643 1731
 			$error .= create_db::import_file('../db/pgsql/marine_mid.sql');
1644
-			if ($error != '') return $error;
1732
+			if ($error != '') {
1733
+				return $error;
1734
+			}
1645 1735
 		}
1646 1736
 		$query = "UPDATE config SET value = '37' WHERE name = 'schema_version'";
1647 1737
 		try {
@@ -1660,39 +1750,61 @@  discard block
 block discarded – undo
1660 1750
 		if ($globalDBdriver == 'mysql') {
1661 1751
 			if (!$Connection->tableExists('marine_image')) {
1662 1752
 				$error .= create_db::import_file('../db/marine_image.sql');
1663
-				if ($error != '') return $error;
1753
+				if ($error != '') {
1754
+					return $error;
1755
+				}
1664 1756
 			}
1665 1757
 			if (!$Connection->tableExists('marine_archive')) {
1666 1758
 				$error .= create_db::import_file('../db/marine_archive.sql');
1667
-				if ($error != '') return $error;
1759
+				if ($error != '') {
1760
+					return $error;
1761
+				}
1668 1762
 			}
1669 1763
 			if (!$Connection->tableExists('marine_archive_output')) {
1670 1764
 				$error .= create_db::import_file('../db/marine_archive_output.sql');
1671
-				if ($error != '') return $error;
1765
+				if ($error != '') {
1766
+					return $error;
1767
+				}
1672 1768
 			}
1673 1769
 			if (!$Connection->tableExists('tracker_archive')) {
1674 1770
 				$error .= create_db::import_file('../db/tracker_archive.sql');
1675
-				if ($error != '') return $error;
1771
+				if ($error != '') {
1772
+					return $error;
1773
+				}
1676 1774
 			}
1677 1775
 			if (!$Connection->tableExists('tracker_archive_output')) {
1678 1776
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1679
-				if ($error != '') return $error;
1777
+				if ($error != '') {
1778
+					return $error;
1779
+				}
1680 1780
 			}
1681 1781
 			if (!$Connection->tableExists('marine_archive_output')) {
1682 1782
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1683
-				if ($error != '') return $error;
1783
+				if ($error != '') {
1784
+					return $error;
1785
+				}
1684 1786
 			}
1685 1787
 		} else {
1686 1788
 			$error .= create_db::import_file('../db/pgsql/marine_image.sql');
1687
-			if ($error != '') return $error;
1789
+			if ($error != '') {
1790
+				return $error;
1791
+			}
1688 1792
 			$error .= create_db::import_file('../db/pgsql/marine_archive.sql');
1689
-			if ($error != '') return $error;
1793
+			if ($error != '') {
1794
+				return $error;
1795
+			}
1690 1796
 			$error .= create_db::import_file('../db/pgsql/marine_archive_output.sql');
1691
-			if ($error != '') return $error;
1797
+			if ($error != '') {
1798
+				return $error;
1799
+			}
1692 1800
 			$error .= create_db::import_file('../db/pgsql/tracker_archive.sql');
1693
-			if ($error != '') return $error;
1801
+			if ($error != '') {
1802
+				return $error;
1803
+			}
1694 1804
 			$error .= create_db::import_file('../db/pgsql/tracker_archive_output.sql');
1695
-			if ($error != '') return $error;
1805
+			if ($error != '') {
1806
+				return $error;
1807
+			}
1696 1808
 		}
1697 1809
 		if ($globalDBdriver == 'mysql') {
1698 1810
 			$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
@@ -2063,7 +2175,9 @@  discard block
 block discarded – undo
2063 2175
 		if ($globalDBdriver == 'mysql') {
2064 2176
 			if (!$Connection->tableExists('tracker_archive_output')) {
2065 2177
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
2066
-				if ($error != '') return $error;
2178
+				if ($error != '') {
2179
+					return $error;
2180
+				}
2067 2181
 			}
2068 2182
 			$query = "ALTER TABLE tracker_live MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;";
2069 2183
 		} else {
@@ -2091,14 +2205,22 @@  discard block
 block discarded – undo
2091 2205
 		$error = '';
2092 2206
 		if ($globalDBdriver == 'mysql') {
2093 2207
 			$error .= create_db::import_file('../db/airport.sql');
2094
-			if ($error != '') return $error;
2208
+			if ($error != '') {
2209
+				return $error;
2210
+			}
2095 2211
 			$error .= create_db::import_file('../db/airlines.sql');
2096
-			if ($error != '') return $error;
2212
+			if ($error != '') {
2213
+				return $error;
2214
+			}
2097 2215
 		} else {
2098 2216
 			$error .= create_db::import_file('../db/pgsql/airport.sql');
2099
-			if ($error != '') return $error;
2217
+			if ($error != '') {
2218
+				return $error;
2219
+			}
2100 2220
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
2101
-			if ($error != '') return $error;
2221
+			if ($error != '') {
2222
+				return $error;
2223
+			}
2102 2224
 		}
2103 2225
 		if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
2104 2226
 			if (file_exists('tmp/ivae_feb2013.zip')) {
@@ -2115,7 +2237,9 @@  discard block
 block discarded – undo
2115 2237
 				$error .= update_db::update_vatsim();
2116 2238
 			}
2117 2239
 		}
2118
-		if ($error != '') return $error;
2240
+		if ($error != '') {
2241
+			return $error;
2242
+		}
2119 2243
 		$query = "UPDATE config SET value = '45' WHERE name = 'schema_version'";
2120 2244
 		try {
2121 2245
 			$sth = $Connection->db->prepare($query);
@@ -2133,10 +2257,14 @@  discard block
 block discarded – undo
2133 2257
 		if (!$Connection->tableExists('satellite')) {
2134 2258
 			if ($globalDBdriver == 'mysql') {
2135 2259
 				$error .= create_db::import_file('../db/satellite.sql');
2136
-				if ($error != '') return $error;
2260
+				if ($error != '') {
2261
+					return $error;
2262
+				}
2137 2263
 			} else {
2138 2264
 				$error .= create_db::import_file('../db/pgsql/satellite.sql');
2139
-				if ($error != '') return $error;
2265
+				if ($error != '') {
2266
+					return $error;
2267
+				}
2140 2268
 			}
2141 2269
 		}
2142 2270
 		$query = "UPDATE config SET value = '46' WHERE name = 'schema_version'";
@@ -2156,37 +2284,53 @@  discard block
 block discarded – undo
2156 2284
 		if (!$Connection->tableExists('stats_marine')) {
2157 2285
 			if ($globalDBdriver == 'mysql') {
2158 2286
 				$error .= create_db::import_file('../db/stats_marine.sql');
2159
-				if ($error != '') return $error;
2287
+				if ($error != '') {
2288
+					return $error;
2289
+				}
2160 2290
 			} else {
2161 2291
 				$error .= create_db::import_file('../db/pgsql/stats_marine.sql');
2162
-				if ($error != '') return $error;
2292
+				if ($error != '') {
2293
+					return $error;
2294
+				}
2163 2295
 			}
2164 2296
 		}
2165 2297
 		if (!$Connection->tableExists('stats_marine_country')) {
2166 2298
 			if ($globalDBdriver == 'mysql') {
2167 2299
 				$error .= create_db::import_file('../db/stats_marine_country.sql');
2168
-				if ($error != '') return $error;
2300
+				if ($error != '') {
2301
+					return $error;
2302
+				}
2169 2303
 			} else {
2170 2304
 				$error .= create_db::import_file('../db/pgsql/stats_marine_country.sql');
2171
-				if ($error != '') return $error;
2305
+				if ($error != '') {
2306
+					return $error;
2307
+				}
2172 2308
 			}
2173 2309
 		}
2174 2310
 		if (!$Connection->tableExists('stats_tracker')) {
2175 2311
 			if ($globalDBdriver == 'mysql') {
2176 2312
 				$error .= create_db::import_file('../db/stats_tracker.sql');
2177
-				if ($error != '') return $error;
2313
+				if ($error != '') {
2314
+					return $error;
2315
+				}
2178 2316
 			} else {
2179 2317
 				$error .= create_db::import_file('../db/pgsql/stats_tracker.sql');
2180
-				if ($error != '') return $error;
2318
+				if ($error != '') {
2319
+					return $error;
2320
+				}
2181 2321
 			}
2182 2322
 		}
2183 2323
 		if (!$Connection->tableExists('stats_tracker_country')) {
2184 2324
 			if ($globalDBdriver == 'mysql') {
2185 2325
 				$error .= create_db::import_file('../db/stats_tracker_country.sql');
2186
-				if ($error != '') return $error;
2326
+				if ($error != '') {
2327
+					return $error;
2328
+				}
2187 2329
 			} else {
2188 2330
 				$error .= create_db::import_file('../db/pgsql/stats_tracker_country.sql');
2189
-				if ($error != '') return $error;
2331
+				if ($error != '') {
2332
+					return $error;
2333
+				}
2190 2334
 			}
2191 2335
 		}
2192 2336
 		$query = "UPDATE config SET value = '47' WHERE name = 'schema_version'";
@@ -2206,10 +2350,14 @@  discard block
 block discarded – undo
2206 2350
 		if (!$Connection->tableExists('stats_marine_type')) {
2207 2351
 			if ($globalDBdriver == 'mysql') {
2208 2352
 				$error .= create_db::import_file('../db/stats_marine_type.sql');
2209
-				if ($error != '') return $error;
2353
+				if ($error != '') {
2354
+					return $error;
2355
+				}
2210 2356
 			} else {
2211 2357
 				$error .= create_db::import_file('../db/pgsql/stats_marine_type.sql');
2212
-				if ($error != '') return $error;
2358
+				if ($error != '') {
2359
+					return $error;
2360
+				}
2213 2361
 			}
2214 2362
 		}
2215 2363
 		$query = "UPDATE config SET value = '48' WHERE name = 'schema_version'";
@@ -2229,10 +2377,14 @@  discard block
 block discarded – undo
2229 2377
 		if (!$Connection->tableExists('stats_tracker_type')) {
2230 2378
 			if ($globalDBdriver == 'mysql') {
2231 2379
 				$error .= create_db::import_file('../db/stats_tracker_type.sql');
2232
-				if ($error != '') return $error;
2380
+				if ($error != '') {
2381
+					return $error;
2382
+				}
2233 2383
 			} else {
2234 2384
 				$error .= create_db::import_file('../db/pgsql/stats_tracker_type.sql');
2235
-				if ($error != '') return $error;
2385
+				if ($error != '') {
2386
+					return $error;
2387
+				}
2236 2388
 			}
2237 2389
 		}
2238 2390
 		$query = "UPDATE config SET value = '49' WHERE name = 'schema_version'";
@@ -2251,10 +2403,14 @@  discard block
 block discarded – undo
2251 2403
 		$error = '';
2252 2404
 		if ($globalDBdriver == 'mysql') {
2253 2405
 			$error .= create_db::import_file('../db/airport.sql');
2254
-			if ($error != '') return $error;
2406
+			if ($error != '') {
2407
+				return $error;
2408
+			}
2255 2409
 		} else {
2256 2410
 			$error .= create_db::import_file('../db/pgsql/airport.sql');
2257
-			if ($error != '') return $error;
2411
+			if ($error != '') {
2412
+				return $error;
2413
+			}
2258 2414
 		}
2259 2415
 		$query = "UPDATE config SET value = '50' WHERE name = 'schema_version'";
2260 2416
 		try {
@@ -2272,14 +2428,22 @@  discard block
 block discarded – undo
2272 2428
 		$error = '';
2273 2429
 		if ($globalDBdriver == 'mysql') {
2274 2430
 			$error .= create_db::import_file('../db/aircraft.sql');
2275
-			if ($error != '') return $error;
2431
+			if ($error != '') {
2432
+				return $error;
2433
+			}
2276 2434
 			$error .= create_db::import_file('../db/aircraft_block.sql');
2277
-			if ($error != '') return $error;
2435
+			if ($error != '') {
2436
+				return $error;
2437
+			}
2278 2438
 		} else {
2279 2439
 			$error .= create_db::import_file('../db/pgsql/aircraft.sql');
2280
-			if ($error != '') return $error;
2440
+			if ($error != '') {
2441
+				return $error;
2442
+			}
2281 2443
 			$error .= create_db::import_file('../db/pgsql/aircraft_block.sql');
2282
-			if ($error != '') return $error;
2444
+			if ($error != '') {
2445
+				return $error;
2446
+			}
2283 2447
 		}
2284 2448
 		$query = "UPDATE config SET value = '51' WHERE name = 'schema_version'";
2285 2449
 		try {
@@ -2301,8 +2465,11 @@  discard block
 block discarded – undo
2301 2465
 			if ($Connection->tableExists('aircraft')) {
2302 2466
 				if (!$Connection->tableExists('config')) {
2303 2467
 					$version = '1';
2304
-					if ($update) return self::update_from_1();
2305
-					else return $version;
2468
+					if ($update) {
2469
+						return self::update_from_1();
2470
+					} else {
2471
+						return $version;
2472
+					}
2306 2473
 				} else {
2307 2474
 					$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
2308 2475
 					try {
@@ -2315,207 +2482,361 @@  discard block
 block discarded – undo
2315 2482
 					if ($update) {
2316 2483
 						if ($result['value'] == '2') {
2317 2484
 							$error = self::update_from_2();
2318
-							if ($error != '') return $error;
2319
-							else return self::check_version(true);
2485
+							if ($error != '') {
2486
+								return $error;
2487
+							} else {
2488
+								return self::check_version(true);
2489
+							}
2320 2490
 						} elseif ($result['value'] == '3') {
2321 2491
 							$error = self::update_from_3();
2322
-							if ($error != '') return $error;
2323
-							else return self::check_version(true);
2492
+							if ($error != '') {
2493
+								return $error;
2494
+							} else {
2495
+								return self::check_version(true);
2496
+							}
2324 2497
 						} elseif ($result['value'] == '4') {
2325 2498
 							$error = self::update_from_4();
2326
-							if ($error != '') return $error;
2327
-							else return self::check_version(true);
2499
+							if ($error != '') {
2500
+								return $error;
2501
+							} else {
2502
+								return self::check_version(true);
2503
+							}
2328 2504
 						} elseif ($result['value'] == '5') {
2329 2505
 							$error = self::update_from_5();
2330
-							if ($error != '') return $error;
2331
-							else return self::check_version(true);
2506
+							if ($error != '') {
2507
+								return $error;
2508
+							} else {
2509
+								return self::check_version(true);
2510
+							}
2332 2511
 						} elseif ($result['value'] == '6') {
2333 2512
 							$error = self::update_from_6();
2334
-							if ($error != '') return $error;
2335
-							else return self::check_version(true);
2513
+							if ($error != '') {
2514
+								return $error;
2515
+							} else {
2516
+								return self::check_version(true);
2517
+							}
2336 2518
 						} elseif ($result['value'] == '7') {
2337 2519
 							$error = self::update_from_7();
2338
-							if ($error != '') return $error;
2339
-							else return self::check_version(true);
2520
+							if ($error != '') {
2521
+								return $error;
2522
+							} else {
2523
+								return self::check_version(true);
2524
+							}
2340 2525
 						} elseif ($result['value'] == '8') {
2341 2526
 							$error = self::update_from_8();
2342
-							if ($error != '') return $error;
2343
-							else return self::check_version(true);
2527
+							if ($error != '') {
2528
+								return $error;
2529
+							} else {
2530
+								return self::check_version(true);
2531
+							}
2344 2532
 						} elseif ($result['value'] == '9') {
2345 2533
 							$error = self::update_from_9();
2346
-							if ($error != '') return $error;
2347
-							else return self::check_version(true);
2534
+							if ($error != '') {
2535
+								return $error;
2536
+							} else {
2537
+								return self::check_version(true);
2538
+							}
2348 2539
 						} elseif ($result['value'] == '10') {
2349 2540
 							$error = self::update_from_10();
2350
-							if ($error != '') return $error;
2351
-							else return self::check_version(true);
2541
+							if ($error != '') {
2542
+								return $error;
2543
+							} else {
2544
+								return self::check_version(true);
2545
+							}
2352 2546
 						} elseif ($result['value'] == '11') {
2353 2547
 							$error = self::update_from_11();
2354
-							if ($error != '') return $error;
2355
-							else return self::check_version(true);
2548
+							if ($error != '') {
2549
+								return $error;
2550
+							} else {
2551
+								return self::check_version(true);
2552
+							}
2356 2553
 						} elseif ($result['value'] == '12') {
2357 2554
 							$error = self::update_from_12();
2358
-							if ($error != '') return $error;
2359
-							else return self::check_version(true);
2555
+							if ($error != '') {
2556
+								return $error;
2557
+							} else {
2558
+								return self::check_version(true);
2559
+							}
2360 2560
 						} elseif ($result['value'] == '13') {
2361 2561
 							$error = self::update_from_13();
2362
-							if ($error != '') return $error;
2363
-							else return self::check_version(true);
2562
+							if ($error != '') {
2563
+								return $error;
2564
+							} else {
2565
+								return self::check_version(true);
2566
+							}
2364 2567
 						} elseif ($result['value'] == '14') {
2365 2568
 							$error = self::update_from_14();
2366
-							if ($error != '') return $error;
2367
-							else return self::check_version(true);
2569
+							if ($error != '') {
2570
+								return $error;
2571
+							} else {
2572
+								return self::check_version(true);
2573
+							}
2368 2574
 						} elseif ($result['value'] == '15') {
2369 2575
 							$error = self::update_from_15();
2370
-							if ($error != '') return $error;
2371
-							else return self::check_version(true);
2576
+							if ($error != '') {
2577
+								return $error;
2578
+							} else {
2579
+								return self::check_version(true);
2580
+							}
2372 2581
 						} elseif ($result['value'] == '16') {
2373 2582
 							$error = self::update_from_16();
2374
-							if ($error != '') return $error;
2375
-							else return self::check_version(true);
2583
+							if ($error != '') {
2584
+								return $error;
2585
+							} else {
2586
+								return self::check_version(true);
2587
+							}
2376 2588
 						} elseif ($result['value'] == '17') {
2377 2589
 							$error = self::update_from_17();
2378
-							if ($error != '') return $error;
2379
-							else return self::check_version(true);
2590
+							if ($error != '') {
2591
+								return $error;
2592
+							} else {
2593
+								return self::check_version(true);
2594
+							}
2380 2595
 						} elseif ($result['value'] == '18') {
2381 2596
 							$error = self::update_from_18();
2382
-							if ($error != '') return $error;
2383
-							else return self::check_version(true);
2597
+							if ($error != '') {
2598
+								return $error;
2599
+							} else {
2600
+								return self::check_version(true);
2601
+							}
2384 2602
 						} elseif ($result['value'] == '19') {
2385 2603
 							$error = self::update_from_19();
2386
-							if ($error != '') return $error;
2387
-							else return self::check_version(true);
2604
+							if ($error != '') {
2605
+								return $error;
2606
+							} else {
2607
+								return self::check_version(true);
2608
+							}
2388 2609
 						} elseif ($result['value'] == '20') {
2389 2610
 							$error = self::update_from_20();
2390
-							if ($error != '') return $error;
2391
-							else return self::check_version(true);
2611
+							if ($error != '') {
2612
+								return $error;
2613
+							} else {
2614
+								return self::check_version(true);
2615
+							}
2392 2616
 						} elseif ($result['value'] == '21') {
2393 2617
 							$error = self::update_from_21();
2394
-							if ($error != '') return $error;
2395
-							else return self::check_version(true);
2618
+							if ($error != '') {
2619
+								return $error;
2620
+							} else {
2621
+								return self::check_version(true);
2622
+							}
2396 2623
 						} elseif ($result['value'] == '22') {
2397 2624
 							$error = self::update_from_22();
2398
-							if ($error != '') return $error;
2399
-							else return self::check_version(true);
2625
+							if ($error != '') {
2626
+								return $error;
2627
+							} else {
2628
+								return self::check_version(true);
2629
+							}
2400 2630
 						} elseif ($result['value'] == '23') {
2401 2631
 							$error = self::update_from_23();
2402
-							if ($error != '') return $error;
2403
-							else return self::check_version(true);
2632
+							if ($error != '') {
2633
+								return $error;
2634
+							} else {
2635
+								return self::check_version(true);
2636
+							}
2404 2637
 						} elseif ($result['value'] == '24') {
2405 2638
 							$error = self::update_from_24();
2406
-							if ($error != '') return $error;
2407
-							else return self::check_version(true);
2639
+							if ($error != '') {
2640
+								return $error;
2641
+							} else {
2642
+								return self::check_version(true);
2643
+							}
2408 2644
 						} elseif ($result['value'] == '25') {
2409 2645
 							$error = self::update_from_25();
2410
-							if ($error != '') return $error;
2411
-							else return self::check_version(true);
2646
+							if ($error != '') {
2647
+								return $error;
2648
+							} else {
2649
+								return self::check_version(true);
2650
+							}
2412 2651
 						} elseif ($result['value'] == '26') {
2413 2652
 							$error = self::update_from_26();
2414
-							if ($error != '') return $error;
2415
-							else return self::check_version(true);
2653
+							if ($error != '') {
2654
+								return $error;
2655
+							} else {
2656
+								return self::check_version(true);
2657
+							}
2416 2658
 						} elseif ($result['value'] == '27') {
2417 2659
 							$error = self::update_from_27();
2418
-							if ($error != '') return $error;
2419
-							else return self::check_version(true);
2660
+							if ($error != '') {
2661
+								return $error;
2662
+							} else {
2663
+								return self::check_version(true);
2664
+							}
2420 2665
 						} elseif ($result['value'] == '28') {
2421 2666
 							$error = self::update_from_28();
2422
-							if ($error != '') return $error;
2423
-							else return self::check_version(true);
2667
+							if ($error != '') {
2668
+								return $error;
2669
+							} else {
2670
+								return self::check_version(true);
2671
+							}
2424 2672
 						} elseif ($result['value'] == '29') {
2425 2673
 							$error = self::update_from_29();
2426
-							if ($error != '') return $error;
2427
-							else return self::check_version(true);
2674
+							if ($error != '') {
2675
+								return $error;
2676
+							} else {
2677
+								return self::check_version(true);
2678
+							}
2428 2679
 						} elseif ($result['value'] == '30') {
2429 2680
 							$error = self::update_from_30();
2430
-							if ($error != '') return $error;
2431
-							else return self::check_version(true);
2681
+							if ($error != '') {
2682
+								return $error;
2683
+							} else {
2684
+								return self::check_version(true);
2685
+							}
2432 2686
 						} elseif ($result['value'] == '31') {
2433 2687
 							$error = self::update_from_31();
2434
-							if ($error != '') return $error;
2435
-							else return self::check_version(true);
2688
+							if ($error != '') {
2689
+								return $error;
2690
+							} else {
2691
+								return self::check_version(true);
2692
+							}
2436 2693
 						} elseif ($result['value'] == '32') {
2437 2694
 							$error = self::update_from_32();
2438
-							if ($error != '') return $error;
2439
-							else return self::check_version(true);
2695
+							if ($error != '') {
2696
+								return $error;
2697
+							} else {
2698
+								return self::check_version(true);
2699
+							}
2440 2700
 						} elseif ($result['value'] == '33') {
2441 2701
 							$error = self::update_from_33();
2442
-							if ($error != '') return $error;
2443
-							else return self::check_version(true);
2702
+							if ($error != '') {
2703
+								return $error;
2704
+							} else {
2705
+								return self::check_version(true);
2706
+							}
2444 2707
 						} elseif ($result['value'] == '34') {
2445 2708
 							$error = self::update_from_34();
2446
-							if ($error != '') return $error;
2447
-							else return self::check_version(true);
2709
+							if ($error != '') {
2710
+								return $error;
2711
+							} else {
2712
+								return self::check_version(true);
2713
+							}
2448 2714
 						} elseif ($result['value'] == '35') {
2449 2715
 							$error = self::update_from_35();
2450
-							if ($error != '') return $error;
2451
-							else return self::check_version(true);
2716
+							if ($error != '') {
2717
+								return $error;
2718
+							} else {
2719
+								return self::check_version(true);
2720
+							}
2452 2721
 						} elseif ($result['value'] == '36') {
2453 2722
 							$error = self::update_from_36();
2454
-							if ($error != '') return $error;
2455
-							else return self::check_version(true);
2723
+							if ($error != '') {
2724
+								return $error;
2725
+							} else {
2726
+								return self::check_version(true);
2727
+							}
2456 2728
 						} elseif ($result['value'] == '37') {
2457 2729
 							$error = self::update_from_37();
2458
-							if ($error != '') return $error;
2459
-							else return self::check_version(true);
2730
+							if ($error != '') {
2731
+								return $error;
2732
+							} else {
2733
+								return self::check_version(true);
2734
+							}
2460 2735
 						} elseif ($result['value'] == '38') {
2461 2736
 							$error = self::update_from_38();
2462
-							if ($error != '') return $error;
2463
-							else return self::check_version(true);
2737
+							if ($error != '') {
2738
+								return $error;
2739
+							} else {
2740
+								return self::check_version(true);
2741
+							}
2464 2742
 						} elseif ($result['value'] == '39') {
2465 2743
 							$error = self::update_from_39();
2466
-							if ($error != '') return $error;
2467
-							else return self::check_version(true);
2744
+							if ($error != '') {
2745
+								return $error;
2746
+							} else {
2747
+								return self::check_version(true);
2748
+							}
2468 2749
 						} elseif ($result['value'] == '40') {
2469 2750
 							$error = self::update_from_40();
2470
-							if ($error != '') return $error;
2471
-							else return self::check_version(true);
2751
+							if ($error != '') {
2752
+								return $error;
2753
+							} else {
2754
+								return self::check_version(true);
2755
+							}
2472 2756
 						} elseif ($result['value'] == '41') {
2473 2757
 							$error = self::update_from_41();
2474
-							if ($error != '') return $error;
2475
-							else return self::check_version(true);
2758
+							if ($error != '') {
2759
+								return $error;
2760
+							} else {
2761
+								return self::check_version(true);
2762
+							}
2476 2763
 						} elseif ($result['value'] == '42') {
2477 2764
 							$error = self::update_from_42();
2478
-							if ($error != '') return $error;
2479
-							else return self::check_version(true);
2765
+							if ($error != '') {
2766
+								return $error;
2767
+							} else {
2768
+								return self::check_version(true);
2769
+							}
2480 2770
 						} elseif ($result['value'] == '43') {
2481 2771
 							$error = self::update_from_43();
2482
-							if ($error != '') return $error;
2483
-							else return self::check_version(true);
2772
+							if ($error != '') {
2773
+								return $error;
2774
+							} else {
2775
+								return self::check_version(true);
2776
+							}
2484 2777
 						} elseif ($result['value'] == '44') {
2485 2778
 							$error = self::update_from_44();
2486
-							if ($error != '') return $error;
2487
-							else return self::check_version(true);
2779
+							if ($error != '') {
2780
+								return $error;
2781
+							} else {
2782
+								return self::check_version(true);
2783
+							}
2488 2784
 						} elseif ($result['value'] == '45') {
2489 2785
 							$error = self::update_from_45();
2490
-							if ($error != '') return $error;
2491
-							else return self::check_version(true);
2786
+							if ($error != '') {
2787
+								return $error;
2788
+							} else {
2789
+								return self::check_version(true);
2790
+							}
2492 2791
 						} elseif ($result['value'] == '46') {
2493 2792
 							$error = self::update_from_46();
2494
-							if ($error != '') return $error;
2495
-							else return self::check_version(true);
2793
+							if ($error != '') {
2794
+								return $error;
2795
+							} else {
2796
+								return self::check_version(true);
2797
+							}
2496 2798
 						} elseif ($result['value'] == '47') {
2497 2799
 							$error = self::update_from_47();
2498
-							if ($error != '') return $error;
2499
-							else return self::check_version(true);
2800
+							if ($error != '') {
2801
+								return $error;
2802
+							} else {
2803
+								return self::check_version(true);
2804
+							}
2500 2805
 						} elseif ($result['value'] == '48') {
2501 2806
 							$error = self::update_from_48();
2502
-							if ($error != '') return $error;
2503
-							else return self::check_version(true);
2807
+							if ($error != '') {
2808
+								return $error;
2809
+							} else {
2810
+								return self::check_version(true);
2811
+							}
2504 2812
 						} elseif ($result['value'] == '49') {
2505 2813
 							$error = self::update_from_49();
2506
-							if ($error != '') return $error;
2507
-							else return self::check_version(true);
2814
+							if ($error != '') {
2815
+								return $error;
2816
+							} else {
2817
+								return self::check_version(true);
2818
+							}
2508 2819
 						} elseif ($result['value'] == '50') {
2509 2820
 							$error = self::update_from_50();
2510
-							if ($error != '') return $error;
2511
-							else return self::check_version(true);
2512
-						} else return '';
2821
+							if ($error != '') {
2822
+								return $error;
2823
+							} else {
2824
+								return self::check_version(true);
2825
+							}
2826
+						} else {
2827
+							return '';
2828
+						}
2513 2829
 					} else {
2514
-						if (isset($result['value']) && $result['value'] != '') return $result['value'];
2515
-						else return 0;
2830
+						if (isset($result['value']) && $result['value'] != '') {
2831
+							return $result['value'];
2832
+						} else {
2833
+							return 0;
2834
+						}
2516 2835
 					}
2517 2836
 				}
2518
-			} else return $version;
2837
+			} else {
2838
+				return $version;
2839
+			}
2519 2840
 		}
2520 2841
 	}
2521 2842
 }
Please login to merge, or discard this patch.
install/index.php 2 patches
Spacing   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 require_once(dirname(__FILE__).'/class.create_db.php');
23 23
 require_once(dirname(__FILE__).'/class.update_schema.php');
24 24
 require_once(dirname(__FILE__).'/class.settings.php');
25
-$title="Install";
25
+$title = "Install";
26 26
 require(dirname(__FILE__).'/../require/settings.php');
27 27
 require_once(dirname(__FILE__).'/../require/class.Common.php');
28 28
 require(dirname(__FILE__).'/header.php');
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	if (!extension_loaded('curl')) {
94 94
 		$error[] = "Curl is not loaded.";
95 95
 	}
96
-	if(function_exists('apache_get_modules') ){
97
-		if(!in_array('mod_rewrite',apache_get_modules())) {
96
+	if (function_exists('apache_get_modules')) {
97
+		if (!in_array('mod_rewrite', apache_get_modules())) {
98 98
 			$error[] = "mod_rewrite is not available.";
99 99
 		}
100 100
 	/*
@@ -113,22 +113,22 @@  discard block
 block discarded – undo
113 113
 		$alllng = $Language->listLocaleDir();
114 114
 		if (count($alllng) != count($availablelng)) {
115 115
 			$notavailable = array();
116
-			foreach($alllng as $lng) {
116
+			foreach ($alllng as $lng) {
117 117
 				if (!isset($availablelng[$lng])) $notavailable[] = $lng;
118 118
 			}
119
-			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
119
+			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
120 120
 		}
121 121
 	}
122 122
 	print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>';
123 123
 	if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
124 124
 		if (function_exists('get_headers')) {
125 125
 			//$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
126
-			$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
127
-			if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
126
+			$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"])));
127
+			if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
128 128
 				print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>';
129 129
 			} else {
130
-				$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
131
-				if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
130
+				$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"])));
131
+				if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
132 132
 					print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>';
133 133
 				}
134 134
 			}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 				    if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
209 209
 					if (isset($_SERVER['REQUEST_URI'])) {
210 210
 						$URL = $_SERVER['REQUEST_URI'];
211
-						$globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL)));
211
+						$globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL)));
212 212
 					}
213 213
 				    }
214 214
 				?>
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
 ?>
532 532
 							<tr>
533 533
 								<?php
534
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
534
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
535 535
 								?>
536 536
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
537 537
 								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
538 538
 								<?php
539 539
 								    } else {
540
-									$hostport = explode(':',$source['host']);
540
+									$hostport = explode(':', $source['host']);
541 541
 									if (isset($hostport[1])) {
542 542
 										$host = $hostport[0];
543 543
 										$port = $hostport[1];
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 									<select name="timezones[]" id="timezones">
588 588
 								<?php
589 589
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
590
-									foreach($timezonelist as $timezones){
590
+									foreach ($timezonelist as $timezones) {
591 591
 										if (isset($source['timezone']) && $source['timezone'] == $timezones) {
592 592
 											print '<option selected>'.$timezones.'</option>';
593 593
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 									<select name="timezones[]" id="timezones">
643 643
 								<?php
644 644
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
645
-									foreach($timezonelist as $timezones){
645
+									foreach ($timezonelist as $timezones) {
646 646
 										if ($timezones == 'UTC') {
647 647
 											print '<option selected>'.$timezones.'</option>';
648 648
 										} else print '<option>'.$timezones.'</option>';
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 			<br />
1106 1106
 			<p>
1107 1107
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1108
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1108
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
1109 1109
 			</p>
1110 1110
 			<br />
1111 1111
 			<p>
@@ -1167,14 +1167,14 @@  discard block
 block discarded – undo
1167 1167
 $error = '';
1168 1168
 
1169 1169
 if (isset($_POST['dbtype'])) {
1170
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
1171
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
1172
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
1173
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
1174
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
1175
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
1176
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1177
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1170
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
1171
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
1172
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
1173
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
1174
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
1175
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
1176
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
1177
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
1178 1178
 
1179 1179
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1180 1180
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -1194,49 +1194,49 @@  discard block
 block discarded – undo
1194 1194
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1195 1195
 	*/
1196 1196
 	
1197
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1197
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
1198 1198
 
1199
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
1200
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
1201
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
1202
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
1203
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
1199
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
1200
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
1201
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
1202
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
1203
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
1204 1204
 
1205
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
1206
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
1207
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
1208
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
1209
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
1210
-	$openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING);
1211
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
1212
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
1213
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
1214
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey));
1205
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
1206
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
1207
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
1208
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
1209
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
1210
+	$openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING);
1211
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
1212
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
1213
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
1214
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey));
1215 1215
 	
1216
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
1217
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
1218
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
1219
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
1220
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
1221
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
1216
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
1217
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
1218
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
1219
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
1220
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
1221
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
1222 1222
 
1223
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
1224
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
1223
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
1224
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
1225 1225
 
1226
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
1227
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
1228
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
1226
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
1227
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
1228
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
1229 1229
 
1230
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
1230
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
1231 1231
 	if ($acars == 'acars') {
1232
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
1232
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
1233 1233
 	} else {
1234
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
1234
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
1235 1235
 	}
1236 1236
 
1237
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
1238
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
1239
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
1237
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
1238
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
1239
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
1240 1240
 	
1241 1241
 	$source_name = $_POST['source_name'];
1242 1242
 	$source_latitude = $_POST['source_latitude'];
@@ -1250,8 +1250,8 @@  discard block
 block discarded – undo
1250 1250
 	
1251 1251
 	$sources = array();
1252 1252
 	foreach ($source_name as $keys => $name) {
1253
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1254
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1253
+	    if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]);
1254
+	    else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]);
1255 1255
 	}
1256 1256
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1257 1257
 
@@ -1260,16 +1260,16 @@  discard block
 block discarded – undo
1260 1260
 	$newstype = $_POST['newstype'];
1261 1261
 	
1262 1262
 	$newsfeeds = array();
1263
-	foreach($newsurl as $newskey => $url) {
1263
+	foreach ($newsurl as $newskey => $url) {
1264 1264
 	    if ($url != '') {
1265 1265
 		$type = $newstype[$newskey];
1266 1266
 		$lng = $newslng[$newskey];
1267 1267
 		if (isset($newsfeeds[$type][$lng])) {
1268
-		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1268
+		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url));
1269 1269
 		} else $newsfeeds[$type][$lng] = array($url);
1270 1270
 	    }
1271 1271
 	}
1272
-	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
1272
+	$settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds));
1273 1273
 
1274 1274
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1275 1275
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -1280,27 +1280,27 @@  discard block
 block discarded – undo
1280 1280
 	$sbsurl = $_POST['sbsurl'];
1281 1281
 	*/
1282 1282
 
1283
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
1284
-	$globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING);
1285
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
1286
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
1287
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
1288
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
1289
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
1290
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1283
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
1284
+	$globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING);
1285
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
1286
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
1287
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
1288
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
1289
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
1290
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
1291 1291
 
1292
-	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1293
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1294
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1295
-	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1296
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1297
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1298
-	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1299
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1300
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1301
-	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1302
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1303
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1292
+	$globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING);
1293
+	if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE'));
1294
+	else $settings = array_merge($settings, array('globalAircraft' => 'FALSE'));
1295
+	$globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING);
1296
+	if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE'));
1297
+	else $settings = array_merge($settings, array('globalTracker' => 'FALSE'));
1298
+	$globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING);
1299
+	if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE'));
1300
+	else $settings = array_merge($settings, array('globalMarine' => 'FALSE'));
1301
+	$globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING);
1302
+	if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE'));
1303
+	else $settings = array_merge($settings, array('globalSatellite' => 'FALSE'));
1304 1304
 
1305 1305
 /*	
1306 1306
 	$globalSBS1Hosts = array();
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 	}
1317 1317
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
1318 1318
 */
1319
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
1319
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
1320 1320
 	$host = $_POST['host'];
1321 1321
 	$port = $_POST['port'];
1322 1322
 	$name = $_POST['name'];
@@ -1333,115 +1333,115 @@  discard block
 block discarded – undo
1333 1333
 		else $cov = 'FALSE';
1334 1334
 		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1335 1335
 		else $arch = 'FALSE';
1336
-		if (strpos($format[$key],'_callback')) {
1337
-			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1336
+		if (strpos($format[$key], '_callback')) {
1337
+			$gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE');
1338 1338
 		} elseif ($h != '' || $name[$key] != '') {
1339
-			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1339
+			$gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE');
1340 1340
 		}
1341 1341
 		if ($format[$key] == 'airwhere') $forcepilots = true;
1342 1342
 	}
1343
-	$settings = array_merge($settings,array('globalSources' => $gSources));
1343
+	$settings = array_merge($settings, array('globalSources' => $gSources));
1344 1344
 
1345 1345
 /*
1346 1346
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
1347 1347
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
1348 1348
 */
1349
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
1350
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
1351
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
1349
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
1350
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
1351
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
1352 1352
 
1353
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
1354
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
1353
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
1354
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
1355 1355
 
1356
-	$customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING);
1357
-	$settings = array_merge($settings,array('globalCustomCSS' => $customcss));
1356
+	$customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING);
1357
+	$settings = array_merge($settings, array('globalCustomCSS' => $customcss));
1358 1358
 
1359
-	$map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING);
1360
-	$settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile));
1359
+	$map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING);
1360
+	$settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile));
1361 1361
 
1362
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
1363
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
1364
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
1365
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
1362
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
1363
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
1364
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
1365
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
1366 1366
 
1367
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
1368
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
1369
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1367
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
1368
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
1369
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
1370 1370
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1371
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1372
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1371
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
1372
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
1373 1373
 
1374
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1375
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
1376
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
1377
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
1378
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1379
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1380
-	$minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT);
1381
-	$settings = array_merge($settings,array('globalMinFetch' => $minfetch));
1382
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1383
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
1374
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
1375
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
1376
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
1377
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
1378
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
1379
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
1380
+	$minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT);
1381
+	$settings = array_merge($settings, array('globalMinFetch' => $minfetch));
1382
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
1383
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
1384 1384
 
1385
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1386
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1385
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
1386
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
1387 1387
 
1388
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1389
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1388
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
1389
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
1390 1390
 	
1391
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1391
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
1392 1392
 	if ($archiveyear == "archiveyear") {
1393
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1393
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
1394 1394
 	} else {
1395
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1395
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
1396 1396
 	}
1397
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1398
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1399
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1400
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1397
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
1398
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
1399
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
1400
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1401 1401
 
1402
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1403
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1404
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1405
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1402
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
1403
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
1404
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
1405
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
1406 1406
 
1407
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1408
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1409
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1407
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
1408
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
1409
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
1410 1410
 
1411 1411
 	// Create in settings.php keys not yet configurable if not already here
1412 1412
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1413
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1413
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
1414 1414
 
1415
-	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1415
+	$resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING);
1416 1416
 	if ($resetyearstats == 'resetyearstats') {
1417
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1417
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE'));
1418 1418
 	} else {
1419
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1419
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE'));
1420 1420
 	}
1421 1421
 
1422
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1422
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
1423 1423
 	if ($archive == 'archive') {
1424
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1424
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
1425 1425
 	} else {
1426
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1426
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
1427 1427
 	}
1428
-	$archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING);
1428
+	$archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING);
1429 1429
 	if ($archiveresults == 'archiveresults') {
1430
-		$settings = array_merge($settings,array('globalArchiveResults' => 'TRUE'));
1430
+		$settings = array_merge($settings, array('globalArchiveResults' => 'TRUE'));
1431 1431
 	} else {
1432
-		$settings = array_merge($settings,array('globalArchiveResults' => 'FALSE'));
1432
+		$settings = array_merge($settings, array('globalArchiveResults' => 'FALSE'));
1433 1433
 	}
1434
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1434
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1435 1435
 	if ($daemon == 'daemon') {
1436
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1436
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1437 1437
 	} else {
1438
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1438
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1439 1439
 	}
1440
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1440
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1441 1441
 	if ($schedules == 'schedules') {
1442
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1442
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1443 1443
 	} else {
1444
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1444
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1445 1445
 	}
1446 1446
 
1447 1447
 /*
@@ -1452,286 +1452,286 @@  discard block
 block discarded – undo
1452 1452
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1453 1453
 	}
1454 1454
 */
1455
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1456
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1457
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1458
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1459
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1455
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1456
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1457
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1458
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1459
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1460 1460
 	$va = false;
1461 1461
 	if ($globalivao == 'ivao') {
1462
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1462
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1463 1463
 		$va = true;
1464
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1464
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1465 1465
 	if ($globalvatsim == 'vatsim') {
1466
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1466
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1467 1467
 		$va = true;
1468
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1468
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1469 1469
 	if ($globalphpvms == 'phpvms') {
1470
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1470
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1471 1471
 		$va = true;
1472
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1472
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1473 1473
 	if ($globalvam == 'vam') {
1474
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1474
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1475 1475
 		$va = true;
1476
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1476
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1477 1477
 	if ($va) {
1478
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1479
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1478
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1479
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1480 1480
 	if ($globalva == 'va' || $va) {
1481
-		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1482
-		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1481
+		$settings = array_merge($settings, array('globalVA' => 'TRUE'));
1482
+		$settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1483 1483
 	} else {
1484
-		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1485
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1486
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1484
+		$settings = array_merge($settings, array('globalVA' => 'FALSE'));
1485
+		if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1486
+		else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE'));
1487 1487
 	}
1488 1488
 	
1489 1489
 	
1490
-	$mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING);
1490
+	$mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING);
1491 1491
 	if ($mapoffline == 'mapoffline') {
1492
-		$settings = array_merge($settings,array('globalMapOffline' => 'TRUE'));
1492
+		$settings = array_merge($settings, array('globalMapOffline' => 'TRUE'));
1493 1493
 	} else {
1494
-		$settings = array_merge($settings,array('globalMapOffline' => 'FALSE'));
1494
+		$settings = array_merge($settings, array('globalMapOffline' => 'FALSE'));
1495 1495
 	}
1496
-	$globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING);
1496
+	$globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING);
1497 1497
 	if ($globaloffline == 'globaloffline') {
1498
-		$settings = array_merge($settings,array('globalOffline' => 'TRUE'));
1498
+		$settings = array_merge($settings, array('globalOffline' => 'TRUE'));
1499 1499
 	} else {
1500
-		$settings = array_merge($settings,array('globalOffline' => 'FALSE'));
1500
+		$settings = array_merge($settings, array('globalOffline' => 'FALSE'));
1501 1501
 	}
1502 1502
 
1503
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1503
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1504 1504
 	if ($notam == 'notam') {
1505
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1505
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1506 1506
 	} else {
1507
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1507
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1508 1508
 	}
1509
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1509
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1510 1510
 	if ($owner == 'owner') {
1511
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1511
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1512 1512
 	} else {
1513
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1513
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1514 1514
 	}
1515
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1515
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1516 1516
 	if ($map3d == 'map3d') {
1517
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1517
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1518 1518
 	} else {
1519
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1519
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1520 1520
 	}
1521
-	$crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1521
+	$crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING);
1522 1522
 	if ($crash == 'crash') {
1523
-		$settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1523
+		$settings = array_merge($settings, array('globalAccidents' => 'TRUE'));
1524 1524
 	} else {
1525
-		$settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1525
+		$settings = array_merge($settings, array('globalAccidents' => 'FALSE'));
1526 1526
 	}
1527
-	$fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING);
1527
+	$fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING);
1528 1528
 	if ($fires == 'fires') {
1529
-		$settings = array_merge($settings,array('globalMapFires' => 'TRUE'));
1529
+		$settings = array_merge($settings, array('globalMapFires' => 'TRUE'));
1530 1530
 	} else {
1531
-		$settings = array_merge($settings,array('globalMapFires' => 'FALSE'));
1531
+		$settings = array_merge($settings, array('globalMapFires' => 'FALSE'));
1532 1532
 	}
1533
-	$firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING);
1533
+	$firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING);
1534 1534
 	if ($firessupport == 'firessupport') {
1535
-		$settings = array_merge($settings,array('globalFires' => 'TRUE'));
1535
+		$settings = array_merge($settings, array('globalFires' => 'TRUE'));
1536 1536
 	} else {
1537
-		$settings = array_merge($settings,array('globalFires' => 'FALSE'));
1537
+		$settings = array_merge($settings, array('globalFires' => 'FALSE'));
1538 1538
 	}
1539
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1539
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1540 1540
 	if ($mapsatellites == 'mapsatellites') {
1541
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1541
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1542 1542
 	} else {
1543
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1543
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1544 1544
 	}
1545
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1545
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1546 1546
 	if ($map3ddefault == 'map3ddefault') {
1547
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1547
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1548 1548
 	} else {
1549
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1549
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1550 1550
 	}
1551
-	$one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING);
1551
+	$one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING);
1552 1552
 	if ($one3dmodel == 'one3dmodel') {
1553
-		$settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE'));
1553
+		$settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE'));
1554 1554
 	} else {
1555
-		$settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE'));
1555
+		$settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE'));
1556 1556
 	}
1557
-	$map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING);
1557
+	$map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING);
1558 1558
 	if ($map3dliveries == 'map3dliveries') {
1559
-		$settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE'));
1559
+		$settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE'));
1560 1560
 	} else {
1561
-		$settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE'));
1561
+		$settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE'));
1562 1562
 	}
1563
-	$map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING);
1563
+	$map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING);
1564 1564
 	if ($map3dshadows == 'map3dshadows') {
1565
-		$settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE'));
1565
+		$settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE'));
1566 1566
 	} else {
1567
-		$settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE'));
1567
+		$settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE'));
1568 1568
 	}
1569
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1569
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1570 1570
 	if ($translate == 'translate') {
1571
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1571
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1572 1572
 	} else {
1573
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1573
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1574 1574
 	}
1575
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1575
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1576 1576
 	if ($realairlines == 'realairlines') {
1577
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1577
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1578 1578
 	} else {
1579
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1579
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1580 1580
 	}
1581
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1581
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1582 1582
 	if ($estimation == 'estimation') {
1583
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1583
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1584 1584
 	} else {
1585
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1585
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1586 1586
 	}
1587
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1587
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1588 1588
 	if ($metar == 'metar') {
1589
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1589
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1590 1590
 	} else {
1591
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1591
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1592 1592
 	}
1593
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1593
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1594 1594
 	if ($metarcycle == 'metarcycle') {
1595
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1595
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1596 1596
 	} else {
1597
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1597
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1598 1598
 	}
1599
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1599
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1600 1600
 	if ($fork == 'fork') {
1601
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1601
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1602 1602
 	} else {
1603
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1603
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1604 1604
 	}
1605 1605
 
1606
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1606
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1607 1607
 	if ($colormap == 'colormap') {
1608
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1608
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1609 1609
 	} else {
1610
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1610
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1611 1611
 	}
1612 1612
 	
1613 1613
 	if (isset($_POST['aircrafticoncolor'])) {
1614
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1615
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1614
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1615
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1616 1616
 	}
1617 1617
 
1618
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1619
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1618
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1619
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1620 1620
 
1621
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1622
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1623
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1624
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1625
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1626
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1621
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1622
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1623
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1624
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1625
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1626
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1627 1627
 
1628
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1628
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1629 1629
 	if ($mappopup == 'mappopup') {
1630
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1630
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1631 1631
 	} else {
1632
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1632
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1633 1633
 	}
1634
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1634
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1635 1635
 	if ($airportpopup == 'airportpopup') {
1636
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1636
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1637 1637
 	} else {
1638
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1638
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1639 1639
 	}
1640
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1640
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1641 1641
 	if ($maphistory == 'maphistory') {
1642
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1642
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1643 1643
 	} else {
1644
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1644
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1645 1645
 	}
1646
-	$maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING);
1646
+	$maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING);
1647 1647
 	if ($maptooltip == 'maptooltip') {
1648
-		$settings = array_merge($settings,array('globalMapTooltip' => 'TRUE'));
1648
+		$settings = array_merge($settings, array('globalMapTooltip' => 'TRUE'));
1649 1649
 	} else {
1650
-		$settings = array_merge($settings,array('globalMapTooltip' => 'FALSE'));
1650
+		$settings = array_merge($settings, array('globalMapTooltip' => 'FALSE'));
1651 1651
 	}
1652
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1652
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1653 1653
 	if ($flightroute == 'flightroute') {
1654
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1654
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1655 1655
 	} else {
1656
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1656
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1657 1657
 	}
1658
-	$flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING);
1658
+	$flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING);
1659 1659
 	if ($flightremainingroute == 'flightremainingroute') {
1660
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE'));
1660
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE'));
1661 1661
 	} else {
1662
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE'));
1662
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE'));
1663 1663
 	}
1664
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1664
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1665 1665
 	if ($allflights == 'allflights') {
1666
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1666
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1667 1667
 	} else {
1668
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1668
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1669 1669
 	}
1670
-	$bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING);
1670
+	$bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING);
1671 1671
 	if ($bbox == 'bbox') {
1672
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE'));
1672
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE'));
1673 1673
 	} else {
1674
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE'));
1674
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE'));
1675 1675
 	}
1676
-	$groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING);
1676
+	$groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING);
1677 1677
 	if ($groundaltitude == 'groundaltitude') {
1678
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE'));
1678
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE'));
1679 1679
 	} else {
1680
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE'));
1680
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE'));
1681 1681
 	}
1682
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1682
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1683 1683
 	if ($waypoints == 'waypoints') {
1684
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1684
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1685 1685
 	} else {
1686
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1686
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1687 1687
 	}
1688
-	$geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING);
1688
+	$geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING);
1689 1689
 	if ($geoid == 'geoid') {
1690
-		$settings = array_merge($settings,array('globalGeoid' => 'TRUE'));
1690
+		$settings = array_merge($settings, array('globalGeoid' => 'TRUE'));
1691 1691
 	} else {
1692
-		$settings = array_merge($settings,array('globalGeoid' => 'FALSE'));
1692
+		$settings = array_merge($settings, array('globalGeoid' => 'FALSE'));
1693 1693
 	}
1694
-	$geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING);
1695
-	$settings = array_merge($settings,array('globalGeoidSource' => $geoid_source));
1694
+	$geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING);
1695
+	$settings = array_merge($settings, array('globalGeoidSource' => $geoid_source));
1696 1696
 
1697
-	$noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING);
1697
+	$noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING);
1698 1698
 	if ($noairlines == 'noairlines') {
1699
-		$settings = array_merge($settings,array('globalNoAirlines' => 'TRUE'));
1699
+		$settings = array_merge($settings, array('globalNoAirlines' => 'TRUE'));
1700 1700
 	} else {
1701
-		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1701
+		$settings = array_merge($settings, array('globalNoAirlines' => 'FALSE'));
1702 1702
 	}
1703 1703
 
1704
-	$tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING);
1704
+	$tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING);
1705 1705
 	if ($tsk == 'tsk') {
1706
-		$settings = array_merge($settings,array('globalTSK' => 'TRUE'));
1706
+		$settings = array_merge($settings, array('globalTSK' => 'TRUE'));
1707 1707
 	} else {
1708
-		$settings = array_merge($settings,array('globalTSK' => 'FALSE'));
1708
+		$settings = array_merge($settings, array('globalTSK' => 'FALSE'));
1709 1709
 	}
1710
-	$mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING);
1710
+	$mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING);
1711 1711
 	if ($mapmatching == 'mapmatching') {
1712
-		$settings = array_merge($settings,array('globalMapMatching' => 'TRUE'));
1712
+		$settings = array_merge($settings, array('globalMapMatching' => 'TRUE'));
1713 1713
 	} else {
1714
-		$settings = array_merge($settings,array('globalMapMatching' => 'FALSE'));
1714
+		$settings = array_merge($settings, array('globalMapMatching' => 'FALSE'));
1715 1715
 	}
1716
-	$mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING);
1717
-	$settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource));
1718
-	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1719
-	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1716
+	$mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING);
1717
+	$settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource));
1718
+	$graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING);
1719
+	$settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper));
1720 1720
 
1721
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1721
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1722 1722
 
1723 1723
 	// Set some defaults values...
1724 1724
 	if (!isset($globalAircraftImageSources)) {
1725
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1726
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1725
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1726
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1727 1727
 	}
1728 1728
 
1729 1729
 	if (!isset($globalSchedulesSources)) {
1730
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1731
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1730
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1731
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1732 1732
     	}
1733 1733
 
1734
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1734
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1735 1735
 
1736 1736
 	if ($error == '') settings::modify_settings($settings);
1737 1737
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.
Braces   +599 added lines, -161 removed lines patch added patch discarded remove patch
@@ -4,11 +4,19 @@  discard block
 block discarded – undo
4 4
 if (isset($_SESSION['error'])) {
5 5
 	header('Content-Encoding: none;');
6 6
 	echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.';
7
-	if (isset($_SESSION['error'])) unset($_SESSION['error']);
8
-	if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
9
-	if (isset($_SESSION['next'])) unset($_SESSION['next']);
10
-	if (isset($_SESSION['install'])) unset($_SESSION['install']);
11
-}
7
+	if (isset($_SESSION['error'])) {
8
+		unset($_SESSION['error']);
9
+	}
10
+	if (isset($_SESSION['errorlst'])) {
11
+		unset($_SESSION['errorlst']);
12
+	}
13
+	if (isset($_SESSION['next'])) {
14
+		unset($_SESSION['next']);
15
+	}
16
+	if (isset($_SESSION['install'])) {
17
+		unset($_SESSION['install']);
18
+	}
19
+	}
12 20
 /*
13 21
 if (isset($_SESSION['errorlst'])) {
14 22
 	header('Content-Encoding: none;');
@@ -114,7 +122,9 @@  discard block
 block discarded – undo
114 122
 		if (count($alllng) != count($availablelng)) {
115 123
 			$notavailable = array();
116 124
 			foreach($alllng as $lng) {
117
-				if (!isset($availablelng[$lng])) $notavailable[] = $lng;
125
+				if (!isset($availablelng[$lng])) {
126
+					$notavailable[] = $lng;
127
+				}
118 128
 			}
119 129
 			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
120 130
 		}
@@ -175,31 +185,49 @@  discard block
 block discarded – undo
175 185
 			</div>
176 186
 			<p>
177 187
 				<label for="dbhost">Database hostname</label>
178
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
188
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
189
+	print $globalDBhost;
190
+}
191
+?>" />
179 192
 			</p>
180 193
 			<p>
181 194
 				<label for="dbport">Database port</label>
182
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
195
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
196
+	print $globalDBport;
197
+}
198
+?>" />
183 199
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
184 200
 			</p>
185 201
 			<p>
186 202
 				<label for="dbname">Database name</label>
187
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
203
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
204
+	print $globalDBname;
205
+}
206
+?>" />
188 207
 			</p>
189 208
 			<p>
190 209
 				<label for="dbuser">Database user</label>
191
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
210
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
211
+	print $globalDBuser;
212
+}
213
+?>" />
192 214
 			</p>
193 215
 			<p>
194 216
 				<label for="dbuserpass">Database user password</label>
195
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
217
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
218
+	print $globalDBpass;
219
+}
220
+?>" />
196 221
 			</p>
197 222
 		</fieldset>
198 223
 		<fieldset id="site">
199 224
 			<legend>Site configuration</legend>
200 225
 			<p>
201 226
 				<label for="sitename">Site name</label>
202
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
227
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
228
+	print $globalName;
229
+}
230
+?>" />
203 231
 			</p>
204 232
 			<p>
205 233
 				<label for="siteurl">Site directory</label>
@@ -212,18 +240,27 @@  discard block
 block discarded – undo
212 240
 					}
213 241
 				    }
214 242
 				?>
215
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
243
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
244
+	print $globalURL;
245
+}
246
+?>" />
216 247
 				<p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
217 248
 				<p class="help-block">Can be empty</p>
218 249
 			</p>
219 250
 			<p>
220 251
 				<label for="timezone">Timezone</label>
221
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
252
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
253
+	print $globalTimezone;
254
+}
255
+?>" />
222 256
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
223 257
 			</p>
224 258
 			<p>
225 259
 				<label for="language">Language</label>
226
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
260
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
261
+	print $globalLanguage;
262
+}
263
+?>" />
227 264
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
228 265
 			</p>
229 266
 		</fieldset>
@@ -243,11 +280,17 @@  discard block
 block discarded – undo
243 280
 			<div id="mapbox_data">
244 281
 				<p>
245 282
 					<label for="mapboxid">Mapbox id</label>
246
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
283
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
284
+	print $globalMapboxId;
285
+}
286
+?>" />
247 287
 				</p>
248 288
 				<p>
249 289
 					<label for="mapboxtoken">Mapbox token</label>
250
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
290
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
291
+	print $globalMapboxToken;
292
+}
293
+?>" />
251 294
 				</p>
252 295
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
253 296
 			</div>
@@ -255,7 +298,10 @@  discard block
 block discarded – undo
255 298
 			<div id="google_data">
256 299
 				<p>
257 300
 					<label for="googlekey">Google API key</label>
258
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
301
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
302
+	print $globalGoogleAPIKey;
303
+}
304
+?>" />
259 305
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
260 306
 				</p>
261 307
 			</div>
@@ -263,7 +309,10 @@  discard block
 block discarded – undo
263 309
 			<div id="bing_data">
264 310
 				<p>
265 311
 					<label for="bingkey">Bing Map key</label>
266
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
312
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
313
+	print $globalBingMapKey;
314
+}
315
+?>" />
267 316
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
268 317
 				</p>
269 318
 			</div>
@@ -271,7 +320,10 @@  discard block
 block discarded – undo
271 320
 			<div id="mapquest_data">
272 321
 				<p>
273 322
 					<label for="mapquestkey">MapQuest key</label>
274
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
323
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
324
+	print $globalMapQuestKey;
325
+}
326
+?>" />
275 327
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
276 328
 				</p>
277 329
 			</div>
@@ -279,11 +331,17 @@  discard block
 block discarded – undo
279 331
 			<div id="here_data">
280 332
 				<p>
281 333
 					<label for="hereappid">Here App_Id</label>
282
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
334
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
335
+	print $globalHereappId;
336
+}
337
+?>" />
283 338
 				</p>
284 339
 				<p>
285 340
 					<label for="hereappcode">Here App_Code</label>
286
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
341
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
342
+	print $globalHereappCode;
343
+}
344
+?>" />
287 345
 				</p>
288 346
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
289 347
 			</div>
@@ -291,7 +349,10 @@  discard block
 block discarded – undo
291 349
 			<div id="openweathermap_data">
292 350
 				<p>
293 351
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
294
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
352
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
353
+	print $globalOpenWeatherMapKey;
354
+}
355
+?>" />
295 356
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
296 357
 				</p>
297 358
 			</div>
@@ -320,42 +381,86 @@  discard block
 block discarded – undo
320 381
 			<legend>Coverage area</legend>
321 382
 			<p>
322 383
 				<label for="latitudemax">The maximum latitude (north)</label>
323
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
384
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
385
+	print $globalLatitudeMax;
386
+}
387
+?>" />
324 388
 			</p>
325 389
 			<p>
326 390
 				<label for="latitudemin">The minimum latitude (south)</label>
327
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
391
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
392
+	print $globalLatitudeMin;
393
+}
394
+?>" />
328 395
 			</p>
329 396
 			<p>
330 397
 				<label for="longitudemax">The maximum longitude (west)</label>
331
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
398
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
399
+	print $globalLongitudeMax;
400
+}
401
+?>" />
332 402
 			</p>
333 403
 			<p>
334 404
 				<label for="longitudemin">The minimum longitude (east)</label>
335
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
405
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
406
+	print $globalLongitudeMin;
407
+}
408
+?>" />
336 409
 			</p>
337 410
 			<p>
338 411
 				<label for="latitudecenter">The latitude center</label>
339
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
412
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
413
+	print $globalCenterLatitude;
414
+}
415
+?>" />
340 416
 			</p>
341 417
 			<p>
342 418
 				<label for="longitudecenter">The longitude center</label>
343
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
419
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
420
+	print $globalCenterLongitude;
421
+}
422
+?>" />
344 423
 			</p>
345 424
 			<p>
346 425
 				<label for="livezoom">Default Zoom on live map</label>
347
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
426
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
427
+	print $globalLiveZoom;
428
+} else {
429
+	print '9';
430
+}
431
+?>" />
348 432
 			</p>
349 433
 			<p>
350 434
 				<label for="squawk_country">Country for squawk usage</label>
351 435
 				<select name="squawk_country" id="squawk_country">
352
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
353
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
354
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
355
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
356
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
357
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
358
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
436
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
437
+	print ' selected ';
438
+}
439
+?>>UK</option>
440
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
441
+	print ' selected ';
442
+}
443
+?>>NZ</option>
444
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
445
+	print ' selected ';
446
+}
447
+?>>US</option>
448
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
449
+	print ' selected ';
450
+}
451
+?>>AU</option>
452
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
453
+	print ' selected ';
454
+}
455
+?>>NL</option>
456
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
457
+	print ' selected ';
458
+}
459
+?>>FR</option>
460
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
461
+	print ' selected ';
462
+}
463
+?>>TR</option>
359 464
 				</select>
360 465
 			</p>
361 466
 		</fieldset>
@@ -364,15 +469,24 @@  discard block
 block discarded – undo
364 469
 			<p><i>Only put in DB flights that are inside a circle</i></p>
365 470
 			<p>
366 471
 				<label for="latitude">Center latitude</label>
367
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
472
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
473
+	echo $globalDistanceIgnore['latitude'];
474
+}
475
+?>" />
368 476
 			</p>
369 477
 			<p>
370 478
 				<label for="longitude">Center longitude</label>
371
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
479
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
480
+	echo $globalDistanceIgnore['longitude'];
481
+}
482
+?>" />
372 483
 			</p>
373 484
 			<p>
374 485
 				<label for="Distance">Distance (in km)</label>
375
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
486
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
487
+	echo $globalDistanceIgnore['distance'];
488
+}
489
+?>" />
376 490
 			</p>
377 491
 		</fieldset>
378 492
 		<fieldset id="sourceloc">
@@ -488,11 +602,17 @@  discard block
 block discarded – undo
488 602
 			<div id="flightaware_data">
489 603
 				<p>
490 604
 					<label for="flightawareusername">FlightAware username</label>
491
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
605
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
606
+	print $globalFlightAwareUsername;
607
+}
608
+?>" />
492 609
 				</p>
493 610
 				<p>
494 611
 					<label for="flightawarepassword">FlightAware password/API key</label>
495
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
612
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
613
+	print $globalFlightAwarePassword;
614
+}
615
+?>" />
496 616
 				</p>
497 617
 			</div>
498 618
 -->
@@ -534,7 +654,10 @@  discard block
 block discarded – undo
534 654
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
535 655
 								?>
536 656
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
537
-								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
657
+								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) {
658
+	print $source['port'];
659
+}
660
+?>" /></td>
538 661
 								<?php
539 662
 								    } else {
540 663
 									$hostport = explode(':',$source['host']);
@@ -553,36 +676,114 @@  discard block
 block discarded – undo
553 676
 								?>
554 677
 								<td>
555 678
 									<select name="format[]" id="format">
556
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
557
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
558
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
559
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
560
-										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option>
561
-										<option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option>
562
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
563
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
564
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
565
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
566
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
567
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
568
-										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option>
569
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
570
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
571
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
572
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
573
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
574
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
575
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
576
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
577
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
578
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
679
+										<option value="auto" <?php if (!isset($source['format'])) {
680
+	print 'selected';
681
+}
682
+?>>Auto</option>
683
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
684
+	print 'selected';
685
+}
686
+?>>SBS</option>
687
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
688
+	print 'selected';
689
+}
690
+?>>TSV</option>
691
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
692
+	print 'selected';
693
+}
694
+?>>Raw</option>
695
+										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') {
696
+	print 'selected';
697
+}
698
+?>>Dump1090 aircraft.json</option>
699
+										<option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') {
700
+	print 'selected';
701
+}
702
+?>>Planefinder client</option>
703
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
704
+	print 'selected';
705
+}
706
+?>>APRS</option>
707
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
708
+	print 'selected';
709
+}
710
+?>>Radarcape deltadb.txt</option>
711
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
712
+	print 'selected';
713
+}
714
+?>>Vatsim</option>
715
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
716
+	print 'selected';
717
+}
718
+?>>Virtual Radar Server AircraftList.json</option>
719
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
720
+	print 'selected';
721
+}
722
+?>>Virtual Radar Server TCP</option>
723
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
724
+	print 'selected';
725
+}
726
+?>>phpVMS</option>
727
+										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
728
+	print 'selected';
729
+}
730
+?>>Virtual Airline Operations System (VAOS)</option>
731
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
732
+	print 'selected';
733
+}
734
+?>>Virtual Airlines Manager</option>
735
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
736
+	print 'selected';
737
+}
738
+?>>IVAO</option>
739
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
740
+	print 'selected';
741
+}
742
+?>>FlightGear Multiplayer</option>
743
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
744
+	print 'selected';
745
+}
746
+?>>FlightGear Singleplayer</option>
747
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
748
+	print 'selected';
749
+}
750
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
751
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
752
+	print 'selected';
753
+}
754
+?>>ACARS SBS-3 over TCP</option>
755
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
756
+	print 'selected';
757
+}
758
+?>>NMEA AIS over TCP</option>
759
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
760
+	print 'selected';
761
+}
762
+?>>AirWhere website</option>
763
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
764
+	print 'selected';
765
+}
766
+?>>HidnSeek Callback</option>
767
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
768
+	print 'selected';
769
+}
770
+?>>Blitzortung</option>
579 771
 									</select>
580 772
 								</td>
581 773
 								<td>
582
-									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
774
+									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
775
+	print $source['name'];
776
+}
777
+?>" />
583 778
 								</td>
584
-								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
585
-								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
779
+								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
780
+	print 'checked';
781
+}
782
+?> /></td>
783
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
784
+	print 'checked';
785
+}
786
+?> /></td>
586 787
 								<td>
587 788
 									<select name="timezones[]" id="timezones">
588 789
 								<?php
@@ -592,7 +793,9 @@  discard block
 block discarded – undo
592 793
 											print '<option selected>'.$timezones.'</option>';
593 794
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
594 795
 											print '<option selected>'.$timezones.'</option>';
595
-										} else print '<option>'.$timezones.'</option>';
796
+										} else {
797
+											print '<option>'.$timezones.'</option>';
798
+										}
596 799
 									}
597 800
 								?>
598 801
 									</select>
@@ -645,7 +848,9 @@  discard block
 block discarded – undo
645 848
 									foreach($timezonelist as $timezones){
646 849
 										if ($timezones == 'UTC') {
647 850
 											print '<option selected>'.$timezones.'</option>';
648
-										} else print '<option>'.$timezones.'</option>';
851
+										} else {
852
+											print '<option>'.$timezones.'</option>';
853
+										}
649 854
 									}
650 855
 								?>
651 856
 									</select>
@@ -670,11 +875,17 @@  discard block
 block discarded – undo
670 875
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
671 876
 					<p>
672 877
 						<label for="acarshost">ACARS UDP host</label>
673
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
878
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
879
+	print $globalACARSHost;
880
+}
881
+?>" />
674 882
 					</p>
675 883
 					<p>
676 884
 						<label for="acarsport">ACARS UDP port</label>
677
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
885
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
886
+	print $globalACARSPort;
887
+}
888
+?>" />
678 889
 					</p>
679 890
 				</fieldset>
680 891
 			</div>
@@ -700,17 +911,38 @@  discard block
 block discarded – undo
700 911
 				    <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td>
701 912
 				    <td>
702 913
 					<select name="newslang[]">
703
-					    <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option>
704
-					    <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option>
914
+					    <option value="en"<?php if ($lng == 'en') {
915
+	print ' selected';
916
+}
917
+?>>English</option>
918
+					    <option value="fr"<?php if ($lng == 'fr') {
919
+	print ' selected';
920
+}
921
+?>>French</option>
705 922
 					</select>
706 923
 				    </td>
707 924
 				    <td>
708 925
 					<select name="newstype[]">
709
-					    <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option>
710
-					    <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option>
711
-					    <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option>
712
-					    <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option>
713
-					    <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option>
926
+					    <option value="global"<?php if ($type == 'global') {
927
+	print ' selected';
928
+}
929
+?>>Global</option>
930
+					    <option value="aircraft"<?php if ($type == 'aircraft') {
931
+	print ' selected';
932
+}
933
+?>>Aircraft</option>
934
+					    <option value="marine"<?php if ($type == 'marine') {
935
+	print ' selected';
936
+}
937
+?>>Marine</option>
938
+					    <option value="tracker"<?php if ($type == 'tracker') {
939
+	print ' selected';
940
+}
941
+?>>Tracker</option>
942
+					    <option value="satellite"<?php if ($type == 'Satellite') {
943
+	print ' selected';
944
+}
945
+?>>Satellite</option>
714 946
 					</select>
715 947
 				    </td>
716 948
 				    <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td>
@@ -852,13 +1084,19 @@  discard block
 block discarded – undo
852 1084
 			<div id="schedules_options">
853 1085
 				<p>
854 1086
 					<label for="britishairways">British Airways API Key</label>
855
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
1087
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
1088
+	print $globalBritishAirwaysKey;
1089
+}
1090
+?>" />
856 1091
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
857 1092
 				</p>
858 1093
 				<!--
859 1094
 				<p>
860 1095
 					<label for="transavia">Transavia Test API Consumer Key</label>
861
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
1096
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
1097
+	print $globalTransaviaKey;
1098
+}
1099
+?>" />
862 1100
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
863 1101
 				</p>
864 1102
 				-->
@@ -867,10 +1105,16 @@  discard block
 block discarded – undo
867 1105
 						<b>Lufthansa API Key</b>
868 1106
 						<p>
869 1107
 							<label for="lufthansakey">Key</label>
870
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
1108
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
1109
+	print $globalLufthansaKey['key'];
1110
+}
1111
+?>" />
871 1112
 						</p><p>
872 1113
 							<label for="lufthansasecret">Secret</label>
873
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
1114
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
1115
+	print $globalLufthansaKey['secret'];
1116
+}
1117
+?>" />
874 1118
 						</p>
875 1119
 					</div>
876 1120
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -880,11 +1124,17 @@  discard block
 block discarded – undo
880 1124
 						<b>FlightAware API Key</b>
881 1125
 						<p>
882 1126
 							<label for="flightawareusername">Username</label>
883
-							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
1127
+							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
1128
+	print $globalFlightAwareUsername;
1129
+}
1130
+?>" />
884 1131
 						</p>
885 1132
 						<p>
886 1133
 							<label for="flightawarepassword">API key</label>
887
-							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
1134
+							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
1135
+	print $globalFlightAwarePassword;
1136
+}
1137
+?>" />
888 1138
 						</p>
889 1139
 					</div>
890 1140
 					<p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p>
@@ -901,10 +1151,22 @@  discard block
 block discarded – undo
901 1151
 				<p>
902 1152
 					<label for="mapmatchingsource">Map Matching source</label>
903 1153
 					<select name="mapmatchingsource" id="mapmatchingsource">
904
-						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option>
905
-						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option>
906
-						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option>
907
-						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option>
1154
+						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) {
1155
+	print 'selected="selected" ';
1156
+}
1157
+?>>FlightAirMap Map Matching</option>
1158
+						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') {
1159
+	print 'selected="selected" ';
1160
+}
1161
+?>>GraphHopper</option>
1162
+						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') {
1163
+	print 'selected="selected" ';
1164
+}
1165
+?>>OSMR</option>
1166
+						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') {
1167
+	print 'selected="selected" ';
1168
+}
1169
+?>>Mapbox</option>
908 1170
 					</select>
909 1171
 					<p class="help-block">Mapbox need the API Key defined in map section.</p>
910 1172
 					<p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p>
@@ -912,7 +1174,10 @@  discard block
 block discarded – undo
912 1174
 				<br />
913 1175
 				<p>
914 1176
 					<label for="graphhopper">GraphHopper API Key</label>
915
-					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" />
1177
+					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) {
1178
+	print $globalGraphHopperKey;
1179
+}
1180
+?>" />
916 1181
 					<p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p>
917 1182
 				</p>
918 1183
 			</div>
@@ -930,7 +1195,10 @@  discard block
 block discarded – undo
930 1195
 			</p>
931 1196
 			<p>
932 1197
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
933
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
1198
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
1199
+	print $globalNOTAMSource;
1200
+}
1201
+?>" />
934 1202
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
935 1203
 			</p>
936 1204
 			<br />
@@ -946,14 +1214,20 @@  discard block
 block discarded – undo
946 1214
 			<div id="metarsrc">
947 1215
 				<p>
948 1216
 					<label for="metarsource">URL of your METAR source</label>
949
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
1217
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
1218
+	print $globalMETARurl;
1219
+}
1220
+?>" />
950 1221
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
951 1222
 				</p>
952 1223
 			</div>
953 1224
 			<br />
954 1225
 			<p>
955 1226
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
956
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
1227
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
1228
+	print $globalBitlyAccessToken;
1229
+}
1230
+?>" />
957 1231
 			</p>
958 1232
 			<br />
959 1233
 			<p>
@@ -969,11 +1243,26 @@  discard block
 block discarded – undo
969 1243
 			<p>
970 1244
 				<label for="geoid_source">Geoid Source</label>
971 1245
 				<select name="geoid_source" id="geoid_source">
972
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
973
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
974
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
975
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
976
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
1246
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
1247
+	print ' selected="selected"';
1248
+}
1249
+?>>EGM96 15' (2.1MB)</option>
1250
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
1251
+	print ' selected="selected"';
1252
+}
1253
+?>>EGM96 5' (19MB)</option>
1254
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
1255
+	print ' selected="selected"';
1256
+}
1257
+?>>EGM2008 5' (19MB)</option>
1258
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
1259
+	print ' selected="selected"';
1260
+}
1261
+?>>EGM2008 2.5' (75MB)</option>
1262
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
1263
+	print ' selected="selected"';
1264
+}
1265
+?>>EGM2008 1' (470MB)</option>
977 1266
 				</select>
978 1267
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
979 1268
 			</p>
@@ -995,7 +1284,12 @@  discard block
 block discarded – undo
995 1284
 			</p>
996 1285
 			<p>
997 1286
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
998
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1287
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1288
+	print $globalArchiveMonths;
1289
+} else {
1290
+	echo '1';
1291
+}
1292
+?>" />
999 1293
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
1000 1294
 			</p>
1001 1295
 			<p>
@@ -1005,12 +1299,22 @@  discard block
 block discarded – undo
1005 1299
 			</p>
1006 1300
 			<p>
1007 1301
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
1008
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1302
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1303
+	print $globalArchiveKeepMonths;
1304
+} else {
1305
+	echo '1';
1306
+}
1307
+?>" />
1009 1308
 				<p class="help-block">0 to disable</p>
1010 1309
 			</p>
1011 1310
 			<p>
1012 1311
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
1013
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1312
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1313
+	print $globalArchiveKeepTrackMonths;
1314
+} else {
1315
+	echo '1';
1316
+}
1317
+?>" />
1014 1318
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
1015 1319
 			</p>
1016 1320
 			<br />
@@ -1020,7 +1324,12 @@  discard block
 block discarded – undo
1020 1324
 				<p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p>
1021 1325
 				<div id="cronends"> 
1022 1326
 					<label for="cronend">Run script for xx seconds</label>
1023
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1327
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1328
+	print $globalCronEnd;
1329
+} else {
1330
+	print '0';
1331
+}
1332
+?>" />
1024 1333
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
1025 1334
 				</div>
1026 1335
 			</p>
@@ -1073,20 +1382,40 @@  discard block
 block discarded – undo
1073 1382
 			<br />
1074 1383
 			<p>
1075 1384
 				<label for="refresh">Show flights detected since xxx seconds</label>
1076
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1385
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1386
+	echo $globalLiveInterval;
1387
+} else {
1388
+	echo '200';
1389
+}
1390
+?>" />
1077 1391
 			</p>
1078 1392
 			<p>
1079 1393
 				<label for="maprefresh">Live map refresh (in seconds)</label>
1080
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1394
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1395
+	echo $globalMapRefresh;
1396
+} else {
1397
+	echo '30';
1398
+}
1399
+?>" />
1081 1400
 			</p>
1082 1401
 			<p>
1083 1402
 				<label for="mapidle">Map idle timeout (in minutes)</label>
1084
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1403
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1404
+	echo $globalMapIdleTimeout;
1405
+} else {
1406
+	echo '30';
1407
+}
1408
+?>" />
1085 1409
 				<p class="help-block">0 to disable</p>
1086 1410
 			</p>
1087 1411
 			<p>
1088 1412
 				<label for="minfetch">HTTP/file source fetch every xxx seconds</label>
1089
-				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" />
1413
+				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) {
1414
+	echo $globalMinFetch;
1415
+} else {
1416
+	echo '20';
1417
+}
1418
+?>" />
1090 1419
 			</p>
1091 1420
 			<p>
1092 1421
 				<label for="bbox">Only display flights that we can see on screen (bounding box)</label>
@@ -1100,12 +1429,20 @@  discard block
 block discarded – undo
1100 1429
 			<br />
1101 1430
 			<p>
1102 1431
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
1103
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1432
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1433
+	echo $globalClosestMinDist;
1434
+} else {
1435
+	echo '50';
1436
+}
1437
+?>" />
1104 1438
 			</p>
1105 1439
 			<br />
1106 1440
 			<p>
1107 1441
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1108
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1442
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1443
+	echo $globalAircraftSize;
1444
+}
1445
+?>" />
1109 1446
 			</p>
1110 1447
 			<br />
1111 1448
 			<p>
@@ -1124,7 +1461,12 @@  discard block
 block discarded – undo
1124 1461
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
1125 1462
 			?>
1126 1463
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
1127
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1464
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1465
+	echo $globalAircraftIconColor;
1466
+} else {
1467
+	echo '1a3151';
1468
+}
1469
+?>" />
1128 1470
 			<?php
1129 1471
 				if (!is_writable('../cache')) {
1130 1472
 			?>
@@ -1142,14 +1484,27 @@  discard block
 block discarded – undo
1142 1484
 			<p>
1143 1485
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
1144 1486
 				<div class="range">
1145
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
1146
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1487
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1488
+	echo $globalAirportZoom;
1489
+} else {
1490
+	echo '7';
1491
+}
1492
+?>" />
1493
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1494
+	echo $globalAirportZoom;
1495
+} else {
1496
+	echo '7';
1497
+}
1498
+?></output>
1147 1499
 				</div>
1148 1500
 			</p>
1149 1501
 			<br />
1150 1502
 			<p>
1151 1503
 				<label for="customcss">Custom CSS web path</label>
1152
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1504
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1505
+	echo $globalCustomCSS;
1506
+}
1507
+?>" />
1153 1508
 			</p>
1154 1509
 		</fieldset>
1155 1510
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -1176,8 +1531,12 @@  discard block
 block discarded – undo
1176 1531
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1177 1532
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1178 1533
 
1179
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1180
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1534
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1535
+		$error .= 'Mysql driver for PDO must be loaded';
1536
+	}
1537
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1538
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1539
+	}
1181 1540
 	
1182 1541
 	$_SESSION['database_root'] = $dbroot;
1183 1542
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1245,15 +1604,23 @@  discard block
 block discarded – undo
1245 1604
 	$source_city = $_POST['source_city'];
1246 1605
 	$source_country = $_POST['source_country'];
1247 1606
 	$source_ref = $_POST['source_ref'];
1248
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1249
-	else $source_id = array();
1607
+	if (isset($source_id)) {
1608
+		$source_id = $_POST['source_id'];
1609
+	} else {
1610
+		$source_id = array();
1611
+	}
1250 1612
 	
1251 1613
 	$sources = array();
1252 1614
 	foreach ($source_name as $keys => $name) {
1253
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1254
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1615
+	    if (isset($source_id[$keys])) {
1616
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1617
+	    } else {
1618
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1619
+	    }
1620
+	}
1621
+	if (count($sources) > 0) {
1622
+		$_SESSION['sources'] = $sources;
1255 1623
 	}
1256
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1257 1624
 
1258 1625
 	$newsurl = $_POST['newsurl'];
1259 1626
 	$newslng = $_POST['newslang'];
@@ -1266,7 +1633,9 @@  discard block
 block discarded – undo
1266 1633
 		$lng = $newslng[$newskey];
1267 1634
 		if (isset($newsfeeds[$type][$lng])) {
1268 1635
 		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1269
-		} else $newsfeeds[$type][$lng] = array($url);
1636
+		} else {
1637
+			$newsfeeds[$type][$lng] = array($url);
1638
+		}
1270 1639
 	    }
1271 1640
 	}
1272 1641
 	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
@@ -1290,17 +1659,29 @@  discard block
 block discarded – undo
1290 1659
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1291 1660
 
1292 1661
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1293
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1294
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1662
+	if ($globalaircraft == 'aircraft') {
1663
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1664
+	} else {
1665
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1666
+	}
1295 1667
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1296
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1297
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1668
+	if ($globaltracker == 'tracker') {
1669
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1670
+	} else {
1671
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1672
+	}
1298 1673
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1299
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1300
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1674
+	if ($globalmarine == 'marine') {
1675
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1676
+	} else {
1677
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1678
+	}
1301 1679
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1302
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1303
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1680
+	if ($globalsatellite == 'satellite') {
1681
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1682
+	} else {
1683
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1684
+	}
1304 1685
 
1305 1686
 /*	
1306 1687
 	$globalSBS1Hosts = array();
@@ -1322,23 +1703,37 @@  discard block
 block discarded – undo
1322 1703
 	$name = $_POST['name'];
1323 1704
 	$format = $_POST['format'];
1324 1705
 	$timezones = $_POST['timezones'];
1325
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1326
-	else $sourcestats = array();
1327
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1328
-	else $noarchive = array();
1706
+	if (isset($_POST['sourcestats'])) {
1707
+		$sourcestats = $_POST['sourcestats'];
1708
+	} else {
1709
+		$sourcestats = array();
1710
+	}
1711
+	if (isset($_POST['noarchive'])) {
1712
+		$noarchive = $_POST['noarchive'];
1713
+	} else {
1714
+		$noarchive = array();
1715
+	}
1329 1716
 	$gSources = array();
1330 1717
 	$forcepilots = false;
1331 1718
 	foreach ($host as $key => $h) {
1332
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1333
-		else $cov = 'FALSE';
1334
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1335
-		else $arch = 'FALSE';
1719
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1720
+			$cov = 'TRUE';
1721
+		} else {
1722
+			$cov = 'FALSE';
1723
+		}
1724
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1725
+			$arch = 'TRUE';
1726
+		} else {
1727
+			$arch = 'FALSE';
1728
+		}
1336 1729
 		if (strpos($format[$key],'_callback')) {
1337 1730
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1338 1731
 		} elseif ($h != '' || $name[$key] != '') {
1339 1732
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1340 1733
 		}
1341
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1734
+		if ($format[$key] == 'airwhere') {
1735
+			$forcepilots = true;
1736
+		}
1342 1737
 	}
1343 1738
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1344 1739
 
@@ -1369,7 +1764,9 @@  discard block
 block discarded – undo
1369 1764
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1370 1765
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1371 1766
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1372
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1767
+	} else {
1768
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1769
+	}
1373 1770
 
1374 1771
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1375 1772
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1410,7 +1807,9 @@  discard block
 block discarded – undo
1410 1807
 
1411 1808
 	// Create in settings.php keys not yet configurable if not already here
1412 1809
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1413
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1810
+	if (!isset($globalDebug)) {
1811
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1812
+	}
1414 1813
 
1415 1814
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1416 1815
 	if ($resetyearstats == 'resetyearstats') {
@@ -1453,37 +1852,56 @@  discard block
 block discarded – undo
1453 1852
 	}
1454 1853
 */
1455 1854
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1456
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1457
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1458
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1459
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1855
+	if ($globalsbs == 'sbs') {
1856
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1857
+	} else {
1858
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1859
+	}
1860
+	if ($globalaprs == 'aprs') {
1861
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1862
+	} else {
1863
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1864
+	}
1460 1865
 	$va = false;
1461 1866
 	if ($globalivao == 'ivao') {
1462 1867
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1463 1868
 		$va = true;
1464
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1869
+	} else {
1870
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1871
+	}
1465 1872
 	if ($globalvatsim == 'vatsim') {
1466 1873
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1467 1874
 		$va = true;
1468
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1875
+	} else {
1876
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1877
+	}
1469 1878
 	if ($globalphpvms == 'phpvms') {
1470 1879
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1471 1880
 		$va = true;
1472
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1881
+	} else {
1882
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1883
+	}
1473 1884
 	if ($globalvam == 'vam') {
1474 1885
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1475 1886
 		$va = true;
1476
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1887
+	} else {
1888
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1889
+	}
1477 1890
 	if ($va) {
1478 1891
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1479
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1892
+	} else {
1893
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1894
+	}
1480 1895
 	if ($globalva == 'va' || $va) {
1481 1896
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1482 1897
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1483 1898
 	} else {
1484 1899
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1485
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1486
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1900
+		if ($forcepilots) {
1901
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1902
+		} else {
1903
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1904
+		}
1487 1905
 	}
1488 1906
 	
1489 1907
 	
@@ -1718,7 +2136,9 @@  discard block
 block discarded – undo
1718 2136
 	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1719 2137
 	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1720 2138
 
1721
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2139
+	if (!isset($globalTransaction)) {
2140
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2141
+	}
1722 2142
 
1723 2143
 	// Set some defaults values...
1724 2144
 	if (!isset($globalAircraftImageSources)) {
@@ -1733,15 +2153,23 @@  discard block
 block discarded – undo
1733 2153
 
1734 2154
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1735 2155
 
1736
-	if ($error == '') settings::modify_settings($settings);
1737
-	if ($error == '') settings::comment_settings($settings_comment);
2156
+	if ($error == '') {
2157
+		settings::modify_settings($settings);
2158
+	}
2159
+	if ($error == '') {
2160
+		settings::comment_settings($settings_comment);
2161
+	}
1738 2162
 	if ($error != '') {
1739 2163
 		print '<div class="info column">'.$error.'</div>';
1740 2164
 		require('../footer.php');
1741 2165
 		exit;
1742 2166
 	} else {
1743
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1744
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
2167
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
2168
+			$_SESSION['waypoints'] = 1;
2169
+		}
2170
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
2171
+			$_SESSION['owner'] = 1;
2172
+		}
1745 2173
 		if (isset($_POST['createdb'])) {
1746 2174
 			$_SESSION['install'] = 'database_create';
1747 2175
 		} else {
@@ -1778,10 +2206,18 @@  discard block
 block discarded – undo
1778 2206
 	$popw = false;
1779 2207
 	foreach ($_SESSION['done'] as $done) {
1780 2208
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1781
-	    if ($done == 'Create database') $pop = true;
1782
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1783
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1784
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
2209
+	    if ($done == 'Create database') {
2210
+	    	$pop = true;
2211
+	    }
2212
+	    if ($_SESSION['install'] == 'database_create') {
2213
+	    	$pop = true;
2214
+	    }
2215
+	    if ($_SESSION['install'] == 'database_import') {
2216
+	    	$popi = true;
2217
+	    }
2218
+	    if ($_SESSION['install'] == 'waypoints') {
2219
+	    	$popw = true;
2220
+	    }
1785 2221
 	}
1786 2222
 	if ($pop) {
1787 2223
 	    sleep(5);
@@ -1792,7 +2228,9 @@  discard block
 block discarded – undo
1792 2228
 	} else if ($popw) {
1793 2229
 	    sleep(5);
1794 2230
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1795
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2231
+	} else {
2232
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2233
+	}
1796 2234
 	print '</div></ul>';
1797 2235
 	print '<div id="error"></div>';
1798 2236
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.