@@ -1,12 +1,12 @@ discard block |
||
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 = 46; |
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | try { |
20 | 20 | $sth = $this->db->prepare($query); |
21 | 21 | $sth->execute(array(':name' => $name)); |
22 | - } catch(PDOException $e) { |
|
22 | + } catch (PDOException $e) { |
|
23 | 23 | echo $e->getMessage(); |
24 | 24 | } |
25 | 25 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | try { |
32 | 32 | $sth = $this->db->prepare($query); |
33 | 33 | $sth->execute(); |
34 | - } catch(PDOException $e) { |
|
34 | + } catch (PDOException $e) { |
|
35 | 35 | echo $e->getMessage(); |
36 | 36 | } |
37 | 37 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | try { |
44 | 44 | $sth = $this->db->prepare($query); |
45 | 45 | $sth->execute(); |
46 | - } catch(PDOException $e) { |
|
46 | + } catch (PDOException $e) { |
|
47 | 47 | echo $e->getMessage(); |
48 | 48 | } |
49 | 49 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
57 | 57 | $sth->execute(array(':type' => $type)); |
58 | - } catch(PDOException $e) { |
|
58 | + } catch (PDOException $e) { |
|
59 | 59 | echo $e->getMessage(); |
60 | 60 | } |
61 | 61 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -63,48 +63,48 @@ discard block |
||
63 | 63 | else return array(); |
64 | 64 | } |
65 | 65 | |
66 | - public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
66 | + public function position_all($timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
67 | 67 | $all_sat = $this->get_tle_names(); |
68 | 68 | $result = array(); |
69 | 69 | foreach ($all_sat as $sat) { |
70 | - $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
|
71 | - $result = array_merge($position,$result); |
|
70 | + $position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second); |
|
71 | + $result = array_merge($position, $result); |
|
72 | 72 | } |
73 | 73 | return $result; |
74 | 74 | } |
75 | 75 | |
76 | - public function position_all_type($type,$timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
76 | + public function position_all_type($type, $timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
77 | 77 | $all_sat = $this->get_tle_names_type($type); |
78 | 78 | $result = array(); |
79 | 79 | foreach ($all_sat as $sat) { |
80 | - $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
|
81 | - $result = array_merge($position,$result); |
|
80 | + $position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second); |
|
81 | + $result = array_merge($position, $result); |
|
82 | 82 | } |
83 | 83 | return $result; |
84 | 84 | } |
85 | 85 | |
86 | - public function position($name,$timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
86 | + public function position($name, $timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
87 | 87 | $qth = new Predict_QTH(); |
88 | 88 | $qth->lat = floatval(37.790252); |
89 | 89 | $qth->lon = floatval(-122.419968); |
90 | 90 | |
91 | 91 | $tle_file = $this->get_tle($name); |
92 | 92 | $type = $tle_file['tle_type']; |
93 | - $tle = new Predict_TLE($tle_file['tle_name'],$tle_file['tle_tle1'],$tle_file['tle_tle2']); |
|
93 | + $tle = new Predict_TLE($tle_file['tle_name'], $tle_file['tle_tle1'], $tle_file['tle_tle2']); |
|
94 | 94 | $sat = new Predict_Sat($tle); |
95 | 95 | $predict = new Predict(); |
96 | 96 | //if ($timestamp == '') $now = Predict_Time::get_current_daynum(); |
97 | 97 | if ($timestamp_begin == '') $timestamp_begin = time(); |
98 | 98 | if ($timestamp_end == '') { |
99 | 99 | $now = Predict_Time::unix2daynum($timestamp_begin); |
100 | - $predict->predict_calc($sat,$qth,$now); |
|
101 | - return array('name' => $name, 'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp_begin,'type' => $type); |
|
100 | + $predict->predict_calc($sat, $qth, $now); |
|
101 | + return array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp_begin, 'type' => $type); |
|
102 | 102 | } else { |
103 | 103 | $result = array(); |
104 | - for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp=$timestamp+$second) { |
|
104 | + for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp = $timestamp + $second) { |
|
105 | 105 | $now = Predict_Time::unix2daynum($timestamp); |
106 | - $predict->predict_calc($sat,$qth,$now); |
|
107 | - $result[] = array('name' => $name,'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp,'type' => $type); |
|
106 | + $predict->predict_calc($sat, $qth, $now); |
|
107 | + $result[] = array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp, 'type' => $type); |
|
108 | 108 | } |
109 | 109 | return $result; |
110 | 110 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | try { |
116 | 116 | $sth = $this->db->prepare($query); |
117 | 117 | $sth->execute(array(':name' => $name.'%')); |
118 | - } catch(PDOException $e) { |
|
118 | + } catch (PDOException $e) { |
|
119 | 119 | echo $e->getMessage(); |
120 | 120 | } |
121 | 121 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $sth->execute($query_values); |
144 | 144 | $launch_site_array = array(); |
145 | 145 | $temp_array = array(); |
146 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
146 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
147 | 147 | { |
148 | 148 | $temp_array['launch_site'] = $row['launch_site']; |
149 | 149 | $temp_array['launch_site_count'] = $row['launch_site_count']; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $sth->execute($query_values); |
173 | 173 | $owner_array = array(); |
174 | 174 | $temp_array = array(); |
175 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
175 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
176 | 176 | { |
177 | 177 | $temp_array['owner_name'] = $row['owner_name']; |
178 | 178 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $sth->execute($query_values); |
202 | 202 | $owner_array = array(); |
203 | 203 | $temp_array = array(); |
204 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
204 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
205 | 205 | { |
206 | 206 | $temp_array['country_name'] = $row['country_name']; |
207 | 207 | $temp_array['country_count'] = $row['country_count']; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $sth->execute($query_data); |
246 | 246 | $date_array = array(); |
247 | 247 | $temp_array = array(); |
248 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
248 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
249 | 249 | { |
250 | 250 | $temp_array['year_name'] = $row['year_name']; |
251 | 251 | $temp_array['month_name'] = $row['month_name']; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $sth->execute($query_data); |
291 | 291 | $date_array = array(); |
292 | 292 | $temp_array = array(); |
293 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
293 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
294 | 294 | { |
295 | 295 | $temp_array['year_name'] = $row['year_name']; |
296 | 296 | $temp_array['date_count'] = $row['date_count']; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <button type="button" class="close">×</button> |
10 | 10 | <?php |
11 | 11 | |
12 | -$sat = filter_input(INPUT_GET,'sat',FILTER_SANITIZE_STRING); |
|
12 | +$sat = filter_input(INPUT_GET, 'sat', FILTER_SANITIZE_STRING); |
|
13 | 13 | $sat = urldecode($sat); |
14 | 14 | //$info = $Satellite->get_info(str_replace(' ','-',$sat)); |
15 | 15 | //print_r($info); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $aircraft_name = 'INTEGRAL'; |
49 | 49 | // $ground_speed = 14970; |
50 | 50 | $launch_date = '17 October 2002'; |
51 | -} elseif (strpos($sat,'IRIDIUM') !== false) { |
|
51 | +} elseif (strpos($sat, 'IRIDIUM') !== false) { |
|
52 | 52 | $image = 'https://upload.wikimedia.org/wikipedia/commons/b/b6/Iridium_Satellite.jpg'; |
53 | 53 | $image_copyright = 'Cliff'; |
54 | 54 | $ident = 'Iridium satellite constellation'; |
@@ -56,23 +56,23 @@ discard block |
||
56 | 56 | $aircraft_name = $sat; |
57 | 57 | // $ground_speed = 14970; |
58 | 58 | // $launch_date = '29 september 2011'; |
59 | -} elseif (strpos($sat,'ORBCOMM') !== false) { |
|
59 | +} elseif (strpos($sat, 'ORBCOMM') !== false) { |
|
60 | 60 | $ident = 'Orbcomm'; |
61 | 61 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Orbcomm_(satellite)'; |
62 | 62 | $aircraft_name = $sat; |
63 | -} elseif (strpos($sat,'GLOBALSTAR') !== false) { |
|
63 | +} elseif (strpos($sat, 'GLOBALSTAR') !== false) { |
|
64 | 64 | $ident = 'Globalstar'; |
65 | 65 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Globalstar'; |
66 | 66 | $aircraft_name = $sat; |
67 | - $satname = str_replace(array('[+]','[-]'),'',$sat); |
|
68 | -} elseif (strpos($sat,'OSCAR 7') !== false) { |
|
67 | + $satname = str_replace(array('[+]', '[-]'), '', $sat); |
|
68 | +} elseif (strpos($sat, 'OSCAR 7') !== false) { |
|
69 | 69 | $image = 'https://upload.wikimedia.org/wikipedia/en/a/ad/AMSAT-OSCAR_7.jpg'; |
70 | 70 | $image_copyright = 'Amsat.org'; |
71 | 71 | $ident = 'AMSAT-OSCAR 7'; |
72 | 72 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/AMSAT-OSCAR_7'; |
73 | 73 | $aircraft_name = $sat; |
74 | 74 | $launch_date = '15 November 1974'; |
75 | -} elseif (strpos($sat,'santaclaus') !== false) { |
|
75 | +} elseif (strpos($sat, 'santaclaus') !== false) { |
|
76 | 76 | $image = 'https://upload.wikimedia.org/wikipedia/commons/4/49/Jonathan_G_Meath_portrays_Santa_Claus.jpg'; |
77 | 77 | $image_copyright = 'Jonathan G Meath'; |
78 | 78 | $ident = 'Santa Claus'; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | // $launch_date = '15 November 1974'; |
82 | 82 | } else { |
83 | 83 | $ident = $sat; |
84 | - if (strpos($sat,'(')) $satname = $sat; |
|
85 | - else $satname = str_replace(array(' '),'-',$sat); |
|
84 | + if (strpos($sat, '(')) $satname = $sat; |
|
85 | + else $satname = str_replace(array(' '), '-', $sat); |
|
86 | 86 | } |
87 | 87 | if (!isset($satname)) $satname = $sat; |
88 | 88 | $info = $Satellite->get_info(strtolower(trim($satname))); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | print '<div><span>'._("Orbit").'</span>'.$info['orbit'].'</div>'; |
146 | 146 | } |
147 | 147 | if ($info['launch_date'] != '') { |
148 | - print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d',strtotime($info['launch_date'])).'</div>'; |
|
148 | + print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d', strtotime($info['launch_date'])).'</div>'; |
|
149 | 149 | } |
150 | 150 | if ($info['launch_site'] != '') { |
151 | 151 | print '<div><span>'._("Launch Site").'</span>'.$info['launch_site'].'</div>'; |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | |
21 | 21 | $spotter_array = array(); |
22 | 22 | if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') { |
23 | - $sattypes = explode(',',$_COOKIE['sattypes']); |
|
23 | + $sattypes = explode(',', $_COOKIE['sattypes']); |
|
24 | 24 | foreach ($sattypes as $sattype) { |
25 | - $spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array); |
|
25 | + $spotter_array = array_merge($Satellite->position_all_type($sattype, $timeb - $globalLiveInterval, $timeb), $spotter_array); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss']) { |
29 | - $spotter_array = array_merge($Satellite->position('ISS (ZARYA)',time()-$globalLiveInterval,time()),$spotter_array); |
|
30 | - $spotter_array = array_merge($Satellite->position('TIANGONG 1',time()-$globalLiveInterval,time()),$spotter_array); |
|
31 | - $spotter_array = array_merge($Satellite->position('TIANGONG-2',time()-$globalLiveInterval,time()),$spotter_array); |
|
29 | + $spotter_array = array_merge($Satellite->position('ISS (ZARYA)', time() - $globalLiveInterval, time()), $spotter_array); |
|
30 | + $spotter_array = array_merge($Satellite->position('TIANGONG 1', time() - $globalLiveInterval, time()), $spotter_array); |
|
31 | + $spotter_array = array_merge($Satellite->position('TIANGONG-2', time() - $globalLiveInterval, time()), $spotter_array); |
|
32 | 32 | } |
33 | -$spotter_array = array_unique($spotter_array,SORT_REGULAR); |
|
33 | +$spotter_array = array_unique($spotter_array, SORT_REGULAR); |
|
34 | 34 | /* |
35 | 35 | $modelsdb = array(); |
36 | 36 | if (file_exists('models/space/space_modelsdb')) { |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
55 | 55 | |
56 | 56 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
57 | -$output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
|
57 | +$output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
|
58 | 58 | //$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
59 | 59 | |
60 | 60 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
61 | 61 | $output .= '},'; |
62 | 62 | if (!empty($spotter_array) && is_array($spotter_array)) |
63 | 63 | { |
64 | - foreach($spotter_array as $spotter_item) |
|
64 | + foreach ($spotter_array as $spotter_item) |
|
65 | 65 | { |
66 | 66 | $j++; |
67 | 67 | date_default_timezone_set('UTC'); |
@@ -115,23 +115,23 @@ discard block |
||
115 | 115 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubiesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
116 | 116 | } elseif ($spotter_item['name'] == 'TERRA') { |
117 | 117 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/terra.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
118 | - } elseif (strpos($spotter_item['name'],'O3B') !== false) { |
|
118 | + } elseif (strpos($spotter_item['name'], 'O3B') !== false) { |
|
119 | 119 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/o3b.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
120 | - } elseif (strpos($spotter_item['name'],'GLOBALSTAR') !== false) { |
|
120 | + } elseif (strpos($spotter_item['name'], 'GLOBALSTAR') !== false) { |
|
121 | 121 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/globalstar.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
122 | - } elseif (strpos($spotter_item['name'],'GPS') !== false) { |
|
122 | + } elseif (strpos($spotter_item['name'], 'GPS') !== false) { |
|
123 | 123 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/gps.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
124 | - } elseif (strpos($spotter_item['name'],'GENESIS') !== false) { |
|
124 | + } elseif (strpos($spotter_item['name'], 'GENESIS') !== false) { |
|
125 | 125 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/genesis.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
126 | - } elseif (strpos($spotter_item['name'],'OSCAR 7') !== false) { |
|
126 | + } elseif (strpos($spotter_item['name'], 'OSCAR 7') !== false) { |
|
127 | 127 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/oscar7.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
128 | - } elseif (strpos($spotter_item['name'],'FLOCK') !== false) { |
|
128 | + } elseif (strpos($spotter_item['name'], 'FLOCK') !== false) { |
|
129 | 129 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
130 | - } elseif (strpos($spotter_item['name'],'PLEIADES') !== false) { |
|
130 | + } elseif (strpos($spotter_item['name'], 'PLEIADES') !== false) { |
|
131 | 131 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/pleiades.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
132 | - } elseif (strpos($spotter_item['name'],'DUCHIFAT') !== false) { |
|
132 | + } elseif (strpos($spotter_item['name'], 'DUCHIFAT') !== false) { |
|
133 | 133 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/duchifat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
134 | - } elseif (strpos($spotter_item['name'],'FORMOSAT-2') !== false) { |
|
134 | + } elseif (strpos($spotter_item['name'], 'FORMOSAT-2') !== false) { |
|
135 | 135 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/formosat2.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
136 | 136 | } elseif ($spotter_item['type'] == 'iridium') { |
137 | 137 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/iridium.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
154 | 154 | $output .= '"interpolationAlgorithm":"HERMITE","interpolationDegree":3,'; |
155 | 155 | $output .= '"cartographicDegrees": ['; |
156 | - $output .= '"'.date("c",$spotter_item['timestamp']).'", '; |
|
156 | + $output .= '"'.date("c", $spotter_item['timestamp']).'", '; |
|
157 | 157 | $output .= $spotter_item['longitude'].', '; |
158 | 158 | $output .= $spotter_item['latitude'].', '; |
159 | 159 | $output .= $spotter_item['altitude']*1000; |
160 | 160 | $orientation = '"orientation" : { '; |
161 | 161 | $orientation .= '"unitQuaternion": ['; |
162 | 162 | } else { |
163 | - $output .= ',"'.date("c",$spotter_item['timestamp']).'", '; |
|
163 | + $output .= ',"'.date("c", $spotter_item['timestamp']).'", '; |
|
164 | 164 | $output .= $spotter_item['longitude'].', '; |
165 | 165 | $output .= $spotter_item['latitude'].', '; |
166 | 166 | $output .= $spotter_item['altitude']*1000; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | require_once(dirname(__FILE__).'/class.create_db.php'); |
11 | 11 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
12 | 12 | require_once(dirname(__FILE__).'/class.settings.php'); |
13 | -$title="Install"; |
|
13 | +$title = "Install"; |
|
14 | 14 | require(dirname(__FILE__).'/../require/settings.php'); |
15 | 15 | require(dirname(__FILE__).'/header.php'); |
16 | 16 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | if (!extension_loaded('curl')) { |
70 | 70 | $error[] = "Curl is not loaded."; |
71 | 71 | } |
72 | -if(function_exists('apache_get_modules') ){ |
|
73 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
72 | +if (function_exists('apache_get_modules')) { |
|
73 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
74 | 74 | $error[] = "mod_rewrite is not available."; |
75 | 75 | } |
76 | 76 | /* |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
87 | 87 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
88 | 88 | if (function_exists('get_headers')) { |
89 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
90 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
89 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
90 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
91 | 91 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
92 | 92 | } |
93 | 93 | } |
@@ -454,13 +454,13 @@ discard block |
||
454 | 454 | ?> |
455 | 455 | <tr> |
456 | 456 | <?php |
457 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
457 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
458 | 458 | ?> |
459 | 459 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
460 | 460 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
461 | 461 | <?php |
462 | 462 | } else { |
463 | - $hostport = explode(':',$source['host']); |
|
463 | + $hostport = explode(':', $source['host']); |
|
464 | 464 | if (isset($hostport[1])) { |
465 | 465 | $host = $hostport[0]; |
466 | 466 | $port = $hostport[1]; |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | <select name="timezones[]" id="timezones"> |
508 | 508 | <?php |
509 | 509 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
510 | - foreach($timezonelist as $timezones){ |
|
510 | + foreach ($timezonelist as $timezones) { |
|
511 | 511 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
512 | 512 | print '<option selected>'.$timezones.'</option>'; |
513 | 513 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | <select name="timezones[]" id="timezones"> |
560 | 560 | <?php |
561 | 561 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
562 | - foreach($timezonelist as $timezones){ |
|
562 | + foreach ($timezonelist as $timezones) { |
|
563 | 563 | if ($timezones == 'UTC') { |
564 | 564 | print '<option selected>'.$timezones.'</option>'; |
565 | 565 | } else print '<option>'.$timezones.'</option>'; |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | <br /> |
877 | 877 | <p> |
878 | 878 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
879 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
879 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
880 | 880 | </p> |
881 | 881 | <br /> |
882 | 882 | <p> |
@@ -932,14 +932,14 @@ discard block |
||
932 | 932 | $error = ''; |
933 | 933 | |
934 | 934 | if (isset($_POST['dbtype'])) { |
935 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
936 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
937 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
938 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
939 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
940 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
941 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
942 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
935 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
936 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
937 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
938 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
939 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
940 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
941 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
942 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
943 | 943 | |
944 | 944 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
945 | 945 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -959,49 +959,49 @@ discard block |
||
959 | 959 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
960 | 960 | */ |
961 | 961 | |
962 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
962 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
963 | 963 | |
964 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
965 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
966 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
967 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
968 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
964 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
965 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
966 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
967 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
968 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
969 | 969 | |
970 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
971 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
972 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
973 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
974 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
975 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
976 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
977 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
978 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
979 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
970 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
971 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
972 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
973 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
974 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
975 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
976 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
977 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
978 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
979 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
980 | 980 | |
981 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
982 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
983 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
984 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
985 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
986 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
981 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
982 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
983 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
984 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
985 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
986 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
987 | 987 | |
988 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
989 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
988 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
989 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
990 | 990 | |
991 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
992 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
993 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
991 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
992 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
993 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
994 | 994 | |
995 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
995 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
996 | 996 | if ($acars == 'acars') { |
997 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
997 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
998 | 998 | } else { |
999 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
999 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1003 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1004 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1002 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1003 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1004 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1005 | 1005 | |
1006 | 1006 | $source_name = $_POST['source_name']; |
1007 | 1007 | $source_latitude = $_POST['source_latitude']; |
@@ -1015,8 +1015,8 @@ discard block |
||
1015 | 1015 | |
1016 | 1016 | $sources = array(); |
1017 | 1017 | foreach ($source_name as $keys => $name) { |
1018 | - 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]); |
|
1019 | - 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]); |
|
1018 | + 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]); |
|
1019 | + 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]); |
|
1020 | 1020 | } |
1021 | 1021 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1022 | 1022 | |
@@ -1029,27 +1029,27 @@ discard block |
||
1029 | 1029 | $sbsurl = $_POST['sbsurl']; |
1030 | 1030 | */ |
1031 | 1031 | |
1032 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1033 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1034 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1035 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1036 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1037 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1038 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1039 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1032 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1033 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1034 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1035 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1036 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1037 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1038 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1039 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1040 | 1040 | |
1041 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1042 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1043 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1044 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1045 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1046 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1047 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1048 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1049 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1050 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1051 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1052 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1041 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1042 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1043 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1044 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1045 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1046 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1047 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1048 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1049 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1050 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1051 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1052 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1053 | 1053 | |
1054 | 1054 | /* |
1055 | 1055 | $globalSBS1Hosts = array(); |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | } |
1066 | 1066 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1067 | 1067 | */ |
1068 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1068 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1069 | 1069 | $host = $_POST['host']; |
1070 | 1070 | $port = $_POST['port']; |
1071 | 1071 | $name = $_POST['name']; |
@@ -1082,104 +1082,104 @@ discard block |
||
1082 | 1082 | else $cov = 'FALSE'; |
1083 | 1083 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1084 | 1084 | else $arch = 'FALSE'; |
1085 | - if (strpos($format[$key],'_callback')) { |
|
1086 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1085 | + if (strpos($format[$key], '_callback')) { |
|
1086 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1087 | 1087 | } elseif ($h != '' || $name[$key] != '') { |
1088 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1088 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1089 | 1089 | } |
1090 | 1090 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1091 | 1091 | } |
1092 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1092 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1093 | 1093 | |
1094 | 1094 | /* |
1095 | 1095 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1096 | 1096 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1097 | 1097 | */ |
1098 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1099 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1100 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1098 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1099 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1100 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1101 | 1101 | |
1102 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1103 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1102 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1103 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1104 | 1104 | |
1105 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1106 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1105 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1106 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1107 | 1107 | |
1108 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1109 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1110 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1111 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1108 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1109 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1110 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1111 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1112 | 1112 | |
1113 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1114 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1115 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1113 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1114 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1115 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1116 | 1116 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1117 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1118 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1117 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1118 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1119 | 1119 | |
1120 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1121 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1122 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1123 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1124 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1125 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1126 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1127 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1120 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1121 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1122 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1123 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1124 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1125 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1126 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1127 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1128 | 1128 | |
1129 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1130 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1129 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1130 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1131 | 1131 | |
1132 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1133 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1132 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1133 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1134 | 1134 | |
1135 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1135 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1136 | 1136 | if ($archiveyear == "archiveyear") { |
1137 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1137 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1138 | 1138 | } else { |
1139 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1139 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1140 | 1140 | } |
1141 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1142 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1143 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1144 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1141 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1142 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1143 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1144 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1145 | 1145 | |
1146 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1147 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1148 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1149 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1146 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1147 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1148 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1149 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1150 | 1150 | |
1151 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1152 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1153 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1151 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1152 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1153 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1154 | 1154 | |
1155 | 1155 | // Create in settings.php keys not yet configurable if not already here |
1156 | 1156 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1157 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1157 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1158 | 1158 | |
1159 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1159 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1160 | 1160 | if ($resetyearstats == 'resetyearstats') { |
1161 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1161 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1162 | 1162 | } else { |
1163 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1163 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1166 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1167 | 1167 | if ($archive == 'archive') { |
1168 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1168 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1169 | 1169 | } else { |
1170 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1170 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1171 | 1171 | } |
1172 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1172 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1173 | 1173 | if ($daemon == 'daemon') { |
1174 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1174 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1175 | 1175 | } else { |
1176 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1176 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1177 | 1177 | } |
1178 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1178 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1179 | 1179 | if ($schedules == 'schedules') { |
1180 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1180 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1181 | 1181 | } else { |
1182 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1182 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | /* |
@@ -1190,227 +1190,227 @@ discard block |
||
1190 | 1190 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1191 | 1191 | } |
1192 | 1192 | */ |
1193 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1194 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1195 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1196 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1197 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1193 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1194 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1195 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1196 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1197 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1198 | 1198 | $va = false; |
1199 | 1199 | if ($globalivao == 'ivao') { |
1200 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1200 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1201 | 1201 | $va = true; |
1202 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1202 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1203 | 1203 | if ($globalvatsim == 'vatsim') { |
1204 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1204 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1205 | 1205 | $va = true; |
1206 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1206 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1207 | 1207 | if ($globalphpvms == 'phpvms') { |
1208 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1208 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1209 | 1209 | $va = true; |
1210 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1210 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1211 | 1211 | if ($globalvam == 'vam') { |
1212 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1212 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1213 | 1213 | $va = true; |
1214 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1214 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1215 | 1215 | if ($va) { |
1216 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1217 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1216 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1217 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1218 | 1218 | if ($globalva == 'va' || $va) { |
1219 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1220 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1219 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1220 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1221 | 1221 | } else { |
1222 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1223 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1224 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1222 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1223 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1224 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | |
1228 | 1228 | |
1229 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1229 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1230 | 1230 | if ($notam == 'notam') { |
1231 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1231 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1232 | 1232 | } else { |
1233 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1233 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1234 | 1234 | } |
1235 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1235 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1236 | 1236 | if ($owner == 'owner') { |
1237 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1237 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1238 | 1238 | } else { |
1239 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1239 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1240 | 1240 | } |
1241 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1241 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1242 | 1242 | if ($map3d == 'map3d') { |
1243 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1243 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1244 | 1244 | } else { |
1245 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1245 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1246 | 1246 | } |
1247 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1247 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1248 | 1248 | if ($crash == 'crash') { |
1249 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1249 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1250 | 1250 | } else { |
1251 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1251 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1252 | 1252 | } |
1253 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1253 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1254 | 1254 | if ($mapsatellites == 'mapsatellites') { |
1255 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1255 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1256 | 1256 | } else { |
1257 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1257 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1258 | 1258 | } |
1259 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1259 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1260 | 1260 | if ($map3ddefault == 'map3ddefault') { |
1261 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1261 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1262 | 1262 | } else { |
1263 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1263 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1264 | 1264 | } |
1265 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1265 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1266 | 1266 | if ($translate == 'translate') { |
1267 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1267 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1268 | 1268 | } else { |
1269 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1269 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1270 | 1270 | } |
1271 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1271 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1272 | 1272 | if ($realairlines == 'realairlines') { |
1273 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1273 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1274 | 1274 | } else { |
1275 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1275 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1276 | 1276 | } |
1277 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1277 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1278 | 1278 | if ($estimation == 'estimation') { |
1279 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1279 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1280 | 1280 | } else { |
1281 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1281 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1282 | 1282 | } |
1283 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1283 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1284 | 1284 | if ($metar == 'metar') { |
1285 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1285 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1286 | 1286 | } else { |
1287 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1287 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1288 | 1288 | } |
1289 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1289 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1290 | 1290 | if ($metarcycle == 'metarcycle') { |
1291 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1291 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1292 | 1292 | } else { |
1293 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1293 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1294 | 1294 | } |
1295 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1295 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1296 | 1296 | if ($fork == 'fork') { |
1297 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1297 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1298 | 1298 | } else { |
1299 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1299 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1300 | 1300 | } |
1301 | 1301 | |
1302 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1302 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1303 | 1303 | if ($colormap == 'colormap') { |
1304 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1304 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1305 | 1305 | } else { |
1306 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1306 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1307 | 1307 | } |
1308 | 1308 | |
1309 | 1309 | if (isset($_POST['aircrafticoncolor'])) { |
1310 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1311 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1310 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1311 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1315 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1314 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1315 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1316 | 1316 | |
1317 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1318 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1319 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1320 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1321 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1322 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1317 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1318 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1319 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1320 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1321 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1322 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1323 | 1323 | |
1324 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1324 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1325 | 1325 | if ($mappopup == 'mappopup') { |
1326 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1326 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1327 | 1327 | } else { |
1328 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1328 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1329 | 1329 | } |
1330 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1330 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1331 | 1331 | if ($airportpopup == 'airportpopup') { |
1332 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1332 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1333 | 1333 | } else { |
1334 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1334 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1335 | 1335 | } |
1336 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1336 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1337 | 1337 | if ($maphistory == 'maphistory') { |
1338 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1338 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1339 | 1339 | } else { |
1340 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1340 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1341 | 1341 | } |
1342 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1342 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1343 | 1343 | if ($maptooltip == 'maptooltip') { |
1344 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1344 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1345 | 1345 | } else { |
1346 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1346 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1347 | 1347 | } |
1348 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1348 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1349 | 1349 | if ($flightroute == 'flightroute') { |
1350 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1350 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1351 | 1351 | } else { |
1352 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1352 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1353 | 1353 | } |
1354 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1354 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1355 | 1355 | if ($flightremainingroute == 'flightremainingroute') { |
1356 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1356 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1357 | 1357 | } else { |
1358 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1358 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1359 | 1359 | } |
1360 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1360 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1361 | 1361 | if ($allflights == 'allflights') { |
1362 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1362 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1363 | 1363 | } else { |
1364 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1364 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1365 | 1365 | } |
1366 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1366 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1367 | 1367 | if ($bbox == 'bbox') { |
1368 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1368 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1369 | 1369 | } else { |
1370 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1370 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1371 | 1371 | } |
1372 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1372 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1373 | 1373 | if ($groundaltitude == 'groundaltitude') { |
1374 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1374 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1375 | 1375 | } else { |
1376 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1376 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1377 | 1377 | } |
1378 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1378 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1379 | 1379 | if ($waypoints == 'waypoints') { |
1380 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1380 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1381 | 1381 | } else { |
1382 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1382 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1383 | 1383 | } |
1384 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1384 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1385 | 1385 | if ($geoid == 'geoid') { |
1386 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1386 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1387 | 1387 | } else { |
1388 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1388 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1389 | 1389 | } |
1390 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1391 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1390 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1391 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1392 | 1392 | |
1393 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1393 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1394 | 1394 | if ($noairlines == 'noairlines') { |
1395 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1395 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1396 | 1396 | } else { |
1397 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1397 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1398 | 1398 | } |
1399 | 1399 | |
1400 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1400 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1401 | 1401 | |
1402 | 1402 | // Set some defaults values... |
1403 | 1403 | if (!isset($globalAircraftImageSources)) { |
1404 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1405 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1404 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1405 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | if (!isset($globalSchedulesSources)) { |
1409 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1410 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1409 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1410 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1413 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1414 | 1414 | |
1415 | 1415 | if ($error == '') settings::modify_settings($settings); |
1416 | 1416 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -14,11 +14,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
788 | 788 | try { |
789 | 789 | $sth = $Connection->db->prepare($query); |
790 | 790 | $sth->execute(); |
791 | - } catch(PDOException $e) { |
|
791 | + } catch (PDOException $e) { |
|
792 | 792 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
793 | 793 | } |
794 | 794 | return $error; |
@@ -815,17 +815,17 @@ discard block |
||
815 | 815 | try { |
816 | 816 | $sth = $Connection->db->prepare($query); |
817 | 817 | $sth->execute(); |
818 | - } catch(PDOException $e) { |
|
818 | + } catch (PDOException $e) { |
|
819 | 819 | return "error (create index on spotter_archive) : ".$e->getMessage()."\n"; |
820 | 820 | } |
821 | 821 | } |
822 | - if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) { |
|
822 | + if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) { |
|
823 | 823 | // Add aircraft_manufacturer to stats_aircraft |
824 | 824 | $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
825 | 825 | try { |
826 | 826 | $sth = $Connection->db->prepare($query); |
827 | 827 | $sth->execute(); |
828 | - } catch(PDOException $e) { |
|
828 | + } catch (PDOException $e) { |
|
829 | 829 | return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n"; |
830 | 830 | } |
831 | 831 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | try { |
835 | 835 | $sth = $Connection->db->prepare($query); |
836 | 836 | $sth->execute(); |
837 | - } catch(PDOException $e) { |
|
837 | + } catch (PDOException $e) { |
|
838 | 838 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
839 | 839 | } |
840 | 840 | return $error; |
@@ -850,23 +850,23 @@ discard block |
||
850 | 850 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
851 | 851 | } |
852 | 852 | if ($error != '') return 'Import airlines.sql : '.$error; |
853 | - if (!$Connection->checkColumnName('airlines','forsource')) { |
|
853 | + if (!$Connection->checkColumnName('airlines', 'forsource')) { |
|
854 | 854 | // Add forsource to airlines |
855 | 855 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
856 | 856 | try { |
857 | 857 | $sth = $Connection->db->prepare($query); |
858 | 858 | $sth->execute(); |
859 | - } catch(PDOException $e) { |
|
859 | + } catch (PDOException $e) { |
|
860 | 860 | return "error (add forsource column) : ".$e->getMessage()."\n"; |
861 | 861 | } |
862 | 862 | } |
863 | - if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) { |
|
863 | + if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) { |
|
864 | 864 | // Add forsource to airlines |
865 | 865 | $query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
866 | 866 | try { |
867 | 867 | $sth = $Connection->db->prepare($query); |
868 | 868 | $sth->execute(); |
869 | - } catch(PDOException $e) { |
|
869 | + } catch (PDOException $e) { |
|
870 | 870 | return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n"; |
871 | 871 | } |
872 | 872 | // Add unique key |
@@ -878,17 +878,17 @@ discard block |
||
878 | 878 | try { |
879 | 879 | $sth = $Connection->db->prepare($query); |
880 | 880 | $sth->execute(); |
881 | - } catch(PDOException $e) { |
|
881 | + } catch (PDOException $e) { |
|
882 | 882 | return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n"; |
883 | 883 | } |
884 | 884 | } |
885 | - if (!$Connection->checkColumnName('stats_airport','stats_airline')) { |
|
885 | + if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) { |
|
886 | 886 | // Add forsource to airlines |
887 | 887 | $query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
888 | 888 | try { |
889 | 889 | $sth = $Connection->db->prepare($query); |
890 | 890 | $sth->execute(); |
891 | - } catch(PDOException $e) { |
|
891 | + } catch (PDOException $e) { |
|
892 | 892 | return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n"; |
893 | 893 | } |
894 | 894 | // Add unique key |
@@ -900,17 +900,17 @@ discard block |
||
900 | 900 | try { |
901 | 901 | $sth = $Connection->db->prepare($query); |
902 | 902 | $sth->execute(); |
903 | - } catch(PDOException $e) { |
|
903 | + } catch (PDOException $e) { |
|
904 | 904 | return "error (add unique key in stats_airport) : ".$e->getMessage()."\n"; |
905 | 905 | } |
906 | 906 | } |
907 | - if (!$Connection->checkColumnName('stats_country','stats_airline')) { |
|
907 | + if (!$Connection->checkColumnName('stats_country', 'stats_airline')) { |
|
908 | 908 | // Add forsource to airlines |
909 | 909 | $query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
910 | 910 | try { |
911 | 911 | $sth = $Connection->db->prepare($query); |
912 | 912 | $sth->execute(); |
913 | - } catch(PDOException $e) { |
|
913 | + } catch (PDOException $e) { |
|
914 | 914 | return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n"; |
915 | 915 | } |
916 | 916 | // Add unique key |
@@ -922,36 +922,36 @@ discard block |
||
922 | 922 | try { |
923 | 923 | $sth = $Connection->db->prepare($query); |
924 | 924 | $sth->execute(); |
925 | - } catch(PDOException $e) { |
|
925 | + } catch (PDOException $e) { |
|
926 | 926 | return "error (add unique key in stats_airline) : ".$e->getMessage()."\n"; |
927 | 927 | } |
928 | 928 | } |
929 | - if (!$Connection->checkColumnName('stats_flight','stats_airline')) { |
|
929 | + if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) { |
|
930 | 930 | // Add forsource to airlines |
931 | 931 | $query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
932 | 932 | try { |
933 | 933 | $sth = $Connection->db->prepare($query); |
934 | 934 | $sth->execute(); |
935 | - } catch(PDOException $e) { |
|
935 | + } catch (PDOException $e) { |
|
936 | 936 | return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n"; |
937 | 937 | } |
938 | 938 | } |
939 | - if (!$Connection->checkColumnName('stats','stats_airline')) { |
|
939 | + if (!$Connection->checkColumnName('stats', 'stats_airline')) { |
|
940 | 940 | // Add forsource to airlines |
941 | 941 | $query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
942 | 942 | try { |
943 | 943 | $sth = $Connection->db->prepare($query); |
944 | 944 | $sth->execute(); |
945 | - } catch(PDOException $e) { |
|
945 | + } catch (PDOException $e) { |
|
946 | 946 | return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n"; |
947 | 947 | } |
948 | - if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) { |
|
948 | + if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) { |
|
949 | 949 | // Add unique key |
950 | 950 | $query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);"; |
951 | 951 | try { |
952 | 952 | $sth = $Connection->db->prepare($query); |
953 | 953 | $sth->execute(); |
954 | - } catch(PDOException $e) { |
|
954 | + } catch (PDOException $e) { |
|
955 | 955 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
956 | 956 | } |
957 | 957 | } else { |
@@ -964,18 +964,18 @@ discard block |
||
964 | 964 | try { |
965 | 965 | $sth = $Connection->db->prepare($query); |
966 | 966 | $sth->execute(); |
967 | - } catch(PDOException $e) { |
|
967 | + } catch (PDOException $e) { |
|
968 | 968 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
969 | 969 | } |
970 | 970 | } |
971 | 971 | } |
972 | - if (!$Connection->checkColumnName('stats_registration','stats_airline')) { |
|
972 | + if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) { |
|
973 | 973 | // Add forsource to airlines |
974 | 974 | $query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
975 | 975 | try { |
976 | 976 | $sth = $Connection->db->prepare($query); |
977 | 977 | $sth->execute(); |
978 | - } catch(PDOException $e) { |
|
978 | + } catch (PDOException $e) { |
|
979 | 979 | return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n"; |
980 | 980 | } |
981 | 981 | // Add unique key |
@@ -987,17 +987,17 @@ discard block |
||
987 | 987 | try { |
988 | 988 | $sth = $Connection->db->prepare($query); |
989 | 989 | $sth->execute(); |
990 | - } catch(PDOException $e) { |
|
990 | + } catch (PDOException $e) { |
|
991 | 991 | return "error (add unique key in stats_registration) : ".$e->getMessage()."\n"; |
992 | 992 | } |
993 | 993 | } |
994 | - if (!$Connection->checkColumnName('stats_callsign','filter_name')) { |
|
994 | + if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) { |
|
995 | 995 | // Add forsource to airlines |
996 | 996 | $query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
997 | 997 | try { |
998 | 998 | $sth = $Connection->db->prepare($query); |
999 | 999 | $sth->execute(); |
1000 | - } catch(PDOException $e) { |
|
1000 | + } catch (PDOException $e) { |
|
1001 | 1001 | return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n"; |
1002 | 1002 | } |
1003 | 1003 | // Add unique key |
@@ -1009,17 +1009,17 @@ discard block |
||
1009 | 1009 | try { |
1010 | 1010 | $sth = $Connection->db->prepare($query); |
1011 | 1011 | $sth->execute(); |
1012 | - } catch(PDOException $e) { |
|
1012 | + } catch (PDOException $e) { |
|
1013 | 1013 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
1014 | 1014 | } |
1015 | 1015 | } |
1016 | - if (!$Connection->checkColumnName('stats_airline','filter_name')) { |
|
1016 | + if (!$Connection->checkColumnName('stats_airline', 'filter_name')) { |
|
1017 | 1017 | // Add forsource to airlines |
1018 | 1018 | $query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1019 | 1019 | try { |
1020 | 1020 | $sth = $Connection->db->prepare($query); |
1021 | 1021 | $sth->execute(); |
1022 | - } catch(PDOException $e) { |
|
1022 | + } catch (PDOException $e) { |
|
1023 | 1023 | return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n"; |
1024 | 1024 | } |
1025 | 1025 | // Add unique key |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | try { |
1032 | 1032 | $sth = $Connection->db->prepare($query); |
1033 | 1033 | $sth->execute(); |
1034 | - } catch(PDOException $e) { |
|
1034 | + } catch (PDOException $e) { |
|
1035 | 1035 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
1036 | 1036 | } |
1037 | 1037 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | try { |
1041 | 1041 | $sth = $Connection->db->prepare($query); |
1042 | 1042 | $sth->execute(); |
1043 | - } catch(PDOException $e) { |
|
1043 | + } catch (PDOException $e) { |
|
1044 | 1044 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1045 | 1045 | } |
1046 | 1046 | return $error; |
@@ -1050,13 +1050,13 @@ discard block |
||
1050 | 1050 | global $globalDBdriver; |
1051 | 1051 | $Connection = new Connection(); |
1052 | 1052 | $error = ''; |
1053 | - if (!$Connection->checkColumnName('stats_owner','stats_airline')) { |
|
1053 | + if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) { |
|
1054 | 1054 | // Add forsource to airlines |
1055 | 1055 | $query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1056 | 1056 | try { |
1057 | 1057 | $sth = $Connection->db->prepare($query); |
1058 | 1058 | $sth->execute(); |
1059 | - } catch(PDOException $e) { |
|
1059 | + } catch (PDOException $e) { |
|
1060 | 1060 | return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n"; |
1061 | 1061 | } |
1062 | 1062 | // Add unique key |
@@ -1068,17 +1068,17 @@ discard block |
||
1068 | 1068 | try { |
1069 | 1069 | $sth = $Connection->db->prepare($query); |
1070 | 1070 | $sth->execute(); |
1071 | - } catch(PDOException $e) { |
|
1071 | + } catch (PDOException $e) { |
|
1072 | 1072 | return "error (add unique key in stats_owner) : ".$e->getMessage()."\n"; |
1073 | 1073 | } |
1074 | 1074 | } |
1075 | - if (!$Connection->checkColumnName('stats_pilot','stats_airline')) { |
|
1075 | + if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) { |
|
1076 | 1076 | // Add forsource to airlines |
1077 | 1077 | $query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
1078 | 1078 | try { |
1079 | 1079 | $sth = $Connection->db->prepare($query); |
1080 | 1080 | $sth->execute(); |
1081 | - } catch(PDOException $e) { |
|
1081 | + } catch (PDOException $e) { |
|
1082 | 1082 | return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n"; |
1083 | 1083 | } |
1084 | 1084 | // Add unique key |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | try { |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | 1092 | $sth->execute(); |
1093 | - } catch(PDOException $e) { |
|
1093 | + } catch (PDOException $e) { |
|
1094 | 1094 | return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n"; |
1095 | 1095 | } |
1096 | 1096 | } |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | try { |
1099 | 1099 | $sth = $Connection->db->prepare($query); |
1100 | 1100 | $sth->execute(); |
1101 | - } catch(PDOException $e) { |
|
1101 | + } catch (PDOException $e) { |
|
1102 | 1102 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1103 | 1103 | } |
1104 | 1104 | return $error; |
@@ -1108,12 +1108,12 @@ discard block |
||
1108 | 1108 | global $globalDBdriver; |
1109 | 1109 | $Connection = new Connection(); |
1110 | 1110 | $error = ''; |
1111 | - if (!$Connection->checkColumnName('atc','format_source')) { |
|
1111 | + if (!$Connection->checkColumnName('atc', 'format_source')) { |
|
1112 | 1112 | $query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL"; |
1113 | 1113 | try { |
1114 | 1114 | $sth = $Connection->db->prepare($query); |
1115 | 1115 | $sth->execute(); |
1116 | - } catch(PDOException $e) { |
|
1116 | + } catch (PDOException $e) { |
|
1117 | 1117 | return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n"; |
1118 | 1118 | } |
1119 | 1119 | } |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | try { |
1122 | 1122 | $sth = $Connection->db->prepare($query); |
1123 | 1123 | $sth->execute(); |
1124 | - } catch(PDOException $e) { |
|
1124 | + } catch (PDOException $e) { |
|
1125 | 1125 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1126 | 1126 | } |
1127 | 1127 | return $error; |
@@ -1131,13 +1131,13 @@ discard block |
||
1131 | 1131 | global $globalDBdriver; |
1132 | 1132 | $Connection = new Connection(); |
1133 | 1133 | $error = ''; |
1134 | - if (!$Connection->checkColumnName('stats_pilot','format_source')) { |
|
1134 | + if (!$Connection->checkColumnName('stats_pilot', 'format_source')) { |
|
1135 | 1135 | // Add forsource to airlines |
1136 | 1136 | $query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''"; |
1137 | 1137 | try { |
1138 | 1138 | $sth = $Connection->db->prepare($query); |
1139 | 1139 | $sth->execute(); |
1140 | - } catch(PDOException $e) { |
|
1140 | + } catch (PDOException $e) { |
|
1141 | 1141 | return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n"; |
1142 | 1142 | } |
1143 | 1143 | // Add unique key |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | try { |
1150 | 1150 | $sth = $Connection->db->prepare($query); |
1151 | 1151 | $sth->execute(); |
1152 | - } catch(PDOException $e) { |
|
1152 | + } catch (PDOException $e) { |
|
1153 | 1153 | return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n"; |
1154 | 1154 | } |
1155 | 1155 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | try { |
1158 | 1158 | $sth = $Connection->db->prepare($query); |
1159 | 1159 | $sth->execute(); |
1160 | - } catch(PDOException $e) { |
|
1160 | + } catch (PDOException $e) { |
|
1161 | 1161 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1162 | 1162 | } |
1163 | 1163 | return $error; |
@@ -1167,23 +1167,23 @@ discard block |
||
1167 | 1167 | global $globalDBdriver; |
1168 | 1168 | $Connection = new Connection(); |
1169 | 1169 | $error = ''; |
1170 | - if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) { |
|
1170 | + if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) { |
|
1171 | 1171 | // Add unique key |
1172 | 1172 | $query = "alter table spotter_live add index(latitude,longitude)"; |
1173 | 1173 | try { |
1174 | 1174 | $sth = $Connection->db->prepare($query); |
1175 | 1175 | $sth->execute(); |
1176 | - } catch(PDOException $e) { |
|
1176 | + } catch (PDOException $e) { |
|
1177 | 1177 | return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n"; |
1178 | 1178 | } |
1179 | 1179 | } |
1180 | - if (!$Connection->checkColumnName('aircraft','mfr')) { |
|
1180 | + if (!$Connection->checkColumnName('aircraft', 'mfr')) { |
|
1181 | 1181 | // Add mfr to aircraft |
1182 | 1182 | $query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL"; |
1183 | 1183 | try { |
1184 | 1184 | $sth = $Connection->db->prepare($query); |
1185 | 1185 | $sth->execute(); |
1186 | - } catch(PDOException $e) { |
|
1186 | + } catch (PDOException $e) { |
|
1187 | 1187 | return "error (add mfr column in aircraft) : ".$e->getMessage()."\n"; |
1188 | 1188 | } |
1189 | 1189 | } |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | try { |
1200 | 1200 | $sth = $Connection->db->prepare($query); |
1201 | 1201 | $sth->execute(); |
1202 | - } catch(PDOException $e) { |
|
1202 | + } catch (PDOException $e) { |
|
1203 | 1203 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1204 | 1204 | } |
1205 | 1205 | return $error; |
@@ -1209,13 +1209,13 @@ discard block |
||
1209 | 1209 | global $globalDBdriver; |
1210 | 1210 | $Connection = new Connection(); |
1211 | 1211 | $error = ''; |
1212 | - if ($Connection->checkColumnName('aircraft','mfr')) { |
|
1212 | + if ($Connection->checkColumnName('aircraft', 'mfr')) { |
|
1213 | 1213 | // drop mfr to aircraft |
1214 | 1214 | $query = "ALTER TABLE aircraft DROP COLUMN mfr"; |
1215 | 1215 | try { |
1216 | 1216 | $sth = $Connection->db->prepare($query); |
1217 | 1217 | $sth->execute(); |
1218 | - } catch(PDOException $e) { |
|
1218 | + } catch (PDOException $e) { |
|
1219 | 1219 | return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n"; |
1220 | 1220 | } |
1221 | 1221 | } |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | try { |
1232 | 1232 | $sth = $Connection->db->prepare($query); |
1233 | 1233 | $sth->execute(); |
1234 | - } catch(PDOException $e) { |
|
1234 | + } catch (PDOException $e) { |
|
1235 | 1235 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1236 | 1236 | } |
1237 | 1237 | return $error; |
@@ -1241,33 +1241,33 @@ discard block |
||
1241 | 1241 | global $globalDBdriver; |
1242 | 1242 | $Connection = new Connection(); |
1243 | 1243 | $error = ''; |
1244 | - if (!$Connection->indexExists('notam','ref_idx')) { |
|
1244 | + if (!$Connection->indexExists('notam', 'ref_idx')) { |
|
1245 | 1245 | // Add index key |
1246 | 1246 | $query = "create index ref_idx on notam (ref)"; |
1247 | 1247 | try { |
1248 | 1248 | $sth = $Connection->db->prepare($query); |
1249 | 1249 | $sth->execute(); |
1250 | - } catch(PDOException $e) { |
|
1250 | + } catch (PDOException $e) { |
|
1251 | 1251 | return "error (add index ref on notam) : ".$e->getMessage()."\n"; |
1252 | 1252 | } |
1253 | 1253 | } |
1254 | - if (!$Connection->indexExists('accidents','registration_idx')) { |
|
1254 | + if (!$Connection->indexExists('accidents', 'registration_idx')) { |
|
1255 | 1255 | // Add index key |
1256 | 1256 | $query = "create index registration_idx on accidents (registration)"; |
1257 | 1257 | try { |
1258 | 1258 | $sth = $Connection->db->prepare($query); |
1259 | 1259 | $sth->execute(); |
1260 | - } catch(PDOException $e) { |
|
1260 | + } catch (PDOException $e) { |
|
1261 | 1261 | return "error (add index registration on accidents) : ".$e->getMessage()."\n"; |
1262 | 1262 | } |
1263 | 1263 | } |
1264 | - if (!$Connection->indexExists('accidents','rdts')) { |
|
1264 | + if (!$Connection->indexExists('accidents', 'rdts')) { |
|
1265 | 1265 | // Add index key |
1266 | 1266 | $query = "create index rdts on accidents (registration,date,type,source)"; |
1267 | 1267 | try { |
1268 | 1268 | $sth = $Connection->db->prepare($query); |
1269 | 1269 | $sth->execute(); |
1270 | - } catch(PDOException $e) { |
|
1270 | + } catch (PDOException $e) { |
|
1271 | 1271 | return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n"; |
1272 | 1272 | } |
1273 | 1273 | } |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | try { |
1277 | 1277 | $sth = $Connection->db->prepare($query); |
1278 | 1278 | $sth->execute(); |
1279 | - } catch(PDOException $e) { |
|
1279 | + } catch (PDOException $e) { |
|
1280 | 1280 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1281 | 1281 | } |
1282 | 1282 | return $error; |
@@ -1286,23 +1286,23 @@ discard block |
||
1286 | 1286 | global $globalDBdriver; |
1287 | 1287 | $Connection = new Connection(); |
1288 | 1288 | $error = ''; |
1289 | - if (!$Connection->checkColumnName('accidents','airline_name')) { |
|
1289 | + if (!$Connection->checkColumnName('accidents', 'airline_name')) { |
|
1290 | 1290 | // Add airline_name to accidents |
1291 | 1291 | $query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL"; |
1292 | 1292 | try { |
1293 | 1293 | $sth = $Connection->db->prepare($query); |
1294 | 1294 | $sth->execute(); |
1295 | - } catch(PDOException $e) { |
|
1295 | + } catch (PDOException $e) { |
|
1296 | 1296 | return "error (add airline_name column in accidents) : ".$e->getMessage()."\n"; |
1297 | 1297 | } |
1298 | 1298 | } |
1299 | - if (!$Connection->checkColumnName('accidents','airline_icao')) { |
|
1299 | + if (!$Connection->checkColumnName('accidents', 'airline_icao')) { |
|
1300 | 1300 | // Add airline_icao to accidents |
1301 | 1301 | $query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL"; |
1302 | 1302 | try { |
1303 | 1303 | $sth = $Connection->db->prepare($query); |
1304 | 1304 | $sth->execute(); |
1305 | - } catch(PDOException $e) { |
|
1305 | + } catch (PDOException $e) { |
|
1306 | 1306 | return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n"; |
1307 | 1307 | } |
1308 | 1308 | } |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | try { |
1311 | 1311 | $sth = $Connection->db->prepare($query); |
1312 | 1312 | $sth->execute(); |
1313 | - } catch(PDOException $e) { |
|
1313 | + } catch (PDOException $e) { |
|
1314 | 1314 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1315 | 1315 | } |
1316 | 1316 | return $error; |
@@ -1320,13 +1320,13 @@ discard block |
||
1320 | 1320 | global $globalDBdriver, $globalVATSIM, $globalIVAO; |
1321 | 1321 | $Connection = new Connection(); |
1322 | 1322 | $error = ''; |
1323 | - if (!$Connection->checkColumnName('airlines','alliance')) { |
|
1323 | + if (!$Connection->checkColumnName('airlines', 'alliance')) { |
|
1324 | 1324 | // Add alliance to airlines |
1325 | 1325 | $query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL"; |
1326 | 1326 | try { |
1327 | 1327 | $sth = $Connection->db->prepare($query); |
1328 | 1328 | $sth->execute(); |
1329 | - } catch(PDOException $e) { |
|
1329 | + } catch (PDOException $e) { |
|
1330 | 1330 | return "error (add alliance column in airlines) : ".$e->getMessage()."\n"; |
1331 | 1331 | } |
1332 | 1332 | } |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | try { |
1354 | 1354 | $sth = $Connection->db->prepare($query); |
1355 | 1355 | $sth->execute(); |
1356 | - } catch(PDOException $e) { |
|
1356 | + } catch (PDOException $e) { |
|
1357 | 1357 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1358 | 1358 | } |
1359 | 1359 | return $error; |
@@ -1363,13 +1363,13 @@ discard block |
||
1363 | 1363 | global $globalDBdriver, $globalVATSIM, $globalIVAO; |
1364 | 1364 | $Connection = new Connection(); |
1365 | 1365 | $error = ''; |
1366 | - if (!$Connection->checkColumnName('airlines','ban_eu')) { |
|
1366 | + if (!$Connection->checkColumnName('airlines', 'ban_eu')) { |
|
1367 | 1367 | // Add ban_eu to airlines |
1368 | 1368 | $query = "ALTER TABLE airlines ADD ban_eu INTEGER NOT NULL DEFAULT '0'"; |
1369 | 1369 | try { |
1370 | 1370 | $sth = $Connection->db->prepare($query); |
1371 | 1371 | $sth->execute(); |
1372 | - } catch(PDOException $e) { |
|
1372 | + } catch (PDOException $e) { |
|
1373 | 1373 | return "error (add ban_eu column in airlines) : ".$e->getMessage()."\n"; |
1374 | 1374 | } |
1375 | 1375 | } |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | try { |
1378 | 1378 | $sth = $Connection->db->prepare($query); |
1379 | 1379 | $sth->execute(); |
1380 | - } catch(PDOException $e) { |
|
1380 | + } catch (PDOException $e) { |
|
1381 | 1381 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1382 | 1382 | } |
1383 | 1383 | return $error; |
@@ -1388,19 +1388,19 @@ discard block |
||
1388 | 1388 | $Connection = new Connection(); |
1389 | 1389 | $error = ''; |
1390 | 1390 | if ($globalDBdriver == 'mysql') { |
1391 | - if ($Connection->getColumnType('spotter_output','date') == 'TIMESTAMP' && $Connection->getColumnType('spotter_output','last_seen') != 'TIMESTAMP') { |
|
1391 | + if ($Connection->getColumnType('spotter_output', 'date') == 'TIMESTAMP' && $Connection->getColumnType('spotter_output', 'last_seen') != 'TIMESTAMP') { |
|
1392 | 1392 | $query = "ALTER TABLE spotter_output CHANGE date date TIMESTAMP NULL DEFAULT NULL"; |
1393 | 1393 | try { |
1394 | 1394 | $sth = $Connection->db->prepare($query); |
1395 | 1395 | $sth->execute(); |
1396 | - } catch(PDOException $e) { |
|
1396 | + } catch (PDOException $e) { |
|
1397 | 1397 | return "error (delete default timestamp spotter_output) : ".$e->getMessage()."\n"; |
1398 | 1398 | } |
1399 | 1399 | $query = "ALTER TABLE spotter_output MODIFY COLUMN last_seen timestamp not null default current_timestamp()"; |
1400 | 1400 | try { |
1401 | 1401 | $sth = $Connection->db->prepare($query); |
1402 | 1402 | $sth->execute(); |
1403 | - } catch(PDOException $e) { |
|
1403 | + } catch (PDOException $e) { |
|
1404 | 1404 | return "error (convert spotter_output last_seen to timestamp) : ".$e->getMessage()."\n"; |
1405 | 1405 | } |
1406 | 1406 | |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | try { |
1409 | 1409 | $sth = $Connection->db->prepare($query); |
1410 | 1410 | $sth->execute(); |
1411 | - } catch(PDOException $e) { |
|
1411 | + } catch (PDOException $e) { |
|
1412 | 1412 | return "error (delete default timestamp spotter_output) : ".$e->getMessage()."\n"; |
1413 | 1413 | } |
1414 | 1414 | /*$query = "SELECT date,last_seen FROM spotter_output WHERE last_seen < date ORDER BY date DESC LIMIT 150"; |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | try { |
1460 | 1460 | $sth = $Connection->db->prepare($query); |
1461 | 1461 | $sth->execute(); |
1462 | - } catch(PDOException $e) { |
|
1462 | + } catch (PDOException $e) { |
|
1463 | 1463 | return "error (fix date) : ".$e->getMessage()."\n"; |
1464 | 1464 | } |
1465 | 1465 | } |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | try { |
1545 | 1545 | $sth = $Connection->db->prepare($query); |
1546 | 1546 | $sth->execute(); |
1547 | - } catch(PDOException $e) { |
|
1547 | + } catch (PDOException $e) { |
|
1548 | 1548 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1549 | 1549 | } |
1550 | 1550 | return $error; |
@@ -1553,13 +1553,13 @@ discard block |
||
1553 | 1553 | global $globalDBdriver; |
1554 | 1554 | $Connection = new Connection(); |
1555 | 1555 | $error = ''; |
1556 | - if (!$Connection->indexExists('accidents','type')) { |
|
1556 | + if (!$Connection->indexExists('accidents', 'type')) { |
|
1557 | 1557 | // Add index key |
1558 | 1558 | $query = "create index type on accidents (type,date)"; |
1559 | 1559 | try { |
1560 | 1560 | $sth = $Connection->db->prepare($query); |
1561 | 1561 | $sth->execute(); |
1562 | - } catch(PDOException $e) { |
|
1562 | + } catch (PDOException $e) { |
|
1563 | 1563 | return "error (add index type on accidents) : ".$e->getMessage()."\n"; |
1564 | 1564 | } |
1565 | 1565 | } |
@@ -1567,7 +1567,7 @@ discard block |
||
1567 | 1567 | try { |
1568 | 1568 | $sth = $Connection->db->prepare($query); |
1569 | 1569 | $sth->execute(); |
1570 | - } catch(PDOException $e) { |
|
1570 | + } catch (PDOException $e) { |
|
1571 | 1571 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1572 | 1572 | } |
1573 | 1573 | return $error; |
@@ -1577,12 +1577,12 @@ discard block |
||
1577 | 1577 | global $globalDBdriver; |
1578 | 1578 | $Connection = new Connection(); |
1579 | 1579 | $error = ''; |
1580 | - if (!$Connection->checkColumnName('aircraft_modes','source_type')) { |
|
1580 | + if (!$Connection->checkColumnName('aircraft_modes', 'source_type')) { |
|
1581 | 1581 | $query = "ALTER TABLE aircraft_modes ADD source_type VARCHAR(255) DEFAULT 'modes'"; |
1582 | 1582 | try { |
1583 | 1583 | $sth = $Connection->db->prepare($query); |
1584 | 1584 | $sth->execute(); |
1585 | - } catch(PDOException $e) { |
|
1585 | + } catch (PDOException $e) { |
|
1586 | 1586 | return "error (add source_type column in aircraft_modes) : ".$e->getMessage()."\n"; |
1587 | 1587 | } |
1588 | 1588 | } |
@@ -1648,7 +1648,7 @@ discard block |
||
1648 | 1648 | try { |
1649 | 1649 | $sth = $Connection->db->prepare($query); |
1650 | 1650 | $sth->execute(); |
1651 | - } catch(PDOException $e) { |
|
1651 | + } catch (PDOException $e) { |
|
1652 | 1652 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1653 | 1653 | } |
1654 | 1654 | return $error; |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | try { |
1701 | 1701 | $sth = $Connection->db->prepare($query); |
1702 | 1702 | $sth->execute(); |
1703 | - } catch(PDOException $e) { |
|
1703 | + } catch (PDOException $e) { |
|
1704 | 1704 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
1705 | 1705 | } |
1706 | 1706 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1709,18 +1709,18 @@ discard block |
||
1709 | 1709 | try { |
1710 | 1710 | $sth = $Connection->db->prepare($query); |
1711 | 1711 | $sth->execute(); |
1712 | - } catch(PDOException $e) { |
|
1712 | + } catch (PDOException $e) { |
|
1713 | 1713 | return "error (Change table format from archive to InnoDB for spotter_archive) : ".$e->getMessage()."\n"; |
1714 | 1714 | } |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - if (!$Connection->indexExists('spotter_archive','flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive','flightaware_id')) { |
|
1717 | + if (!$Connection->indexExists('spotter_archive', 'flightaware_id_date_idx') && !$Connection->indexExists('spotter_archive', 'flightaware_id')) { |
|
1718 | 1718 | // Add index key |
1719 | 1719 | $query = "create index flightaware_id_date_idx on spotter_archive (flightaware_id,date)"; |
1720 | 1720 | try { |
1721 | 1721 | $sth = $Connection->db->prepare($query); |
1722 | 1722 | $sth->execute(); |
1723 | - } catch(PDOException $e) { |
|
1723 | + } catch (PDOException $e) { |
|
1724 | 1724 | return "error (add index flightaware_id, date on spotter_archive) : ".$e->getMessage()."\n"; |
1725 | 1725 | } |
1726 | 1726 | } |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | try { |
1729 | 1729 | $sth = $Connection->db->prepare($query); |
1730 | 1730 | $sth->execute(); |
1731 | - } catch(PDOException $e) { |
|
1731 | + } catch (PDOException $e) { |
|
1732 | 1732 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1733 | 1733 | } |
1734 | 1734 | return $error; |
@@ -1739,148 +1739,148 @@ discard block |
||
1739 | 1739 | $Connection = new Connection(); |
1740 | 1740 | $error = ''; |
1741 | 1741 | if ($globalDBdriver == 'mysql') { |
1742 | - if (!$Connection->checkColumnName('marine_output','type_id')) { |
|
1742 | + if (!$Connection->checkColumnName('marine_output', 'type_id')) { |
|
1743 | 1743 | $query = "ALTER TABLE marine_output ADD COLUMN type_id int(11) DEFAULT NULL"; |
1744 | 1744 | try { |
1745 | 1745 | $sth = $Connection->db->prepare($query); |
1746 | 1746 | $sth->execute(); |
1747 | - } catch(PDOException $e) { |
|
1747 | + } catch (PDOException $e) { |
|
1748 | 1748 | return "error (add column type_id in marine_output) : ".$e->getMessage()."\n"; |
1749 | 1749 | } |
1750 | 1750 | } |
1751 | - if (!$Connection->checkColumnName('marine_live','type_id')) { |
|
1751 | + if (!$Connection->checkColumnName('marine_live', 'type_id')) { |
|
1752 | 1752 | $query = "ALTER TABLE marine_live ADD COLUMN type_id int(11) DEFAULT NULL"; |
1753 | 1753 | try { |
1754 | 1754 | $sth = $Connection->db->prepare($query); |
1755 | 1755 | $sth->execute(); |
1756 | - } catch(PDOException $e) { |
|
1756 | + } catch (PDOException $e) { |
|
1757 | 1757 | return "error (add column type_id in marine_live) : ".$e->getMessage()."\n"; |
1758 | 1758 | } |
1759 | 1759 | } |
1760 | - if (!$Connection->checkColumnName('marine_archive','type_id')) { |
|
1760 | + if (!$Connection->checkColumnName('marine_archive', 'type_id')) { |
|
1761 | 1761 | $query = "ALTER TABLE marine_archive ADD COLUMN type_id int(11) DEFAULT NULL"; |
1762 | 1762 | try { |
1763 | 1763 | $sth = $Connection->db->prepare($query); |
1764 | 1764 | $sth->execute(); |
1765 | - } catch(PDOException $e) { |
|
1765 | + } catch (PDOException $e) { |
|
1766 | 1766 | return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n"; |
1767 | 1767 | } |
1768 | 1768 | } |
1769 | - if (!$Connection->checkColumnName('marine_archive_output','type_id')) { |
|
1769 | + if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) { |
|
1770 | 1770 | $query = "ALTER TABLE marine_archive_output ADD COLUMN type_id int(11) DEFAULT NULL"; |
1771 | 1771 | try { |
1772 | 1772 | $sth = $Connection->db->prepare($query); |
1773 | 1773 | $sth->execute(); |
1774 | - } catch(PDOException $e) { |
|
1774 | + } catch (PDOException $e) { |
|
1775 | 1775 | return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1776 | 1776 | } |
1777 | 1777 | } |
1778 | - if (!$Connection->checkColumnName('marine_output','status_id')) { |
|
1778 | + if (!$Connection->checkColumnName('marine_output', 'status_id')) { |
|
1779 | 1779 | $query = "ALTER TABLE marine_output ADD COLUMN status_id int(11) DEFAULT NULL"; |
1780 | 1780 | try { |
1781 | 1781 | $sth = $Connection->db->prepare($query); |
1782 | 1782 | $sth->execute(); |
1783 | - } catch(PDOException $e) { |
|
1783 | + } catch (PDOException $e) { |
|
1784 | 1784 | return "error (add column status_id in marine_output) : ".$e->getMessage()."\n"; |
1785 | 1785 | } |
1786 | 1786 | } |
1787 | - if (!$Connection->checkColumnName('marine_live','status_id')) { |
|
1787 | + if (!$Connection->checkColumnName('marine_live', 'status_id')) { |
|
1788 | 1788 | $query = "ALTER TABLE marine_live ADD COLUMN status_id int(11) DEFAULT NULL"; |
1789 | 1789 | try { |
1790 | 1790 | $sth = $Connection->db->prepare($query); |
1791 | 1791 | $sth->execute(); |
1792 | - } catch(PDOException $e) { |
|
1792 | + } catch (PDOException $e) { |
|
1793 | 1793 | return "error (add column status_id in marine_live) : ".$e->getMessage()."\n"; |
1794 | 1794 | } |
1795 | 1795 | } |
1796 | - if (!$Connection->checkColumnName('marine_archive','status_id')) { |
|
1796 | + if (!$Connection->checkColumnName('marine_archive', 'status_id')) { |
|
1797 | 1797 | $query = "ALTER TABLE marine_archive ADD COLUMN status_id int(11) DEFAULT NULL"; |
1798 | 1798 | try { |
1799 | 1799 | $sth = $Connection->db->prepare($query); |
1800 | 1800 | $sth->execute(); |
1801 | - } catch(PDOException $e) { |
|
1801 | + } catch (PDOException $e) { |
|
1802 | 1802 | return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n"; |
1803 | 1803 | } |
1804 | 1804 | } |
1805 | - if (!$Connection->checkColumnName('marine_archive_output','status_id')) { |
|
1805 | + if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) { |
|
1806 | 1806 | $query = "ALTER TABLE marine_archive_output ADD COLUMN status_id int(11) DEFAULT NULL"; |
1807 | 1807 | try { |
1808 | 1808 | $sth = $Connection->db->prepare($query); |
1809 | 1809 | $sth->execute(); |
1810 | - } catch(PDOException $e) { |
|
1810 | + } catch (PDOException $e) { |
|
1811 | 1811 | return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1812 | 1812 | } |
1813 | 1813 | } |
1814 | 1814 | } else { |
1815 | - if (!$Connection->checkColumnName('marine_output','type_id')) { |
|
1815 | + if (!$Connection->checkColumnName('marine_output', 'type_id')) { |
|
1816 | 1816 | $query = "ALTER TABLE marine_output ADD COLUMN type_id integer DEFAULT NULL"; |
1817 | 1817 | try { |
1818 | 1818 | $sth = $Connection->db->prepare($query); |
1819 | 1819 | $sth->execute(); |
1820 | - } catch(PDOException $e) { |
|
1820 | + } catch (PDOException $e) { |
|
1821 | 1821 | return "error (add column type_id in marine_output) : ".$e->getMessage()."\n"; |
1822 | 1822 | } |
1823 | 1823 | } |
1824 | - if (!$Connection->checkColumnName('marine_live','type_id')) { |
|
1824 | + if (!$Connection->checkColumnName('marine_live', 'type_id')) { |
|
1825 | 1825 | $query = "ALTER TABLE marine_live ADD COLUMN type_id integer DEFAULT NULL"; |
1826 | 1826 | try { |
1827 | 1827 | $sth = $Connection->db->prepare($query); |
1828 | 1828 | $sth->execute(); |
1829 | - } catch(PDOException $e) { |
|
1829 | + } catch (PDOException $e) { |
|
1830 | 1830 | return "error (add column type_id in marine_live) : ".$e->getMessage()."\n"; |
1831 | 1831 | } |
1832 | 1832 | } |
1833 | - if (!$Connection->checkColumnName('marine_archive','type_id')) { |
|
1833 | + if (!$Connection->checkColumnName('marine_archive', 'type_id')) { |
|
1834 | 1834 | $query = "ALTER TABLE marine_archive ADD COLUMN type_id integer DEFAULT NULL"; |
1835 | 1835 | try { |
1836 | 1836 | $sth = $Connection->db->prepare($query); |
1837 | 1837 | $sth->execute(); |
1838 | - } catch(PDOException $e) { |
|
1838 | + } catch (PDOException $e) { |
|
1839 | 1839 | return "error (add column type_id in marine_archive) : ".$e->getMessage()."\n"; |
1840 | 1840 | } |
1841 | 1841 | } |
1842 | - if (!$Connection->checkColumnName('marine_archive_output','type_id')) { |
|
1842 | + if (!$Connection->checkColumnName('marine_archive_output', 'type_id')) { |
|
1843 | 1843 | $query = "ALTER TABLE marine_archive_output ADD COLUMN type_id integer DEFAULT NULL"; |
1844 | 1844 | try { |
1845 | 1845 | $sth = $Connection->db->prepare($query); |
1846 | 1846 | $sth->execute(); |
1847 | - } catch(PDOException $e) { |
|
1847 | + } catch (PDOException $e) { |
|
1848 | 1848 | return "error (add column type_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1849 | 1849 | } |
1850 | 1850 | } |
1851 | - if (!$Connection->checkColumnName('marine_output','status_id')) { |
|
1851 | + if (!$Connection->checkColumnName('marine_output', 'status_id')) { |
|
1852 | 1852 | $query = "ALTER TABLE marine_output ADD COLUMN status_id integer DEFAULT NULL"; |
1853 | 1853 | try { |
1854 | 1854 | $sth = $Connection->db->prepare($query); |
1855 | 1855 | $sth->execute(); |
1856 | - } catch(PDOException $e) { |
|
1856 | + } catch (PDOException $e) { |
|
1857 | 1857 | return "error (add column status_id in marine_output) : ".$e->getMessage()."\n"; |
1858 | 1858 | } |
1859 | 1859 | } |
1860 | - if (!$Connection->checkColumnName('marine_live','status_id')) { |
|
1860 | + if (!$Connection->checkColumnName('marine_live', 'status_id')) { |
|
1861 | 1861 | $query = "ALTER TABLE marine_live ADD COLUMN status_id integer DEFAULT NULL"; |
1862 | 1862 | try { |
1863 | 1863 | $sth = $Connection->db->prepare($query); |
1864 | 1864 | $sth->execute(); |
1865 | - } catch(PDOException $e) { |
|
1865 | + } catch (PDOException $e) { |
|
1866 | 1866 | return "error (add column status_id in marine_live) : ".$e->getMessage()."\n"; |
1867 | 1867 | } |
1868 | 1868 | } |
1869 | - if (!$Connection->checkColumnName('marine_archive','status_id')) { |
|
1869 | + if (!$Connection->checkColumnName('marine_archive', 'status_id')) { |
|
1870 | 1870 | $query = "ALTER TABLE marine_archive ADD COLUMN status_id integer DEFAULT NULL"; |
1871 | 1871 | try { |
1872 | 1872 | $sth = $Connection->db->prepare($query); |
1873 | 1873 | $sth->execute(); |
1874 | - } catch(PDOException $e) { |
|
1874 | + } catch (PDOException $e) { |
|
1875 | 1875 | return "error (add column status_id in marine_archive) : ".$e->getMessage()."\n"; |
1876 | 1876 | } |
1877 | 1877 | } |
1878 | - if (!$Connection->checkColumnName('marine_archive_output','status_id')) { |
|
1878 | + if (!$Connection->checkColumnName('marine_archive_output', 'status_id')) { |
|
1879 | 1879 | $query = "ALTER TABLE marine_archive_output ADD COLUMN status_id integer DEFAULT NULL"; |
1880 | 1880 | try { |
1881 | 1881 | $sth = $Connection->db->prepare($query); |
1882 | 1882 | $sth->execute(); |
1883 | - } catch(PDOException $e) { |
|
1883 | + } catch (PDOException $e) { |
|
1884 | 1884 | return "error (add column status_id in marine_archive_output) : ".$e->getMessage()."\n"; |
1885 | 1885 | } |
1886 | 1886 | } |
@@ -1889,7 +1889,7 @@ discard block |
||
1889 | 1889 | try { |
1890 | 1890 | $sth = $Connection->db->prepare($query); |
1891 | 1891 | $sth->execute(); |
1892 | - } catch(PDOException $e) { |
|
1892 | + } catch (PDOException $e) { |
|
1893 | 1893 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1894 | 1894 | } |
1895 | 1895 | return $error; |
@@ -1904,14 +1904,14 @@ discard block |
||
1904 | 1904 | try { |
1905 | 1905 | $sth = $Connection->db->prepare($query); |
1906 | 1906 | $sth->execute(); |
1907 | - } catch(PDOException $e) { |
|
1907 | + } catch (PDOException $e) { |
|
1908 | 1908 | return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n"; |
1909 | 1909 | } |
1910 | 1910 | $query = "ALTER TABLE marine_identity MODIFY COLUMN mmsi varchar(255) DEFAULT NULL"; |
1911 | 1911 | try { |
1912 | 1912 | $sth = $Connection->db->prepare($query); |
1913 | 1913 | $sth->execute(); |
1914 | - } catch(PDOException $e) { |
|
1914 | + } catch (PDOException $e) { |
|
1915 | 1915 | return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n"; |
1916 | 1916 | } |
1917 | 1917 | } else { |
@@ -1919,14 +1919,14 @@ discard block |
||
1919 | 1919 | try { |
1920 | 1920 | $sth = $Connection->db->prepare($query); |
1921 | 1921 | $sth->execute(); |
1922 | - } catch(PDOException $e) { |
|
1922 | + } catch (PDOException $e) { |
|
1923 | 1923 | return "error (change pilot_id type to varchar in stats_pilot) : ".$e->getMessage()."\n"; |
1924 | 1924 | } |
1925 | 1925 | $query = "alter table marine_identity alter column mmsi type varchar(255)"; |
1926 | 1926 | try { |
1927 | 1927 | $sth = $Connection->db->prepare($query); |
1928 | 1928 | $sth->execute(); |
1929 | - } catch(PDOException $e) { |
|
1929 | + } catch (PDOException $e) { |
|
1930 | 1930 | return "error (change mmsi type to varchar in marine_identity) : ".$e->getMessage()."\n"; |
1931 | 1931 | } |
1932 | 1932 | } |
@@ -1934,7 +1934,7 @@ discard block |
||
1934 | 1934 | try { |
1935 | 1935 | $sth = $Connection->db->prepare($query); |
1936 | 1936 | $sth->execute(); |
1937 | - } catch(PDOException $e) { |
|
1937 | + } catch (PDOException $e) { |
|
1938 | 1938 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1939 | 1939 | } |
1940 | 1940 | return $error; |
@@ -1944,32 +1944,32 @@ discard block |
||
1944 | 1944 | global $globalDBdriver; |
1945 | 1945 | $Connection = new Connection(); |
1946 | 1946 | $error = ''; |
1947 | - if (!$Connection->checkColumnName('source_location','last_seen')) { |
|
1947 | + if (!$Connection->checkColumnName('source_location', 'last_seen')) { |
|
1948 | 1948 | $query = "ALTER TABLE source_location ADD COLUMN last_seen timestamp NULL DEFAULT NULL"; |
1949 | 1949 | try { |
1950 | 1950 | $sth = $Connection->db->prepare($query); |
1951 | 1951 | $sth->execute(); |
1952 | - } catch(PDOException $e) { |
|
1952 | + } catch (PDOException $e) { |
|
1953 | 1953 | return "error (add column last_seen in source_location) : ".$e->getMessage()."\n"; |
1954 | 1954 | } |
1955 | 1955 | } |
1956 | 1956 | if ($globalDBdriver == 'mysql') { |
1957 | - if (!$Connection->checkColumnName('source_location','location_id')) { |
|
1957 | + if (!$Connection->checkColumnName('source_location', 'location_id')) { |
|
1958 | 1958 | $query = "ALTER TABLE source_location ADD COLUMN location_id int(11) DEFAULT NULL"; |
1959 | 1959 | try { |
1960 | 1960 | $sth = $Connection->db->prepare($query); |
1961 | 1961 | $sth->execute(); |
1962 | - } catch(PDOException $e) { |
|
1962 | + } catch (PDOException $e) { |
|
1963 | 1963 | return "error (add column location_id in source_location) : ".$e->getMessage()."\n"; |
1964 | 1964 | } |
1965 | 1965 | } |
1966 | 1966 | } else { |
1967 | - if (!$Connection->checkColumnName('source_location','location_id')) { |
|
1967 | + if (!$Connection->checkColumnName('source_location', 'location_id')) { |
|
1968 | 1968 | $query = "ALTER TABLE source_location ADD COLUMN location_id integer DEFAULT NULL"; |
1969 | 1969 | try { |
1970 | 1970 | $sth = $Connection->db->prepare($query); |
1971 | 1971 | $sth->execute(); |
1972 | - } catch(PDOException $e) { |
|
1972 | + } catch (PDOException $e) { |
|
1973 | 1973 | return "error (add column location_id in source_location) : ".$e->getMessage()."\n"; |
1974 | 1974 | } |
1975 | 1975 | } |
@@ -1978,7 +1978,7 @@ discard block |
||
1978 | 1978 | try { |
1979 | 1979 | $sth = $Connection->db->prepare($query); |
1980 | 1980 | $sth->execute(); |
1981 | - } catch(PDOException $e) { |
|
1981 | + } catch (PDOException $e) { |
|
1982 | 1982 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
1983 | 1983 | } |
1984 | 1984 | return $error; |
@@ -1988,12 +1988,12 @@ discard block |
||
1988 | 1988 | global $globalDBdriver; |
1989 | 1989 | $Connection = new Connection(); |
1990 | 1990 | $error = ''; |
1991 | - if (!$Connection->checkColumnName('source_location','description')) { |
|
1991 | + if (!$Connection->checkColumnName('source_location', 'description')) { |
|
1992 | 1992 | $query = "ALTER TABLE source_location ADD COLUMN description text DEFAULT NULL"; |
1993 | 1993 | try { |
1994 | 1994 | $sth = $Connection->db->prepare($query); |
1995 | 1995 | $sth->execute(); |
1996 | - } catch(PDOException $e) { |
|
1996 | + } catch (PDOException $e) { |
|
1997 | 1997 | return "error (add column description in source_location) : ".$e->getMessage()."\n"; |
1998 | 1998 | } |
1999 | 1999 | } |
@@ -2001,7 +2001,7 @@ discard block |
||
2001 | 2001 | try { |
2002 | 2002 | $sth = $Connection->db->prepare($query); |
2003 | 2003 | $sth->execute(); |
2004 | - } catch(PDOException $e) { |
|
2004 | + } catch (PDOException $e) { |
|
2005 | 2005 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2006 | 2006 | } |
2007 | 2007 | return $error; |
@@ -2011,39 +2011,39 @@ discard block |
||
2011 | 2011 | global $globalDBdriver; |
2012 | 2012 | $Connection = new Connection(); |
2013 | 2013 | $error = ''; |
2014 | - if (!$Connection->checkColumnName('spotter_live','real_altitude')) { |
|
2014 | + if (!$Connection->checkColumnName('spotter_live', 'real_altitude')) { |
|
2015 | 2015 | $query = "ALTER TABLE spotter_live ADD COLUMN real_altitude float DEFAULT NULL"; |
2016 | 2016 | try { |
2017 | 2017 | $sth = $Connection->db->prepare($query); |
2018 | 2018 | $sth->execute(); |
2019 | - } catch(PDOException $e) { |
|
2019 | + } catch (PDOException $e) { |
|
2020 | 2020 | return "error (add column real_altitude in spotter_live) : ".$e->getMessage()."\n"; |
2021 | 2021 | } |
2022 | 2022 | } |
2023 | - if (!$Connection->checkColumnName('spotter_output','real_altitude')) { |
|
2023 | + if (!$Connection->checkColumnName('spotter_output', 'real_altitude')) { |
|
2024 | 2024 | $query = "ALTER TABLE spotter_output ADD COLUMN real_altitude float DEFAULT NULL"; |
2025 | 2025 | try { |
2026 | 2026 | $sth = $Connection->db->prepare($query); |
2027 | 2027 | $sth->execute(); |
2028 | - } catch(PDOException $e) { |
|
2028 | + } catch (PDOException $e) { |
|
2029 | 2029 | return "error (add column real_altitude in spotter_output) : ".$e->getMessage()."\n"; |
2030 | 2030 | } |
2031 | 2031 | } |
2032 | - if (!$Connection->checkColumnName('spotter_archive_output','real_altitude')) { |
|
2032 | + if (!$Connection->checkColumnName('spotter_archive_output', 'real_altitude')) { |
|
2033 | 2033 | $query = "ALTER TABLE spotter_archive_output ADD COLUMN real_altitude float DEFAULT NULL"; |
2034 | 2034 | try { |
2035 | 2035 | $sth = $Connection->db->prepare($query); |
2036 | 2036 | $sth->execute(); |
2037 | - } catch(PDOException $e) { |
|
2037 | + } catch (PDOException $e) { |
|
2038 | 2038 | return "error (add column real_altitude in spotter_archive_output) : ".$e->getMessage()."\n"; |
2039 | 2039 | } |
2040 | 2040 | } |
2041 | - if (!$Connection->checkColumnName('spotter_archive','real_altitude')) { |
|
2041 | + if (!$Connection->checkColumnName('spotter_archive', 'real_altitude')) { |
|
2042 | 2042 | $query = "ALTER TABLE spotter_archive ADD COLUMN real_altitude float DEFAULT NULL"; |
2043 | 2043 | try { |
2044 | 2044 | $sth = $Connection->db->prepare($query); |
2045 | 2045 | $sth->execute(); |
2046 | - } catch(PDOException $e) { |
|
2046 | + } catch (PDOException $e) { |
|
2047 | 2047 | return "error (add column real_altitude in spotter_archive) : ".$e->getMessage()."\n"; |
2048 | 2048 | } |
2049 | 2049 | } |
@@ -2051,7 +2051,7 @@ discard block |
||
2051 | 2051 | try { |
2052 | 2052 | $sth = $Connection->db->prepare($query); |
2053 | 2053 | $sth->execute(); |
2054 | - } catch(PDOException $e) { |
|
2054 | + } catch (PDOException $e) { |
|
2055 | 2055 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2056 | 2056 | } |
2057 | 2057 | return $error; |
@@ -2073,14 +2073,14 @@ discard block |
||
2073 | 2073 | try { |
2074 | 2074 | $sth = $Connection->db->prepare($query); |
2075 | 2075 | $sth->execute(); |
2076 | - } catch(PDOException $e) { |
|
2076 | + } catch (PDOException $e) { |
|
2077 | 2077 | return "error (modify column altitude in tracker_*) : ".$e->getMessage()."\n"; |
2078 | 2078 | } |
2079 | 2079 | $query = "UPDATE config SET value = '44' WHERE name = 'schema_version'"; |
2080 | 2080 | try { |
2081 | 2081 | $sth = $Connection->db->prepare($query); |
2082 | 2082 | $sth->execute(); |
2083 | - } catch(PDOException $e) { |
|
2083 | + } catch (PDOException $e) { |
|
2084 | 2084 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2085 | 2085 | } |
2086 | 2086 | return $error; |
@@ -2121,7 +2121,7 @@ discard block |
||
2121 | 2121 | try { |
2122 | 2122 | $sth = $Connection->db->prepare($query); |
2123 | 2123 | $sth->execute(); |
2124 | - } catch(PDOException $e) { |
|
2124 | + } catch (PDOException $e) { |
|
2125 | 2125 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2126 | 2126 | } |
2127 | 2127 | return $error; |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | try { |
2145 | 2145 | $sth = $Connection->db->prepare($query); |
2146 | 2146 | $sth->execute(); |
2147 | - } catch(PDOException $e) { |
|
2147 | + } catch (PDOException $e) { |
|
2148 | 2148 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
2149 | 2149 | } |
2150 | 2150 | return $error; |
@@ -2167,7 +2167,7 @@ discard block |
||
2167 | 2167 | try { |
2168 | 2168 | $sth = $Connection->db->prepare($query); |
2169 | 2169 | $sth->execute(); |
2170 | - } catch(PDOException $e) { |
|
2170 | + } catch (PDOException $e) { |
|
2171 | 2171 | return "error : ".$e->getMessage()."\n"; |
2172 | 2172 | } |
2173 | 2173 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | fclose($fp); |
26 | 26 | } |
27 | 27 | |
28 | - public static function gunzip($in_file,$out_file_name = '') { |
|
28 | + public static function gunzip($in_file, $out_file_name = '') { |
|
29 | 29 | //echo $in_file.' -> '.$out_file_name."\n"; |
30 | 30 | $buffer_size = 4096; // read 4kb at a time |
31 | 31 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
32 | 32 | if ($in_file != '' && file_exists($in_file)) { |
33 | 33 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
34 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
35 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
34 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
35 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
36 | 36 | else { |
37 | 37 | echo 'gzopen not available'; |
38 | 38 | die; |
39 | 39 | } |
40 | 40 | $out_file = fopen($out_file_name, 'wb'); |
41 | - while(!gzeof($file)) { |
|
41 | + while (!gzeof($file)) { |
|
42 | 42 | fwrite($out_file, gzread($file, $buffer_size)); |
43 | 43 | } |
44 | 44 | fclose($out_file); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | try { |
63 | 63 | self::$db_sqlite = new PDO('sqlite:'.$database); |
64 | 64 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
65 | - } catch(PDOException $e) { |
|
65 | + } catch (PDOException $e) { |
|
66 | 66 | return "error : ".$e->getMessage(); |
67 | 67 | } |
68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | //$Connection = new Connection(); |
78 | 78 | $sth = $Connection->db->prepare($query); |
79 | 79 | $sth->execute(array(':source' => $database_file)); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | try { |
89 | 89 | $sth = update_db::$db_sqlite->prepare($query); |
90 | 90 | $sth->execute(); |
91 | - } catch(PDOException $e) { |
|
91 | + } catch (PDOException $e) { |
|
92 | 92 | return "error : ".$e->getMessage(); |
93 | 93 | } |
94 | 94 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | if ($globalTransaction) $Connection->db->beginTransaction(); |
100 | 100 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
101 | 101 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
102 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
103 | 103 | $sth_dest->execute($query_dest_values); |
104 | 104 | } |
105 | 105 | if ($globalTransaction) $Connection->db->commit(); |
106 | - } catch(PDOException $e) { |
|
106 | + } catch (PDOException $e) { |
|
107 | 107 | if ($globalTransaction) $Connection->db->rollBack(); |
108 | 108 | return "error : ".$e->getMessage(); |
109 | 109 | } |
@@ -119,26 +119,26 @@ discard block |
||
119 | 119 | //$Connection = new Connection(); |
120 | 120 | $sth = $Connection->db->prepare($query); |
121 | 121 | $sth->execute(array(':source' => 'oneworld')); |
122 | - } catch(PDOException $e) { |
|
122 | + } catch (PDOException $e) { |
|
123 | 123 | return "error : ".$e->getMessage(); |
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($globalDebug) echo " - Add routes to DB -"; |
127 | 127 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 128 | $Spotter = new Spotter(); |
129 | - if ($fh = fopen($database_file,"r")) { |
|
129 | + if ($fh = fopen($database_file, "r")) { |
|
130 | 130 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
131 | 131 | $Connection = new Connection(); |
132 | 132 | $sth_dest = $Connection->db->prepare($query_dest); |
133 | 133 | if ($globalTransaction) $Connection->db->beginTransaction(); |
134 | 134 | while (!feof($fh)) { |
135 | - $line = fgetcsv($fh,9999,','); |
|
135 | + $line = fgetcsv($fh, 9999, ','); |
|
136 | 136 | if ($line[0] != '') { |
137 | 137 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
138 | 138 | try { |
139 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
139 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
140 | 140 | $sth_dest->execute($query_dest_values); |
141 | - } catch(PDOException $e) { |
|
141 | + } catch (PDOException $e) { |
|
142 | 142 | if ($globalTransaction) $Connection->db->rollBack(); |
143 | 143 | return "error : ".$e->getMessage(); |
144 | 144 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | //$Connection = new Connection(); |
161 | 161 | $sth = $Connection->db->prepare($query); |
162 | 162 | $sth->execute(array(':source' => 'skyteam')); |
163 | - } catch(PDOException $e) { |
|
163 | + } catch (PDOException $e) { |
|
164 | 164 | return "error : ".$e->getMessage(); |
165 | 165 | } |
166 | 166 | |
@@ -168,24 +168,24 @@ discard block |
||
168 | 168 | |
169 | 169 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 170 | $Spotter = new Spotter(); |
171 | - if ($fh = fopen($database_file,"r")) { |
|
171 | + if ($fh = fopen($database_file, "r")) { |
|
172 | 172 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
173 | 173 | $Connection = new Connection(); |
174 | 174 | $sth_dest = $Connection->db->prepare($query_dest); |
175 | 175 | try { |
176 | 176 | if ($globalTransaction) $Connection->db->beginTransaction(); |
177 | 177 | while (!feof($fh)) { |
178 | - $line = fgetcsv($fh,9999,','); |
|
178 | + $line = fgetcsv($fh, 9999, ','); |
|
179 | 179 | if ($line[0] != '') { |
180 | - $datebe = explode(' - ',$line[2]); |
|
180 | + $datebe = explode(' - ', $line[2]); |
|
181 | 181 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
182 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
182 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
183 | 183 | $sth_dest->execute($query_dest_values); |
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | 187 | if ($globalTransaction) $Connection->db->commit(); |
188 | - } catch(PDOException $e) { |
|
188 | + } catch (PDOException $e) { |
|
189 | 189 | if ($globalTransaction) $Connection->db->rollBack(); |
190 | 190 | return "error : ".$e->getMessage(); |
191 | 191 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $Connection = new Connection(); |
201 | 201 | $sth = $Connection->db->prepare($query); |
202 | 202 | $sth->execute(array(':source' => $database_file)); |
203 | - } catch(PDOException $e) { |
|
203 | + } catch (PDOException $e) { |
|
204 | 204 | return "error : ".$e->getMessage(); |
205 | 205 | } |
206 | 206 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $Connection = new Connection(); |
209 | 209 | $sth = $Connection->db->prepare($query); |
210 | 210 | $sth->execute(array(':source' => $database_file)); |
211 | - } catch(PDOException $e) { |
|
211 | + } catch (PDOException $e) { |
|
212 | 212 | return "error : ".$e->getMessage(); |
213 | 213 | } |
214 | 214 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | try { |
218 | 218 | $sth = update_db::$db_sqlite->prepare($query); |
219 | 219 | $sth->execute(); |
220 | - } catch(PDOException $e) { |
|
220 | + } catch (PDOException $e) { |
|
221 | 221 | return "error : ".$e->getMessage(); |
222 | 222 | } |
223 | 223 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
235 | 235 | if ($values['UserString4'] == 'M') $type = 'military'; |
236 | 236 | else $type = null; |
237 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
237 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
238 | 238 | $sth_dest->execute($query_dest_values); |
239 | 239 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
240 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
240 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
241 | 241 | $sth_dest_owner->execute($query_dest_owner_values); |
242 | 242 | } |
243 | 243 | } |
244 | 244 | if ($globalTransaction) $Connection->db->commit(); |
245 | - } catch(PDOException $e) { |
|
245 | + } catch (PDOException $e) { |
|
246 | 246 | return "error : ".$e->getMessage(); |
247 | 247 | } |
248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $Connection = new Connection(); |
253 | 253 | $sth = $Connection->db->prepare($query); |
254 | 254 | $sth->execute(array(':source' => $database_file)); |
255 | - } catch(PDOException $e) { |
|
255 | + } catch (PDOException $e) { |
|
256 | 256 | return "error : ".$e->getMessage(); |
257 | 257 | } |
258 | 258 | return ''; |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | $Connection = new Connection(); |
268 | 268 | $sth = $Connection->db->prepare($query); |
269 | 269 | $sth->execute(array(':source' => $database_file)); |
270 | - } catch(PDOException $e) { |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | return "error : ".$e->getMessage(); |
272 | 272 | } |
273 | 273 | |
274 | - if ($fh = fopen($database_file,"r")) { |
|
274 | + if ($fh = fopen($database_file, "r")) { |
|
275 | 275 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
276 | 276 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
277 | 277 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | if ($globalTransaction) $Connection->db->beginTransaction(); |
282 | 282 | while (!feof($fh)) { |
283 | 283 | $values = array(); |
284 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
284 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
285 | 285 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
286 | - $values['ModeS'] = substr($line,0,6); |
|
287 | - $values['Registration'] = trim(substr($line,69,6)); |
|
288 | - $aircraft_name = trim(substr($line,48,6)); |
|
286 | + $values['ModeS'] = substr($line, 0, 6); |
|
287 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
288 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
289 | 289 | // Check if we can find ICAO, else set it to GLID |
290 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
290 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
291 | 291 | $search_more = ''; |
292 | 292 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
293 | 293 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -299,20 +299,20 @@ discard block |
||
299 | 299 | if (isset($result['icao']) && $result['icao'] != '') { |
300 | 300 | $values['ICAOTypeCode'] = $result['icao']; |
301 | 301 | } |
302 | - } catch(PDOException $e) { |
|
302 | + } catch (PDOException $e) { |
|
303 | 303 | return "error : ".$e->getMessage(); |
304 | 304 | } |
305 | 305 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
306 | 306 | // Add data to db |
307 | 307 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
308 | 308 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
309 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
309 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
310 | 310 | //print_r($query_dest_values); |
311 | 311 | $sth_dest->execute($query_dest_values); |
312 | 312 | } |
313 | 313 | } |
314 | 314 | if ($globalTransaction) $Connection->db->commit(); |
315 | - } catch(PDOException $e) { |
|
315 | + } catch (PDOException $e) { |
|
316 | 316 | return "error : ".$e->getMessage(); |
317 | 317 | } |
318 | 318 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $Connection = new Connection(); |
323 | 323 | $sth = $Connection->db->prepare($query); |
324 | 324 | $sth->execute(array(':source' => $database_file)); |
325 | - } catch(PDOException $e) { |
|
325 | + } catch (PDOException $e) { |
|
326 | 326 | return "error : ".$e->getMessage(); |
327 | 327 | } |
328 | 328 | return ''; |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | $Connection = new Connection(); |
337 | 337 | $sth = $Connection->db->prepare($query); |
338 | 338 | $sth->execute(array(':source' => $database_file)); |
339 | - } catch(PDOException $e) { |
|
339 | + } catch (PDOException $e) { |
|
340 | 340 | return "error : ".$e->getMessage(); |
341 | 341 | } |
342 | 342 | |
343 | - if ($fh = fopen($database_file,"r")) { |
|
343 | + if ($fh = fopen($database_file, "r")) { |
|
344 | 344 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
345 | 345 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
346 | 346 | |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | $sth_dest = $Connection->db->prepare($query_dest); |
349 | 349 | try { |
350 | 350 | if ($globalTransaction) $Connection->db->beginTransaction(); |
351 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
351 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
352 | 352 | while (!feof($fh)) { |
353 | - $line = fgetcsv($fh,9999,',',"'"); |
|
353 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
354 | 354 | |
355 | 355 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
356 | 356 | //print_r($line); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $values['ICAOTypeCode'] = ''; |
360 | 360 | $aircraft_name = $line[2]; |
361 | 361 | // Check if we can find ICAO, else set it to GLID |
362 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
362 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
363 | 363 | $search_more = ''; |
364 | 364 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
365 | 365 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | $sth_search->execute(); |
369 | 369 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
370 | 370 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
371 | - } catch(PDOException $e) { |
|
371 | + } catch (PDOException $e) { |
|
372 | 372 | return "error : ".$e->getMessage(); |
373 | 373 | } |
374 | 374 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
375 | 375 | // Add data to db |
376 | 376 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
377 | 377 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
378 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
378 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
379 | 379 | //print_r($query_dest_values); |
380 | 380 | $sth_dest->execute($query_dest_values); |
381 | 381 | } |
382 | 382 | } |
383 | 383 | if ($globalTransaction) $Connection->db->commit(); |
384 | - } catch(PDOException $e) { |
|
384 | + } catch (PDOException $e) { |
|
385 | 385 | return "error : ".$e->getMessage(); |
386 | 386 | } |
387 | 387 | } |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | $Connection = new Connection(); |
392 | 392 | $sth = $Connection->db->prepare($query); |
393 | 393 | $sth->execute(array(':source' => $database_file)); |
394 | - } catch(PDOException $e) { |
|
394 | + } catch (PDOException $e) { |
|
395 | 395 | return "error : ".$e->getMessage(); |
396 | 396 | } |
397 | 397 | return ''; |
398 | 398 | } |
399 | 399 | |
400 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
400 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
401 | 401 | global $globalTransaction, $globalMasterSource; |
402 | 402 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
403 | 403 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -405,12 +405,12 @@ discard block |
||
405 | 405 | $Connection = new Connection(); |
406 | 406 | $sth = $Connection->db->prepare($query); |
407 | 407 | $sth->execute(array(':source' => $database_file)); |
408 | - } catch(PDOException $e) { |
|
408 | + } catch (PDOException $e) { |
|
409 | 409 | return "error : ".$e->getMessage(); |
410 | 410 | } |
411 | 411 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
412 | 412 | $Spotter = new Spotter(); |
413 | - if ($fh = fopen($database_file,"r")) { |
|
413 | + if ($fh = fopen($database_file, "r")) { |
|
414 | 414 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
415 | 415 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
416 | 416 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | $sth_modes = $Connection->db->prepare($query_modes); |
421 | 421 | try { |
422 | 422 | if ($globalTransaction) $Connection->db->beginTransaction(); |
423 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
423 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
424 | 424 | while (!feof($fh)) { |
425 | - $line = fgetcsv($fh,9999,',','"'); |
|
425 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
426 | 426 | $values = array(); |
427 | 427 | //print_r($line); |
428 | 428 | if ($country == 'F') { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $values['base'] = $line[4]; |
431 | 431 | $values['owner'] = $line[5]; |
432 | 432 | if ($line[6] == '') $values['date_first_reg'] = null; |
433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
433 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
434 | 434 | $values['cancel'] = $line[7]; |
435 | 435 | } elseif ($country == 'EI') { |
436 | 436 | // TODO : add modeS & reg to aircraft_modes |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $values['base'] = $line[3]; |
439 | 439 | $values['owner'] = $line[2]; |
440 | 440 | if ($line[1] == '') $values['date_first_reg'] = null; |
441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
441 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
442 | 442 | $values['cancel'] = ''; |
443 | 443 | $values['modes'] = $line[7]; |
444 | 444 | $values['icao'] = $line[8]; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $values['base'] = null; |
459 | 459 | $values['owner'] = $line[5]; |
460 | 460 | if ($line[18] == '') $values['date_first_reg'] = null; |
461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
461 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
462 | 462 | $values['cancel'] = ''; |
463 | 463 | } elseif ($country == 'VH') { |
464 | 464 | // TODO : add modeS & reg to aircraft_modes |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $values['base'] = null; |
467 | 467 | $values['owner'] = $line[12]; |
468 | 468 | if ($line[28] == '') $values['date_first_reg'] = null; |
469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
469 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
470 | 470 | |
471 | 471 | $values['cancel'] = $line[39]; |
472 | 472 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -486,28 +486,28 @@ discard block |
||
486 | 486 | $values['base'] = null; |
487 | 487 | $values['owner'] = $line[8]; |
488 | 488 | if ($line[7] == '') $values['date_first_reg'] = null; |
489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
489 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
490 | 490 | $values['cancel'] = ''; |
491 | 491 | } elseif ($country == 'PP') { |
492 | 492 | $values['registration'] = $line[0]; |
493 | 493 | $values['base'] = null; |
494 | 494 | $values['owner'] = $line[4]; |
495 | 495 | if ($line[6] == '') $values['date_first_reg'] = null; |
496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
496 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
497 | 497 | $values['cancel'] = $line[7]; |
498 | 498 | } elseif ($country == 'E7') { |
499 | 499 | $values['registration'] = $line[0]; |
500 | 500 | $values['base'] = null; |
501 | 501 | $values['owner'] = $line[4]; |
502 | 502 | if ($line[5] == '') $values['date_first_reg'] = null; |
503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
503 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
504 | 504 | $values['cancel'] = ''; |
505 | 505 | } elseif ($country == '8Q') { |
506 | 506 | $values['registration'] = $line[0]; |
507 | 507 | $values['base'] = null; |
508 | 508 | $values['owner'] = $line[3]; |
509 | 509 | if ($line[7] == '') $values['date_first_reg'] = null; |
510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
510 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
511 | 511 | $values['cancel'] = ''; |
512 | 512 | } elseif ($country == 'ZK') { |
513 | 513 | $values['registration'] = $line[0]; |
@@ -521,18 +521,18 @@ discard block |
||
521 | 521 | $values['registration'] = $line[0]; |
522 | 522 | $values['base'] = null; |
523 | 523 | $values['owner'] = $line[6]; |
524 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
525 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
524 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
525 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
526 | 526 | $values['modes'] = $line[4]; |
527 | 527 | $values['icao'] = $line[10]; |
528 | 528 | } elseif ($country == 'OY') { |
529 | 529 | $values['registration'] = $line[0]; |
530 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
530 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
531 | 531 | $values['modes'] = $line[5]; |
532 | 532 | $values['icao'] = $line[6]; |
533 | 533 | } elseif ($country == 'PH') { |
534 | 534 | $values['registration'] = $line[0]; |
535 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
535 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
536 | 536 | $values['modes'] = $line[4]; |
537 | 537 | $values['icao'] = $line[5]; |
538 | 538 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -543,17 +543,17 @@ discard block |
||
543 | 543 | $values['cancel'] = ''; |
544 | 544 | } |
545 | 545 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
546 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
546 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
547 | 547 | $sth_dest->execute($query_dest_values); |
548 | 548 | } |
549 | 549 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
550 | 550 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
551 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
551 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
552 | 552 | $sth_modes->execute($query_modes_values); |
553 | 553 | } |
554 | 554 | } |
555 | 555 | if ($globalTransaction) $Connection->db->commit(); |
556 | - } catch(PDOException $e) { |
|
556 | + } catch (PDOException $e) { |
|
557 | 557 | return "error : ".$e->getMessage(); |
558 | 558 | } |
559 | 559 | } |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | if ($globalTransaction) $Connection->db->beginTransaction(); |
692 | 692 | |
693 | 693 | $i = 0; |
694 | - while($row = sparql_fetch_array($result)) |
|
694 | + while ($row = sparql_fetch_array($result)) |
|
695 | 695 | { |
696 | 696 | if ($i >= 1) { |
697 | 697 | //print_r($row); |
@@ -711,33 +711,33 @@ discard block |
||
711 | 711 | $row['image'] = ''; |
712 | 712 | $row['image_thumb'] = ''; |
713 | 713 | } else { |
714 | - $image = str_replace(' ','_',$row['image']); |
|
714 | + $image = str_replace(' ', '_', $row['image']); |
|
715 | 715 | $digest = md5($image); |
716 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
717 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
718 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
719 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
716 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
717 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
718 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
719 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
720 | 720 | } |
721 | 721 | |
722 | - $country = explode('-',$row['country']); |
|
722 | + $country = explode('-', $row['country']); |
|
723 | 723 | $row['country'] = $country[0]; |
724 | 724 | |
725 | 725 | $row['type'] = trim($row['type']); |
726 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
726 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
727 | 727 | $row['type'] = 'military'; |
728 | 728 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
729 | 729 | $row['type'] = 'small_airport'; |
730 | 730 | } |
731 | 731 | |
732 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
733 | - $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
732 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
733 | + $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
734 | 734 | //print_r($query_dest_values); |
735 | 735 | |
736 | 736 | if ($row['icao'] != '') { |
737 | 737 | try { |
738 | 738 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
739 | 739 | $sth->execute(array(':icao' => $row['icao'])); |
740 | - } catch(PDOException $e) { |
|
740 | + } catch (PDOException $e) { |
|
741 | 741 | return "error : ".$e->getMessage(); |
742 | 742 | } |
743 | 743 | if ($sth->fetchColumn() > 0) { |
@@ -745,15 +745,15 @@ discard block |
||
745 | 745 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
746 | 746 | try { |
747 | 747 | $sth = $Connection->db->prepare($query); |
748 | - $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
749 | - } catch(PDOException $e) { |
|
748 | + $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
749 | + } catch (PDOException $e) { |
|
750 | 750 | return "error : ".$e->getMessage(); |
751 | 751 | } |
752 | 752 | echo $row['icao'].' : '.$row['type']."\n"; |
753 | 753 | } else { |
754 | 754 | try { |
755 | 755 | $sth_dest->execute($query_dest_values); |
756 | - } catch(PDOException $e) { |
|
756 | + } catch (PDOException $e) { |
|
757 | 757 | return "error : ".$e->getMessage(); |
758 | 758 | } |
759 | 759 | } |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | echo "Download data from ourairports.com...\n"; |
805 | 805 | $delimiter = ','; |
806 | 806 | $out_file = $tmp_dir.'airports.csv'; |
807 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
807 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
808 | 808 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
809 | 809 | echo "Add data from ourairports.com...\n"; |
810 | 810 | |
@@ -815,33 +815,33 @@ discard block |
||
815 | 815 | //$Connection->db->beginTransaction(); |
816 | 816 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
817 | 817 | { |
818 | - if(!$header) $header = $row; |
|
818 | + if (!$header) $header = $row; |
|
819 | 819 | else { |
820 | 820 | $data = array(); |
821 | 821 | $data = array_combine($header, $row); |
822 | 822 | try { |
823 | 823 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
824 | 824 | $sth->execute(array(':icao' => $data['ident'])); |
825 | - } catch(PDOException $e) { |
|
825 | + } catch (PDOException $e) { |
|
826 | 826 | return "error : ".$e->getMessage(); |
827 | 827 | } |
828 | 828 | if ($sth->fetchColumn() > 0) { |
829 | 829 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
830 | 830 | try { |
831 | 831 | $sth = $Connection->db->prepare($query); |
832 | - $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
833 | - } catch(PDOException $e) { |
|
832 | + $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
833 | + } catch (PDOException $e) { |
|
834 | 834 | return "error : ".$e->getMessage(); |
835 | 835 | } |
836 | 836 | } else { |
837 | 837 | if ($data['gps_code'] == $data['ident']) { |
838 | 838 | $query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
839 | 839 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
840 | - $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
840 | + $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
841 | 841 | try { |
842 | 842 | $sth = $Connection->db->prepare($query); |
843 | 843 | $sth->execute($query_values); |
844 | - } catch(PDOException $e) { |
|
844 | + } catch (PDOException $e) { |
|
845 | 845 | return "error : ".$e->getMessage(); |
846 | 846 | } |
847 | 847 | $i++; |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | |
857 | 857 | echo "Download data from another free database...\n"; |
858 | 858 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
859 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
859 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
860 | 860 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
861 | 861 | update_db::unzip($out_file); |
862 | 862 | $header = NULL; |
@@ -868,15 +868,15 @@ discard block |
||
868 | 868 | //$Connection->db->beginTransaction(); |
869 | 869 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
870 | 870 | { |
871 | - if(!$header) $header = $row; |
|
871 | + if (!$header) $header = $row; |
|
872 | 872 | else { |
873 | 873 | $data = $row; |
874 | 874 | |
875 | 875 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
876 | 876 | try { |
877 | 877 | $sth = $Connection->db->prepare($query); |
878 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
879 | - } catch(PDOException $e) { |
|
878 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
879 | + } catch (PDOException $e) { |
|
880 | 880 | return "error : ".$e->getMessage(); |
881 | 881 | } |
882 | 882 | } |
@@ -890,15 +890,15 @@ discard block |
||
890 | 890 | try { |
891 | 891 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
892 | 892 | $sth->execute(); |
893 | - } catch(PDOException $e) { |
|
893 | + } catch (PDOException $e) { |
|
894 | 894 | return "error : ".$e->getMessage(); |
895 | 895 | } |
896 | 896 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
897 | 897 | $query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
898 | 898 | try { |
899 | 899 | $sth2 = $Connection->db->prepare($query2); |
900 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
901 | - } catch(PDOException $e) { |
|
900 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
901 | + } catch (PDOException $e) { |
|
902 | 902 | return "error : ".$e->getMessage(); |
903 | 903 | } |
904 | 904 | } |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | $Connection = new Connection(); |
920 | 920 | $sth = $Connection->db->prepare($query); |
921 | 921 | $sth->execute(array(':source' => 'translation.csv')); |
922 | - } catch(PDOException $e) { |
|
922 | + } catch (PDOException $e) { |
|
923 | 923 | return "error : ".$e->getMessage(); |
924 | 924 | } |
925 | 925 | |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
937 | 937 | { |
938 | 938 | $i++; |
939 | - if($i > 12) { |
|
939 | + if ($i > 12) { |
|
940 | 940 | $data = $row; |
941 | 941 | $operator = $data[2]; |
942 | 942 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | //echo substr($operator, 0, 2)."\n";; |
945 | 945 | if (count($airline_array) > 0) { |
946 | 946 | //print_r($airline_array); |
947 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
947 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
@@ -952,14 +952,14 @@ discard block |
||
952 | 952 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
953 | 953 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
954 | 954 | if (count($airline_array) > 0) { |
955 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
955 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
956 | 956 | } |
957 | 957 | } |
958 | 958 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
959 | 959 | try { |
960 | 960 | $sth = $Connection->db->prepare($query); |
961 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
962 | - } catch(PDOException $e) { |
|
961 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
962 | + } catch (PDOException $e) { |
|
963 | 963 | return "error : ".$e->getMessage(); |
964 | 964 | } |
965 | 965 | } |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $Connection = new Connection(); |
978 | 978 | $sth = $Connection->db->prepare($query); |
979 | 979 | $sth->execute(array(':source' => 'website_fam')); |
980 | - } catch(PDOException $e) { |
|
980 | + } catch (PDOException $e) { |
|
981 | 981 | return "error : ".$e->getMessage(); |
982 | 982 | } |
983 | 983 | //update_db::unzip($out_file); |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
996 | 996 | try { |
997 | 997 | $sth = $Connection->db->prepare($query); |
998 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
999 | - } catch(PDOException $e) { |
|
998 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
999 | + } catch (PDOException $e) { |
|
1000 | 1000 | return "error : ".$e->getMessage(); |
1001 | 1001 | } |
1002 | 1002 | } |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $Connection = new Connection(); |
1020 | 1020 | $sth = $Connection->db->prepare($query); |
1021 | 1021 | $sth->execute(array(':source' => 'website_faa')); |
1022 | - } catch(PDOException $e) { |
|
1022 | + } catch (PDOException $e) { |
|
1023 | 1023 | return "error : ".$e->getMessage(); |
1024 | 1024 | } |
1025 | 1025 | |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | $Connection = new Connection(); |
1029 | 1029 | $sth = $Connection->db->prepare($query); |
1030 | 1030 | $sth->execute(array(':source' => 'website_faa')); |
1031 | - } catch(PDOException $e) { |
|
1031 | + } catch (PDOException $e) { |
|
1032 | 1032 | return "error : ".$e->getMessage(); |
1033 | 1033 | } |
1034 | 1034 | |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1046 | 1046 | try { |
1047 | 1047 | $sths = $Connection->db->prepare($query_search); |
1048 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1049 | - } catch(PDOException $e) { |
|
1048 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1049 | + } catch (PDOException $e) { |
|
1050 | 1050 | return "error s : ".$e->getMessage(); |
1051 | 1051 | } |
1052 | 1052 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1059,8 +1059,8 @@ discard block |
||
1059 | 1059 | //} |
1060 | 1060 | try { |
1061 | 1061 | $sthi = $Connection->db->prepare($queryi); |
1062 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1063 | - } catch(PDOException $e) { |
|
1062 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1063 | + } catch (PDOException $e) { |
|
1064 | 1064 | return "error u : ".$e->getMessage(); |
1065 | 1065 | } |
1066 | 1066 | } else { |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | try { |
1069 | 1069 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1070 | 1070 | $sthsm->execute(array(':mfr' => $data[2])); |
1071 | - } catch(PDOException $e) { |
|
1071 | + } catch (PDOException $e) { |
|
1072 | 1072 | return "error mfr : ".$e->getMessage(); |
1073 | 1073 | } |
1074 | 1074 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1078,8 +1078,8 @@ discard block |
||
1078 | 1078 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1079 | 1079 | try { |
1080 | 1080 | $sthf = $Connection->db->prepare($queryf); |
1081 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1082 | - } catch(PDOException $e) { |
|
1081 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
1082 | + } catch (PDOException $e) { |
|
1083 | 1083 | return "error f : ".$e->getMessage(); |
1084 | 1084 | } |
1085 | 1085 | } |
@@ -1089,13 +1089,13 @@ discard block |
||
1089 | 1089 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1090 | 1090 | try { |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1093 | - } catch(PDOException $e) { |
|
1092 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
1093 | + } catch (PDOException $e) { |
|
1094 | 1094 | return "error i : ".$e->getMessage(); |
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | } |
1098 | - if ($i % 90 == 0) { |
|
1098 | + if ($i%90 == 0) { |
|
1099 | 1099 | if ($globalTransaction) $Connection->db->commit(); |
1100 | 1100 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1101 | 1101 | } |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | $Connection = new Connection(); |
1115 | 1115 | $sth = $Connection->db->prepare($query); |
1116 | 1116 | $sth->execute(array(':source' => 'website_fam')); |
1117 | - } catch(PDOException $e) { |
|
1117 | + } catch (PDOException $e) { |
|
1118 | 1118 | return "error : ".$e->getMessage(); |
1119 | 1119 | } |
1120 | 1120 | |
@@ -1135,8 +1135,8 @@ discard block |
||
1135 | 1135 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1136 | 1136 | try { |
1137 | 1137 | $sth = $Connection->db->prepare($query); |
1138 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1139 | - } catch(PDOException $e) { |
|
1138 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
1139 | + } catch (PDOException $e) { |
|
1140 | 1140 | return "error : ".$e->getMessage(); |
1141 | 1141 | } |
1142 | 1142 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $Connection = new Connection(); |
1156 | 1156 | $sth = $Connection->db->prepare($query); |
1157 | 1157 | $sth->execute(array(':source' => 'website_fam')); |
1158 | - } catch(PDOException $e) { |
|
1158 | + } catch (PDOException $e) { |
|
1159 | 1159 | return "error : ".$e->getMessage(); |
1160 | 1160 | } |
1161 | 1161 | |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1172 | 1172 | try { |
1173 | 1173 | $sth = $Connection->db->prepare($query); |
1174 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1175 | - } catch(PDOException $e) { |
|
1174 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1175 | + } catch (PDOException $e) { |
|
1176 | 1176 | //print_r($data); |
1177 | 1177 | return "error : ".$e->getMessage(); |
1178 | 1178 | } |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | $Connection = new Connection(); |
1193 | 1193 | $sth = $Connection->db->prepare($query); |
1194 | 1194 | $sth->execute(array(':source' => 'website_fam')); |
1195 | - } catch(PDOException $e) { |
|
1195 | + } catch (PDOException $e) { |
|
1196 | 1196 | return "error : ".$e->getMessage(); |
1197 | 1197 | } |
1198 | 1198 | $delimiter = "\t"; |
@@ -1207,9 +1207,9 @@ discard block |
||
1207 | 1207 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
1208 | 1208 | try { |
1209 | 1209 | $sth = $Connection->db->prepare($query); |
1210 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1211 | - } catch(PDOException $e) { |
|
1212 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1210 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
1211 | + } catch (PDOException $e) { |
|
1212 | + if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
|
1213 | 1213 | } |
1214 | 1214 | } |
1215 | 1215 | $i++; |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | $Connection = new Connection(); |
1228 | 1228 | $sth = $Connection->db->prepare($query); |
1229 | 1229 | $sth->execute(); |
1230 | - } catch(PDOException $e) { |
|
1230 | + } catch (PDOException $e) { |
|
1231 | 1231 | return "error : ".$e->getMessage(); |
1232 | 1232 | } |
1233 | 1233 | |
@@ -1248,8 +1248,8 @@ discard block |
||
1248 | 1248 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
1249 | 1249 | try { |
1250 | 1250 | $sth = $Connection->db->prepare($query); |
1251 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1252 | - } catch(PDOException $e) { |
|
1251 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
1252 | + } catch (PDOException $e) { |
|
1253 | 1253 | return "error : ".$e->getMessage(); |
1254 | 1254 | } |
1255 | 1255 | } |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $Connection = new Connection(); |
1269 | 1269 | $sth = $Connection->db->prepare($query); |
1270 | 1270 | $sth->execute(); |
1271 | - } catch(PDOException $e) { |
|
1271 | + } catch (PDOException $e) { |
|
1272 | 1272 | return "error : ".$e->getMessage(); |
1273 | 1273 | } |
1274 | 1274 | $delimiter = "\t"; |
@@ -1285,8 +1285,8 @@ discard block |
||
1285 | 1285 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1286 | 1286 | try { |
1287 | 1287 | $sth = $Connection->db->prepare($query); |
1288 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1289 | - } catch(PDOException $e) { |
|
1288 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1289 | + } catch (PDOException $e) { |
|
1290 | 1290 | return "error : ".$e->getMessage(); |
1291 | 1291 | } |
1292 | 1292 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | $Connection = new Connection(); |
1306 | 1306 | $sth = $Connection->db->prepare($query); |
1307 | 1307 | $sth->execute(); |
1308 | - } catch(PDOException $e) { |
|
1308 | + } catch (PDOException $e) { |
|
1309 | 1309 | return "error : ".$e->getMessage(); |
1310 | 1310 | } |
1311 | 1311 | |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | try { |
1322 | 1322 | $sth = $Connection->db->prepare($query); |
1323 | 1323 | $sth->execute(array(':icao' => $icao)); |
1324 | - } catch(PDOException $e) { |
|
1324 | + } catch (PDOException $e) { |
|
1325 | 1325 | return "error : ".$e->getMessage(); |
1326 | 1326 | } |
1327 | 1327 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | return ''; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - public static function tle($filename,$tletype) { |
|
1335 | + public static function tle($filename, $tletype) { |
|
1336 | 1336 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1337 | 1337 | global $tmp_dir, $globalTransaction; |
1338 | 1338 | //$Spotter = new Spotter(); |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | $Connection = new Connection(); |
1343 | 1343 | $sth = $Connection->db->prepare($query); |
1344 | 1344 | $sth->execute(array(':source' => $filename)); |
1345 | - } catch(PDOException $e) { |
|
1345 | + } catch (PDOException $e) { |
|
1346 | 1346 | return "error : ".$e->getMessage(); |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1367,8 +1367,8 @@ discard block |
||
1367 | 1367 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1368 | 1368 | try { |
1369 | 1369 | $sth = $Connection->db->prepare($query); |
1370 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1371 | - } catch(PDOException $e) { |
|
1370 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1371 | + } catch (PDOException $e) { |
|
1372 | 1372 | return "error : ".$e->getMessage(); |
1373 | 1373 | } |
1374 | 1374 | |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | $Connection = new Connection(); |
1389 | 1389 | $sth = $Connection->db->prepare($query); |
1390 | 1390 | $sth->execute(array(':source' => $filename)); |
1391 | - } catch(PDOException $e) { |
|
1391 | + } catch (PDOException $e) { |
|
1392 | 1392 | return "error : ".$e->getMessage(); |
1393 | 1393 | } |
1394 | 1394 | |
@@ -1399,13 +1399,13 @@ discard block |
||
1399 | 1399 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1400 | 1400 | //$Connection->db->beginTransaction(); |
1401 | 1401 | $dbdata = array(); |
1402 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
1402 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
1403 | 1403 | { |
1404 | 1404 | if ($i > 0 && $data[0] != '') { |
1405 | 1405 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1406 | - $period = str_replace(',','',$data[14]); |
|
1407 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1408 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1406 | + $period = str_replace(',', '', $data[14]); |
|
1407 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
1408 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
1409 | 1409 | else $launch_date = NULL; |
1410 | 1410 | $data = array_map(function($value) { |
1411 | 1411 | return trim($value) === '' ? null : $value; |
@@ -1415,8 +1415,8 @@ discard block |
||
1415 | 1415 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1416 | 1416 | try { |
1417 | 1417 | $sth = $Connection->db->prepare($query); |
1418 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1419 | - } catch(PDOException $e) { |
|
1418 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1419 | + } catch (PDOException $e) { |
|
1420 | 1420 | return "error : ".$e->getMessage(); |
1421 | 1421 | } |
1422 | 1422 | } |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
1456 | 1456 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
1457 | 1457 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
1458 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
1458 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
1459 | 1459 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
1460 | 1460 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
1461 | 1461 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1579,10 +1579,10 @@ discard block |
||
1579 | 1579 | while (($data = fgets($handle, 1000)) !== FALSE) |
1580 | 1580 | { |
1581 | 1581 | $result = array(); |
1582 | - $result['cospar'] = trim(substr($data,0,11)); |
|
1583 | - $result['norad'] = trim(substr($data,13,6)); |
|
1584 | - $result['operational'] = trim(substr($data,21,1)); |
|
1585 | - $result['name'] = trim(substr($data,23,24)); |
|
1582 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
1583 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
1584 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
1585 | + $result['name'] = trim(substr($data, 23, 24)); |
|
1586 | 1586 | /* |
1587 | 1587 | * R/B(1) = Rocket body, first stage |
1588 | 1588 | * R/B(2) = Rocket body, second stage |
@@ -1594,19 +1594,19 @@ discard block |
||
1594 | 1594 | * An ampersand (&) indicates two or more objects are attached |
1595 | 1595 | */ |
1596 | 1596 | |
1597 | - $owner_code = trim(substr($data,49,5)); |
|
1597 | + $owner_code = trim(substr($data, 49, 5)); |
|
1598 | 1598 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
1599 | 1599 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
1600 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
1601 | - $launch_site_code = trim(substr($data,68,5)); |
|
1600 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
1601 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
1602 | 1602 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
1603 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
1604 | - $result['period'] = trim(substr($data,87,7)); |
|
1605 | - $result['inclination'] = trim(substr($data,96,5)); |
|
1606 | - $result['apogee'] = trim(substr($data,103,6)); |
|
1607 | - $result['perigee'] = trim(substr($data,111,6)); |
|
1603 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
1604 | + $result['period'] = trim(substr($data, 87, 7)); |
|
1605 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
1606 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
1607 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
1608 | 1608 | //$result['radarcross'] = trim(substr($data,119,8)); |
1609 | - $result['status'] = trim(substr($data,129,3)); |
|
1609 | + $result['status'] = trim(substr($data, 129, 3)); |
|
1610 | 1610 | print_r($result); |
1611 | 1611 | $result = array_map(function($value) { |
1612 | 1612 | return trim($value) === '' ? null : $value; |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | $sth = $Connection->db->prepare($query); |
1620 | 1620 | $sth->execute(array(':cospar' => $result['cospar'])); |
1621 | 1621 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
1622 | - } catch(PDOException $e) { |
|
1622 | + } catch (PDOException $e) { |
|
1623 | 1623 | return "error : ".$e->getMessage(); |
1624 | 1624 | } |
1625 | 1625 | if (empty($exist)) { |
@@ -1631,10 +1631,10 @@ discard block |
||
1631 | 1631 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
1632 | 1632 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
1633 | 1633 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
1634 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1634 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1635 | 1635 | ) |
1636 | 1636 | ); |
1637 | - } catch(PDOException $e) { |
|
1637 | + } catch (PDOException $e) { |
|
1638 | 1638 | return "error : ".$e->getMessage(); |
1639 | 1639 | } |
1640 | 1640 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1642,8 +1642,8 @@ discard block |
||
1642 | 1642 | try { |
1643 | 1643 | $Connection = new Connection(); |
1644 | 1644 | $sth = $Connection->db->prepare($query); |
1645 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
1646 | - } catch(PDOException $e) { |
|
1645 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
1646 | + } catch (PDOException $e) { |
|
1647 | 1647 | return "error : ".$e->getMessage(); |
1648 | 1648 | } |
1649 | 1649 | } |
@@ -1761,13 +1761,13 @@ discard block |
||
1761 | 1761 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1762 | 1762 | { |
1763 | 1763 | $i++; |
1764 | - if($i > 3 && count($row) > 2) { |
|
1764 | + if ($i > 3 && count($row) > 2) { |
|
1765 | 1765 | $data = array_values(array_filter($row)); |
1766 | 1766 | $cntdata = count($data); |
1767 | 1767 | if ($cntdata > 10) { |
1768 | 1768 | $value = $data[9]; |
1769 | 1769 | |
1770 | - for ($i =10;$i < $cntdata;$i++) { |
|
1770 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1771 | 1771 | $value .= ' '.$data[$i]; |
1772 | 1772 | } |
1773 | 1773 | $data[9] = $value; |
@@ -1777,8 +1777,8 @@ discard block |
||
1777 | 1777 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
1778 | 1778 | try { |
1779 | 1779 | $sth = $Connection->db->prepare($query); |
1780 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1781 | - } catch(PDOException $e) { |
|
1780 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1781 | + } catch (PDOException $e) { |
|
1782 | 1782 | return "error : ".$e->getMessage(); |
1783 | 1783 | } |
1784 | 1784 | } |
@@ -1799,7 +1799,7 @@ discard block |
||
1799 | 1799 | $Connection = new Connection(); |
1800 | 1800 | $sth = $Connection->db->prepare($query); |
1801 | 1801 | $sth->execute(); |
1802 | - } catch(PDOException $e) { |
|
1802 | + } catch (PDOException $e) { |
|
1803 | 1803 | return "error : ".$e->getMessage(); |
1804 | 1804 | } |
1805 | 1805 | |
@@ -1811,12 +1811,12 @@ discard block |
||
1811 | 1811 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1812 | 1812 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1813 | 1813 | { |
1814 | - if(count($row) > 1) { |
|
1814 | + if (count($row) > 1) { |
|
1815 | 1815 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1816 | 1816 | try { |
1817 | 1817 | $sth = $Connection->db->prepare($query); |
1818 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1819 | - } catch(PDOException $e) { |
|
1818 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1819 | + } catch (PDOException $e) { |
|
1820 | 1820 | return "error : ".$e->getMessage(); |
1821 | 1821 | } |
1822 | 1822 | } |
@@ -1836,21 +1836,21 @@ discard block |
||
1836 | 1836 | try { |
1837 | 1837 | $sth = $Connection->db->prepare($query); |
1838 | 1838 | $sth->execute(); |
1839 | - } catch(PDOException $e) { |
|
1839 | + } catch (PDOException $e) { |
|
1840 | 1840 | return "error : ".$e->getMessage(); |
1841 | 1841 | } |
1842 | 1842 | } |
1843 | 1843 | |
1844 | 1844 | |
1845 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1845 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1846 | 1846 | else { |
1847 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1847 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1848 | 1848 | $query = "CREATE EXTENSION postgis"; |
1849 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1849 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1850 | 1850 | try { |
1851 | 1851 | $sth = $Connection->db->prepare($query); |
1852 | 1852 | $sth->execute(); |
1853 | - } catch(PDOException $e) { |
|
1853 | + } catch (PDOException $e) { |
|
1854 | 1854 | return "error : ".$e->getMessage(); |
1855 | 1855 | } |
1856 | 1856 | } |
@@ -1863,7 +1863,7 @@ discard block |
||
1863 | 1863 | include_once('class.create_db.php'); |
1864 | 1864 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1865 | 1865 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1866 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1866 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1867 | 1867 | $error = ''; |
1868 | 1868 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1869 | 1869 | if ($globalDebug) echo "Gunzip..."; |
@@ -1895,14 +1895,14 @@ discard block |
||
1895 | 1895 | try { |
1896 | 1896 | $sth = $Connection->db->prepare($query); |
1897 | 1897 | $sth->execute(); |
1898 | - } catch(PDOException $e) { |
|
1898 | + } catch (PDOException $e) { |
|
1899 | 1899 | echo "error : ".$e->getMessage(); |
1900 | 1900 | } |
1901 | 1901 | } |
1902 | 1902 | if ($globalDBdriver == 'mysql') { |
1903 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1903 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1904 | 1904 | } else { |
1905 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1905 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1906 | 1906 | } |
1907 | 1907 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1908 | 1908 | return $error; |
@@ -1915,7 +1915,7 @@ discard block |
||
1915 | 1915 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1916 | 1916 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1917 | 1917 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
1918 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
1918 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
1919 | 1919 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1920 | 1920 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1921 | 1921 | return $error; |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1936 | 1936 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1937 | 1937 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1938 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1938 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1939 | 1939 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1940 | 1940 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1941 | 1941 | if ($error != '') { |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | global $tmp_dir, $globalDebug; |
1949 | 1949 | $error = ''; |
1950 | 1950 | if ($globalDebug) echo "Routes : Download..."; |
1951 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1951 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1952 | 1952 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1953 | 1953 | if ($globalDebug) echo "Gunzip..."; |
1954 | 1954 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | global $tmp_dir, $globalDebug; |
1965 | 1965 | $error = ''; |
1966 | 1966 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1967 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1967 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1968 | 1968 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1969 | 1969 | if ($globalDebug) echo "Gunzip..."; |
1970 | 1970 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1980,7 +1980,7 @@ discard block |
||
1980 | 1980 | global $tmp_dir, $globalDebug; |
1981 | 1981 | $error = ''; |
1982 | 1982 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1983 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1983 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1984 | 1984 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1985 | 1985 | if ($globalDebug) echo "Gunzip..."; |
1986 | 1986 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2008,7 +2008,7 @@ discard block |
||
2008 | 2008 | */ |
2009 | 2009 | if ($globalDebug) echo "Modes : Download..."; |
2010 | 2010 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
2011 | - update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
2011 | + update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
2012 | 2012 | |
2013 | 2013 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2014 | 2014 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2028,7 +2028,7 @@ discard block |
||
2028 | 2028 | public static function update_ModeS_faa() { |
2029 | 2029 | global $tmp_dir, $globalDebug; |
2030 | 2030 | if ($globalDebug) echo "Modes FAA: Download..."; |
2031 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
2031 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
2032 | 2032 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2033 | 2033 | if ($globalDebug) echo "Unzip..."; |
2034 | 2034 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2044,7 +2044,7 @@ discard block |
||
2044 | 2044 | public static function update_ModeS_flarm() { |
2045 | 2045 | global $tmp_dir, $globalDebug; |
2046 | 2046 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
2047 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
2047 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
2048 | 2048 | if (file_exists($tmp_dir.'data.fln')) { |
2049 | 2049 | if ($globalDebug) echo "Add to DB..."; |
2050 | 2050 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | public static function update_ModeS_ogn() { |
2059 | 2059 | global $tmp_dir, $globalDebug; |
2060 | 2060 | if ($globalDebug) echo "Modes OGN: Download..."; |
2061 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
2061 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
2062 | 2062 | if (file_exists($tmp_dir.'ogn.csv')) { |
2063 | 2063 | if ($globalDebug) echo "Add to DB..."; |
2064 | 2064 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2073,201 +2073,201 @@ discard block |
||
2073 | 2073 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2074 | 2074 | |
2075 | 2075 | if ($globalDebug) echo "Owner France: Download..."; |
2076 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
2076 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
2077 | 2077 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2078 | 2078 | if ($globalDebug) echo "Add to DB..."; |
2079 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
2079 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
2080 | 2080 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
2081 | 2081 | if ($error != '') { |
2082 | 2082 | return $error; |
2083 | 2083 | } elseif ($globalDebug) echo "Done\n"; |
2084 | 2084 | |
2085 | 2085 | if ($globalDebug) echo "Owner Ireland: Download..."; |
2086 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
2086 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
2087 | 2087 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2088 | 2088 | if ($globalDebug) echo "Add to DB..."; |
2089 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
2089 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
2090 | 2090 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
2091 | 2091 | if ($error != '') { |
2092 | 2092 | return $error; |
2093 | 2093 | } elseif ($globalDebug) echo "Done\n"; |
2094 | 2094 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
2095 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
2095 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
2096 | 2096 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2097 | 2097 | if ($globalDebug) echo "Add to DB..."; |
2098 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
2098 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
2099 | 2099 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
2100 | 2100 | if ($error != '') { |
2101 | 2101 | return $error; |
2102 | 2102 | } elseif ($globalDebug) echo "Done\n"; |
2103 | 2103 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
2104 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
2104 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
2105 | 2105 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2106 | 2106 | if ($globalDebug) echo "Add to DB..."; |
2107 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
2107 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
2108 | 2108 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
2109 | 2109 | if ($error != '') { |
2110 | 2110 | return $error; |
2111 | 2111 | } elseif ($globalDebug) echo "Done\n"; |
2112 | 2112 | if ($globalDebug) echo "Owner Australia: Download..."; |
2113 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
2113 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
2114 | 2114 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2115 | 2115 | if ($globalDebug) echo "Add to DB..."; |
2116 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
2116 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
2117 | 2117 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
2118 | 2118 | if ($error != '') { |
2119 | 2119 | return $error; |
2120 | 2120 | } elseif ($globalDebug) echo "Done\n"; |
2121 | 2121 | if ($globalDebug) echo "Owner Austria: Download..."; |
2122 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
2122 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
2123 | 2123 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2124 | 2124 | if ($globalDebug) echo "Add to DB..."; |
2125 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
2125 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
2126 | 2126 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
2127 | 2127 | if ($error != '') { |
2128 | 2128 | return $error; |
2129 | 2129 | } elseif ($globalDebug) echo "Done\n"; |
2130 | 2130 | if ($globalDebug) echo "Owner Chile: Download..."; |
2131 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
2131 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
2132 | 2132 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2133 | 2133 | if ($globalDebug) echo "Add to DB..."; |
2134 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
2134 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
2135 | 2135 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
2136 | 2136 | if ($error != '') { |
2137 | 2137 | return $error; |
2138 | 2138 | } elseif ($globalDebug) echo "Done\n"; |
2139 | 2139 | if ($globalDebug) echo "Owner Colombia: Download..."; |
2140 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
2140 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
2141 | 2141 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2142 | 2142 | if ($globalDebug) echo "Add to DB..."; |
2143 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
2143 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
2144 | 2144 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
2145 | 2145 | if ($error != '') { |
2146 | 2146 | return $error; |
2147 | 2147 | } elseif ($globalDebug) echo "Done\n"; |
2148 | 2148 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
2149 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
2149 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
2150 | 2150 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2151 | 2151 | if ($globalDebug) echo "Add to DB..."; |
2152 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
2152 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
2153 | 2153 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
2154 | 2154 | if ($error != '') { |
2155 | 2155 | return $error; |
2156 | 2156 | } elseif ($globalDebug) echo "Done\n"; |
2157 | 2157 | if ($globalDebug) echo "Owner Brazil: Download..."; |
2158 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
2158 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
2159 | 2159 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2160 | 2160 | if ($globalDebug) echo "Add to DB..."; |
2161 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
2161 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
2162 | 2162 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
2163 | 2163 | if ($error != '') { |
2164 | 2164 | return $error; |
2165 | 2165 | } elseif ($globalDebug) echo "Done\n"; |
2166 | 2166 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
2167 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
2167 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
2168 | 2168 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2169 | 2169 | if ($globalDebug) echo "Add to DB..."; |
2170 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
2170 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
2171 | 2171 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
2172 | 2172 | if ($error != '') { |
2173 | 2173 | return $error; |
2174 | 2174 | } elseif ($globalDebug) echo "Done\n"; |
2175 | 2175 | if ($globalDebug) echo "Owner Croatia: Download..."; |
2176 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
2176 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
2177 | 2177 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2178 | 2178 | if ($globalDebug) echo "Add to DB..."; |
2179 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
2179 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
2180 | 2180 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
2181 | 2181 | if ($error != '') { |
2182 | 2182 | return $error; |
2183 | 2183 | } elseif ($globalDebug) echo "Done\n"; |
2184 | 2184 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
2185 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
2185 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
2186 | 2186 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2187 | 2187 | if ($globalDebug) echo "Add to DB..."; |
2188 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
2188 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
2189 | 2189 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
2190 | 2190 | if ($error != '') { |
2191 | 2191 | return $error; |
2192 | 2192 | } elseif ($globalDebug) echo "Done\n"; |
2193 | 2193 | if ($globalDebug) echo "Owner Maldives: Download..."; |
2194 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
2194 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
2195 | 2195 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2196 | 2196 | if ($globalDebug) echo "Add to DB..."; |
2197 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
2197 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
2198 | 2198 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
2199 | 2199 | if ($error != '') { |
2200 | 2200 | return $error; |
2201 | 2201 | } elseif ($globalDebug) echo "Done\n"; |
2202 | 2202 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
2203 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
2203 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
2204 | 2204 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2205 | 2205 | if ($globalDebug) echo "Add to DB..."; |
2206 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
2206 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
2207 | 2207 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
2208 | 2208 | if ($error != '') { |
2209 | 2209 | return $error; |
2210 | 2210 | } elseif ($globalDebug) echo "Done\n"; |
2211 | 2211 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
2212 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
2212 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
2213 | 2213 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2214 | 2214 | if ($globalDebug) echo "Add to DB..."; |
2215 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
2215 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
2216 | 2216 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
2217 | 2217 | if ($error != '') { |
2218 | 2218 | return $error; |
2219 | 2219 | } elseif ($globalDebug) echo "Done\n"; |
2220 | 2220 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
2221 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
2221 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
2222 | 2222 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2223 | 2223 | if ($globalDebug) echo "Add to DB..."; |
2224 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
2224 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
2225 | 2225 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
2226 | 2226 | if ($error != '') { |
2227 | 2227 | return $error; |
2228 | 2228 | } elseif ($globalDebug) echo "Done\n"; |
2229 | 2229 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
2230 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
2230 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
2231 | 2231 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2232 | 2232 | if ($globalDebug) echo "Add to DB..."; |
2233 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
2233 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
2234 | 2234 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
2235 | 2235 | if ($error != '') { |
2236 | 2236 | return $error; |
2237 | 2237 | } elseif ($globalDebug) echo "Done\n"; |
2238 | 2238 | if ($globalDebug) echo "Owner Iceland: Download..."; |
2239 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
2239 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
2240 | 2240 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2241 | 2241 | if ($globalDebug) echo "Add to DB..."; |
2242 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
2242 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
2243 | 2243 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
2244 | 2244 | if ($error != '') { |
2245 | 2245 | return $error; |
2246 | 2246 | } elseif ($globalDebug) echo "Done\n"; |
2247 | 2247 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
2248 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
2248 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
2249 | 2249 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2250 | 2250 | if ($globalDebug) echo "Add to DB..."; |
2251 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
2251 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
2252 | 2252 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
2253 | 2253 | if ($error != '') { |
2254 | 2254 | return $error; |
2255 | 2255 | } elseif ($globalDebug) echo "Done\n"; |
2256 | 2256 | if ($globalMasterSource) { |
2257 | 2257 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
2258 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
2258 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
2259 | 2259 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2260 | 2260 | if ($globalDebug) echo "Add to DB..."; |
2261 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
2261 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
2262 | 2262 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
2263 | 2263 | if ($error != '') { |
2264 | 2264 | return $error; |
2265 | 2265 | } elseif ($globalDebug) echo "Done\n"; |
2266 | 2266 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
2267 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
2267 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
2268 | 2268 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2269 | 2269 | if ($globalDebug) echo "Add to DB..."; |
2270 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
2270 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
2271 | 2271 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
2272 | 2272 | if ($error != '') { |
2273 | 2273 | return $error; |
@@ -2280,7 +2280,7 @@ discard block |
||
2280 | 2280 | global $tmp_dir, $globalDebug; |
2281 | 2281 | $error = ''; |
2282 | 2282 | if ($globalDebug) echo "Translation : Download..."; |
2283 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
2283 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
2284 | 2284 | if (file_exists($tmp_dir.'translation.zip')) { |
2285 | 2285 | if ($globalDebug) echo "Unzip..."; |
2286 | 2286 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2296,7 +2296,7 @@ discard block |
||
2296 | 2296 | public static function update_translation_fam() { |
2297 | 2297 | global $tmp_dir, $globalDebug; |
2298 | 2298 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
2299 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
2299 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
2300 | 2300 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
2301 | 2301 | if ($globalDebug) echo "Gunzip..."; |
2302 | 2302 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -2311,7 +2311,7 @@ discard block |
||
2311 | 2311 | public static function update_ModeS_fam() { |
2312 | 2312 | global $tmp_dir, $globalDebug; |
2313 | 2313 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
2314 | - update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
2314 | + update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
2315 | 2315 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
2316 | 2316 | if ($globalDebug) echo "Gunzip..."; |
2317 | 2317 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -2327,9 +2327,9 @@ discard block |
||
2327 | 2327 | global $tmp_dir, $globalDebug, $globalOwner; |
2328 | 2328 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
2329 | 2329 | if ($globalOwner === TRUE) { |
2330 | - update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2330 | + update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2331 | 2331 | } else { |
2332 | - update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2332 | + update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2333 | 2333 | } |
2334 | 2334 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
2335 | 2335 | if ($globalDebug) echo "Gunzip..."; |
@@ -2345,7 +2345,7 @@ discard block |
||
2345 | 2345 | public static function update_routes_fam() { |
2346 | 2346 | global $tmp_dir, $globalDebug; |
2347 | 2347 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2348 | - update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2348 | + update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2349 | 2349 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2350 | 2350 | if ($globalDebug) echo "Gunzip..."; |
2351 | 2351 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -2359,13 +2359,13 @@ discard block |
||
2359 | 2359 | } |
2360 | 2360 | public static function update_marine_identity_fam() { |
2361 | 2361 | global $tmp_dir, $globalDebug; |
2362 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2362 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2363 | 2363 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2364 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2364 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2365 | 2365 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2366 | 2366 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2367 | 2367 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2368 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2368 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2369 | 2369 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2370 | 2370 | if ($globalDebug) echo "Gunzip..."; |
2371 | 2371 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
@@ -2385,13 +2385,13 @@ discard block |
||
2385 | 2385 | |
2386 | 2386 | public static function update_satellite_fam() { |
2387 | 2387 | global $tmp_dir, $globalDebug; |
2388 | - update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
2388 | + update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
2389 | 2389 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
2390 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2390 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2391 | 2391 | $satellite_md5 = $satellite_md5_file[0]; |
2392 | 2392 | if (!update_db::check_satellite_version($marine_identity_md5)) { |
2393 | 2393 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
2394 | - update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
2394 | + update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
2395 | 2395 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2396 | 2396 | if ($globalDebug) echo "Gunzip..."; |
2397 | 2397 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
@@ -2411,7 +2411,7 @@ discard block |
||
2411 | 2411 | public static function update_banned_fam() { |
2412 | 2412 | global $tmp_dir, $globalDebug; |
2413 | 2413 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2414 | - update_db::download('http://data.flightairmap.fr/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2414 | + update_db::download('http://data.flightairmap.fr/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2415 | 2415 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2416 | 2416 | //if ($globalDebug) echo "Gunzip..."; |
2417 | 2417 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2430,18 +2430,18 @@ discard block |
||
2430 | 2430 | $error = ''; |
2431 | 2431 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2432 | 2432 | if ($globalDBdriver == 'mysql') { |
2433 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2433 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2434 | 2434 | } else { |
2435 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2435 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2436 | 2436 | } |
2437 | 2437 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2438 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2438 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2439 | 2439 | $airspace_md5 = $airspace_md5_file[0]; |
2440 | 2440 | if (!update_db::check_airspace_version($airspace_md5)) { |
2441 | 2441 | if ($globalDBdriver == 'mysql') { |
2442 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2442 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2443 | 2443 | } else { |
2444 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2444 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2445 | 2445 | } |
2446 | 2446 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2447 | 2447 | if ($globalDebug) echo "Gunzip..."; |
@@ -2453,7 +2453,7 @@ discard block |
||
2453 | 2453 | try { |
2454 | 2454 | $sth = $Connection->db->prepare($query); |
2455 | 2455 | $sth->execute(); |
2456 | - } catch(PDOException $e) { |
|
2456 | + } catch (PDOException $e) { |
|
2457 | 2457 | return "error : ".$e->getMessage(); |
2458 | 2458 | } |
2459 | 2459 | } |
@@ -2472,15 +2472,15 @@ discard block |
||
2472 | 2472 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2473 | 2473 | $error = ''; |
2474 | 2474 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
2475 | - update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2475 | + update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2476 | 2476 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2477 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2477 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2478 | 2478 | $geoid_md5 = $geoid_md5_file[0]; |
2479 | 2479 | if (!update_db::check_geoid_version($geoid_md5)) { |
2480 | - update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2480 | + update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2481 | 2481 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2482 | 2482 | if ($globalDebug) echo "Gunzip..."; |
2483 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2483 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2484 | 2484 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2485 | 2485 | update_db::insert_geoid_version($geoid_md5); |
2486 | 2486 | } |
@@ -2496,15 +2496,15 @@ discard block |
||
2496 | 2496 | public static function update_tle() { |
2497 | 2497 | global $tmp_dir, $globalDebug; |
2498 | 2498 | if ($globalDebug) echo "Download TLE : Download..."; |
2499 | - $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
2500 | - 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
2501 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
|
2499 | + $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
2500 | + 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
2501 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt', 'visual.txt', 'sarsat.txt', 'argos.txt', 'ses.txt', 'iridium-NEXT.txt', 'beidou.txt'); |
|
2502 | 2502 | foreach ($alltle as $filename) { |
2503 | 2503 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2504 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2504 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2505 | 2505 | if (file_exists($tmp_dir.$filename)) { |
2506 | 2506 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2507 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2507 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2508 | 2508 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2509 | 2509 | if ($error != '') { |
2510 | 2510 | echo $error."\n"; |
@@ -2516,7 +2516,7 @@ discard block |
||
2516 | 2516 | public static function update_ucsdb() { |
2517 | 2517 | global $tmp_dir, $globalDebug; |
2518 | 2518 | if ($globalDebug) echo "Download UCS DB : Download..."; |
2519 | - update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2519 | + update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt', $tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2520 | 2520 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2521 | 2521 | if ($globalDebug) echo "Add to DB..."; |
2522 | 2522 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
@@ -2530,7 +2530,7 @@ discard block |
||
2530 | 2530 | public static function update_celestrak() { |
2531 | 2531 | global $tmp_dir, $globalDebug; |
2532 | 2532 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
2533 | - update_db::download('https://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
2533 | + update_db::download('https://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
2534 | 2534 | if (file_exists($tmp_dir.'satcat.txt')) { |
2535 | 2535 | if ($globalDebug) echo "Add to DB..."; |
2536 | 2536 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2545,32 +2545,32 @@ discard block |
||
2545 | 2545 | global $tmp_dir, $globalDebug; |
2546 | 2546 | $error = ''; |
2547 | 2547 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2548 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2548 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2549 | 2549 | if (file_exists($tmp_dir.'models.md5sum')) { |
2550 | 2550 | if ($globalDebug) echo "Check files...\n"; |
2551 | 2551 | $newmodelsdb = array(); |
2552 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2553 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2552 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2553 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2554 | 2554 | $model = trim($row[2]); |
2555 | 2555 | $newmodelsdb[$model] = trim($row[0]); |
2556 | 2556 | } |
2557 | 2557 | } |
2558 | 2558 | $modelsdb = array(); |
2559 | 2559 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2560 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2561 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2560 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2561 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2562 | 2562 | $model = trim($row[2]); |
2563 | 2563 | $modelsdb[$model] = trim($row[0]); |
2564 | 2564 | } |
2565 | 2565 | } |
2566 | 2566 | } |
2567 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2567 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2568 | 2568 | foreach ($diff as $key => $value) { |
2569 | 2569 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2570 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2570 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2571 | 2571 | |
2572 | 2572 | } |
2573 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2573 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2574 | 2574 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2575 | 2575 | if ($error != '') { |
2576 | 2576 | return $error; |
@@ -2582,32 +2582,32 @@ discard block |
||
2582 | 2582 | global $tmp_dir, $globalDebug; |
2583 | 2583 | $error = ''; |
2584 | 2584 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2585 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2585 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2586 | 2586 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2587 | 2587 | if ($globalDebug) echo "Check files...\n"; |
2588 | 2588 | $newmodelsdb = array(); |
2589 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2590 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2589 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2590 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2591 | 2591 | $model = trim($row[2]); |
2592 | 2592 | $newmodelsdb[$model] = trim($row[0]); |
2593 | 2593 | } |
2594 | 2594 | } |
2595 | 2595 | $modelsdb = array(); |
2596 | 2596 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2597 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2598 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2597 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2598 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2599 | 2599 | $model = trim($row[2]); |
2600 | 2600 | $modelsdb[$model] = trim($row[0]); |
2601 | 2601 | } |
2602 | 2602 | } |
2603 | 2603 | } |
2604 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2604 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2605 | 2605 | foreach ($diff as $key => $value) { |
2606 | 2606 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2607 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2607 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2608 | 2608 | |
2609 | 2609 | } |
2610 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2610 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2611 | 2611 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2612 | 2612 | if ($error != '') { |
2613 | 2613 | return $error; |
@@ -2619,32 +2619,32 @@ discard block |
||
2619 | 2619 | global $tmp_dir, $globalDebug; |
2620 | 2620 | $error = ''; |
2621 | 2621 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2622 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2622 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2623 | 2623 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2624 | 2624 | if ($globalDebug) echo "Check files...\n"; |
2625 | 2625 | $newmodelsdb = array(); |
2626 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2627 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2626 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2627 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2628 | 2628 | $model = trim($row[2]); |
2629 | 2629 | $newmodelsdb[$model] = trim($row[0]); |
2630 | 2630 | } |
2631 | 2631 | } |
2632 | 2632 | $modelsdb = array(); |
2633 | 2633 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2634 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2635 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2634 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2635 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2636 | 2636 | $model = trim($row[2]); |
2637 | 2637 | $modelsdb[$model] = trim($row[0]); |
2638 | 2638 | } |
2639 | 2639 | } |
2640 | 2640 | } |
2641 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2641 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2642 | 2642 | foreach ($diff as $key => $value) { |
2643 | 2643 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2644 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2644 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2645 | 2645 | |
2646 | 2646 | } |
2647 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2647 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2648 | 2648 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2649 | 2649 | if ($error != '') { |
2650 | 2650 | return $error; |
@@ -2667,8 +2667,8 @@ discard block |
||
2667 | 2667 | */ |
2668 | 2668 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2669 | 2669 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2670 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2671 | - $result = fread($fh,100000000); |
|
2670 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2671 | + $result = fread($fh, 100000000); |
|
2672 | 2672 | //echo $result; |
2673 | 2673 | //var_dump(str_get_html($result)); |
2674 | 2674 | //print_r(self::table2array($result)); |
@@ -2686,23 +2686,23 @@ discard block |
||
2686 | 2686 | $Connection = new Connection(); |
2687 | 2687 | $sth = $Connection->db->prepare($query); |
2688 | 2688 | $sth->execute(); |
2689 | - } catch(PDOException $e) { |
|
2689 | + } catch (PDOException $e) { |
|
2690 | 2690 | return "error : ".$e->getMessage(); |
2691 | 2691 | } |
2692 | 2692 | |
2693 | 2693 | $error = ''; |
2694 | 2694 | if ($globalDebug) echo "Notam : Download..."; |
2695 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2695 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2696 | 2696 | if (file_exists($tmp_dir.'notam.rss')) { |
2697 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2697 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2698 | 2698 | foreach ($notams['channel']['item'] as $notam) { |
2699 | - $title = explode(':',$notam['title']); |
|
2699 | + $title = explode(':', $notam['title']); |
|
2700 | 2700 | $data['ref'] = trim($title[0]); |
2701 | 2701 | unset($title[0]); |
2702 | - $data['title'] = trim(implode(':',$title)); |
|
2703 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2704 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2705 | - $q = explode('/',$match[1]); |
|
2702 | + $data['title'] = trim(implode(':', $title)); |
|
2703 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2704 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2705 | + $q = explode('/', $match[1]); |
|
2706 | 2706 | $data['fir'] = $q[0]; |
2707 | 2707 | $data['code'] = $q[1]; |
2708 | 2708 | $ifrvfr = $q[2]; |
@@ -2718,30 +2718,30 @@ discard block |
||
2718 | 2718 | $data['lower_limit'] = $q[5]; |
2719 | 2719 | $data['upper_limit'] = $q[6]; |
2720 | 2720 | $latlonrad = $q[7]; |
2721 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2722 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2723 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2721 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2722 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2723 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2724 | 2724 | if ($lac == 'S') $latitude = '-'.$latitude; |
2725 | 2725 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2726 | 2726 | $data['center_latitude'] = $latitude; |
2727 | 2727 | $data['center_longitude'] = $longitude; |
2728 | 2728 | $data['radius'] = intval($radius); |
2729 | 2729 | |
2730 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2730 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2731 | 2731 | $data['text'] = $match[1]; |
2732 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2732 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2733 | 2733 | $fromto = $match[1]; |
2734 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2734 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2735 | 2735 | $fromall = trim($match[1]); |
2736 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2736 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2737 | 2737 | $from = trim($match[1]); |
2738 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2739 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2738 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2739 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2740 | 2740 | $toall = trim($match[1]); |
2741 | - if (!preg_match(':Permanent:',$toall)) { |
|
2742 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2741 | + if (!preg_match(':Permanent:', $toall)) { |
|
2742 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2743 | 2743 | $to = trim($match[1]); |
2744 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2744 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2745 | 2745 | $data['permanent'] = 0; |
2746 | 2746 | } else { |
2747 | 2747 | $data['date_end'] = NULL; |
@@ -2749,7 +2749,7 @@ discard block |
||
2749 | 2749 | } |
2750 | 2750 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2751 | 2751 | $NOTAM = new NOTAM(); |
2752 | - $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
2752 | + $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
2753 | 2753 | unset($data); |
2754 | 2754 | } |
2755 | 2755 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2772,16 +2772,16 @@ discard block |
||
2772 | 2772 | $Connection = new Connection(); |
2773 | 2773 | $sth = $Connection->db->prepare($query); |
2774 | 2774 | $sth->execute(); |
2775 | - } catch(PDOException $e) { |
|
2775 | + } catch (PDOException $e) { |
|
2776 | 2776 | return "error : ".$e->getMessage(); |
2777 | 2777 | } |
2778 | 2778 | } |
2779 | 2779 | $Common = new Common(); |
2780 | 2780 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2781 | - $airspace_json = json_decode($airspace_lst,true); |
|
2781 | + $airspace_json = json_decode($airspace_lst, true); |
|
2782 | 2782 | foreach ($airspace_json['records'] as $airspace) { |
2783 | 2783 | if ($globalDebug) echo $airspace['name']."...\n"; |
2784 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2784 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2785 | 2785 | if (file_exists($tmp_dir.$airspace['name'])) { |
2786 | 2786 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2787 | 2787 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2803,7 +2803,7 @@ discard block |
||
2803 | 2803 | $Connection = new Connection(); |
2804 | 2804 | $sth = $Connection->db->prepare($query); |
2805 | 2805 | $sth->execute(array(':new' => $new, ':old' => $old)); |
2806 | - } catch(PDOException $e) { |
|
2806 | + } catch (PDOException $e) { |
|
2807 | 2807 | return "error : ".$e->getMessage(); |
2808 | 2808 | } |
2809 | 2809 | } |
@@ -2820,7 +2820,7 @@ discard block |
||
2820 | 2820 | $Connection = new Connection(); |
2821 | 2821 | $sth = $Connection->db->prepare($query); |
2822 | 2822 | $sth->execute(); |
2823 | - } catch(PDOException $e) { |
|
2823 | + } catch (PDOException $e) { |
|
2824 | 2824 | return "error : ".$e->getMessage(); |
2825 | 2825 | } |
2826 | 2826 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2835,7 +2835,7 @@ discard block |
||
2835 | 2835 | $Connection = new Connection(); |
2836 | 2836 | $sth = $Connection->db->prepare($query); |
2837 | 2837 | $sth->execute(); |
2838 | - } catch(PDOException $e) { |
|
2838 | + } catch (PDOException $e) { |
|
2839 | 2839 | return "error : ".$e->getMessage(); |
2840 | 2840 | } |
2841 | 2841 | } |
@@ -2846,7 +2846,7 @@ discard block |
||
2846 | 2846 | $Connection = new Connection(); |
2847 | 2847 | $sth = $Connection->db->prepare($query); |
2848 | 2848 | $sth->execute(array(':version' => $version)); |
2849 | - } catch(PDOException $e) { |
|
2849 | + } catch (PDOException $e) { |
|
2850 | 2850 | return "error : ".$e->getMessage(); |
2851 | 2851 | } |
2852 | 2852 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2860,7 +2860,7 @@ discard block |
||
2860 | 2860 | $Connection = new Connection(); |
2861 | 2861 | $sth = $Connection->db->prepare($query); |
2862 | 2862 | $sth->execute(array(':version' => $version)); |
2863 | - } catch(PDOException $e) { |
|
2863 | + } catch (PDOException $e) { |
|
2864 | 2864 | return "error : ".$e->getMessage(); |
2865 | 2865 | } |
2866 | 2866 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2874,7 +2874,7 @@ discard block |
||
2874 | 2874 | $Connection = new Connection(); |
2875 | 2875 | $sth = $Connection->db->prepare($query); |
2876 | 2876 | $sth->execute(array(':version' => $version)); |
2877 | - } catch(PDOException $e) { |
|
2877 | + } catch (PDOException $e) { |
|
2878 | 2878 | return "error : ".$e->getMessage(); |
2879 | 2879 | } |
2880 | 2880 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2888,7 +2888,7 @@ discard block |
||
2888 | 2888 | $Connection = new Connection(); |
2889 | 2889 | $sth = $Connection->db->prepare($query); |
2890 | 2890 | $sth->execute(array(':version' => $version)); |
2891 | - } catch(PDOException $e) { |
|
2891 | + } catch (PDOException $e) { |
|
2892 | 2892 | return "error : ".$e->getMessage(); |
2893 | 2893 | } |
2894 | 2894 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2904,7 +2904,7 @@ discard block |
||
2904 | 2904 | $Connection = new Connection(); |
2905 | 2905 | $sth = $Connection->db->prepare($query); |
2906 | 2906 | $sth->execute(array(':version' => $version)); |
2907 | - } catch(PDOException $e) { |
|
2907 | + } catch (PDOException $e) { |
|
2908 | 2908 | return "error : ".$e->getMessage(); |
2909 | 2909 | } |
2910 | 2910 | } |
@@ -2916,7 +2916,7 @@ discard block |
||
2916 | 2916 | $Connection = new Connection(); |
2917 | 2917 | $sth = $Connection->db->prepare($query); |
2918 | 2918 | $sth->execute(array(':version' => $version)); |
2919 | - } catch(PDOException $e) { |
|
2919 | + } catch (PDOException $e) { |
|
2920 | 2920 | return "error : ".$e->getMessage(); |
2921 | 2921 | } |
2922 | 2922 | } |
@@ -2928,7 +2928,7 @@ discard block |
||
2928 | 2928 | $Connection = new Connection(); |
2929 | 2929 | $sth = $Connection->db->prepare($query); |
2930 | 2930 | $sth->execute(array(':version' => $version)); |
2931 | - } catch(PDOException $e) { |
|
2931 | + } catch (PDOException $e) { |
|
2932 | 2932 | return "error : ".$e->getMessage(); |
2933 | 2933 | } |
2934 | 2934 | } |
@@ -2940,7 +2940,7 @@ discard block |
||
2940 | 2940 | $Connection = new Connection(); |
2941 | 2941 | $sth = $Connection->db->prepare($query); |
2942 | 2942 | $sth->execute(array(':version' => $version)); |
2943 | - } catch(PDOException $e) { |
|
2943 | + } catch (PDOException $e) { |
|
2944 | 2944 | return "error : ".$e->getMessage(); |
2945 | 2945 | } |
2946 | 2946 | } |
@@ -2956,7 +2956,7 @@ discard block |
||
2956 | 2956 | $Connection = new Connection(); |
2957 | 2957 | $sth = $Connection->db->prepare($query); |
2958 | 2958 | $sth->execute(); |
2959 | - } catch(PDOException $e) { |
|
2959 | + } catch (PDOException $e) { |
|
2960 | 2960 | return "error : ".$e->getMessage(); |
2961 | 2961 | } |
2962 | 2962 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2971,7 +2971,7 @@ discard block |
||
2971 | 2971 | $Connection = new Connection(); |
2972 | 2972 | $sth = $Connection->db->prepare($query); |
2973 | 2973 | $sth->execute(); |
2974 | - } catch(PDOException $e) { |
|
2974 | + } catch (PDOException $e) { |
|
2975 | 2975 | return "error : ".$e->getMessage(); |
2976 | 2976 | } |
2977 | 2977 | } |
@@ -2987,7 +2987,7 @@ discard block |
||
2987 | 2987 | $Connection = new Connection(); |
2988 | 2988 | $sth = $Connection->db->prepare($query); |
2989 | 2989 | $sth->execute(); |
2990 | - } catch(PDOException $e) { |
|
2990 | + } catch (PDOException $e) { |
|
2991 | 2991 | return "error : ".$e->getMessage(); |
2992 | 2992 | } |
2993 | 2993 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3002,7 +3002,7 @@ discard block |
||
3002 | 3002 | $Connection = new Connection(); |
3003 | 3003 | $sth = $Connection->db->prepare($query); |
3004 | 3004 | $sth->execute(); |
3005 | - } catch(PDOException $e) { |
|
3005 | + } catch (PDOException $e) { |
|
3006 | 3006 | return "error : ".$e->getMessage(); |
3007 | 3007 | } |
3008 | 3008 | } |
@@ -3018,7 +3018,7 @@ discard block |
||
3018 | 3018 | $Connection = new Connection(); |
3019 | 3019 | $sth = $Connection->db->prepare($query); |
3020 | 3020 | $sth->execute(); |
3021 | - } catch(PDOException $e) { |
|
3021 | + } catch (PDOException $e) { |
|
3022 | 3022 | return "error : ".$e->getMessage(); |
3023 | 3023 | } |
3024 | 3024 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3033,7 +3033,7 @@ discard block |
||
3033 | 3033 | $Connection = new Connection(); |
3034 | 3034 | $sth = $Connection->db->prepare($query); |
3035 | 3035 | $sth->execute(); |
3036 | - } catch(PDOException $e) { |
|
3036 | + } catch (PDOException $e) { |
|
3037 | 3037 | return "error : ".$e->getMessage(); |
3038 | 3038 | } |
3039 | 3039 | } |
@@ -3049,7 +3049,7 @@ discard block |
||
3049 | 3049 | $Connection = new Connection(); |
3050 | 3050 | $sth = $Connection->db->prepare($query); |
3051 | 3051 | $sth->execute(); |
3052 | - } catch(PDOException $e) { |
|
3052 | + } catch (PDOException $e) { |
|
3053 | 3053 | return "error : ".$e->getMessage(); |
3054 | 3054 | } |
3055 | 3055 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3064,7 +3064,7 @@ discard block |
||
3064 | 3064 | $Connection = new Connection(); |
3065 | 3065 | $sth = $Connection->db->prepare($query); |
3066 | 3066 | $sth->execute(); |
3067 | - } catch(PDOException $e) { |
|
3067 | + } catch (PDOException $e) { |
|
3068 | 3068 | return "error : ".$e->getMessage(); |
3069 | 3069 | } |
3070 | 3070 | } |
@@ -3079,7 +3079,7 @@ discard block |
||
3079 | 3079 | $Connection = new Connection(); |
3080 | 3080 | $sth = $Connection->db->prepare($query); |
3081 | 3081 | $sth->execute(); |
3082 | - } catch(PDOException $e) { |
|
3082 | + } catch (PDOException $e) { |
|
3083 | 3083 | return "error : ".$e->getMessage(); |
3084 | 3084 | } |
3085 | 3085 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3094,7 +3094,7 @@ discard block |
||
3094 | 3094 | $Connection = new Connection(); |
3095 | 3095 | $sth = $Connection->db->prepare($query); |
3096 | 3096 | $sth->execute(); |
3097 | - } catch(PDOException $e) { |
|
3097 | + } catch (PDOException $e) { |
|
3098 | 3098 | return "error : ".$e->getMessage(); |
3099 | 3099 | } |
3100 | 3100 | } |
@@ -3110,7 +3110,7 @@ discard block |
||
3110 | 3110 | $Connection = new Connection(); |
3111 | 3111 | $sth = $Connection->db->prepare($query); |
3112 | 3112 | $sth->execute(); |
3113 | - } catch(PDOException $e) { |
|
3113 | + } catch (PDOException $e) { |
|
3114 | 3114 | return "error : ".$e->getMessage(); |
3115 | 3115 | } |
3116 | 3116 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3125,7 +3125,7 @@ discard block |
||
3125 | 3125 | $Connection = new Connection(); |
3126 | 3126 | $sth = $Connection->db->prepare($query); |
3127 | 3127 | $sth->execute(); |
3128 | - } catch(PDOException $e) { |
|
3128 | + } catch (PDOException $e) { |
|
3129 | 3129 | return "error : ".$e->getMessage(); |
3130 | 3130 | } |
3131 | 3131 | } |
@@ -3141,7 +3141,7 @@ discard block |
||
3141 | 3141 | $Connection = new Connection(); |
3142 | 3142 | $sth = $Connection->db->prepare($query); |
3143 | 3143 | $sth->execute(); |
3144 | - } catch(PDOException $e) { |
|
3144 | + } catch (PDOException $e) { |
|
3145 | 3145 | return "error : ".$e->getMessage(); |
3146 | 3146 | } |
3147 | 3147 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3156,7 +3156,7 @@ discard block |
||
3156 | 3156 | $Connection = new Connection(); |
3157 | 3157 | $sth = $Connection->db->prepare($query); |
3158 | 3158 | $sth->execute(); |
3159 | - } catch(PDOException $e) { |
|
3159 | + } catch (PDOException $e) { |
|
3160 | 3160 | return "error : ".$e->getMessage(); |
3161 | 3161 | } |
3162 | 3162 | } |
@@ -3172,7 +3172,7 @@ discard block |
||
3172 | 3172 | $Connection = new Connection(); |
3173 | 3173 | $sth = $Connection->db->prepare($query); |
3174 | 3174 | $sth->execute(); |
3175 | - } catch(PDOException $e) { |
|
3175 | + } catch (PDOException $e) { |
|
3176 | 3176 | return "error : ".$e->getMessage(); |
3177 | 3177 | } |
3178 | 3178 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3187,7 +3187,7 @@ discard block |
||
3187 | 3187 | $Connection = new Connection(); |
3188 | 3188 | $sth = $Connection->db->prepare($query); |
3189 | 3189 | $sth->execute(); |
3190 | - } catch(PDOException $e) { |
|
3190 | + } catch (PDOException $e) { |
|
3191 | 3191 | return "error : ".$e->getMessage(); |
3192 | 3192 | } |
3193 | 3193 | } |
@@ -3203,7 +3203,7 @@ discard block |
||
3203 | 3203 | $Connection = new Connection(); |
3204 | 3204 | $sth = $Connection->db->prepare($query); |
3205 | 3205 | $sth->execute(); |
3206 | - } catch(PDOException $e) { |
|
3206 | + } catch (PDOException $e) { |
|
3207 | 3207 | return "error : ".$e->getMessage(); |
3208 | 3208 | } |
3209 | 3209 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3222,7 +3222,7 @@ discard block |
||
3222 | 3222 | $Connection = new Connection(); |
3223 | 3223 | $sth = $Connection->db->prepare($query); |
3224 | 3224 | $sth->execute(); |
3225 | - } catch(PDOException $e) { |
|
3225 | + } catch (PDOException $e) { |
|
3226 | 3226 | return "error : ".$e->getMessage(); |
3227 | 3227 | } |
3228 | 3228 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3237,7 +3237,7 @@ discard block |
||
3237 | 3237 | $Connection = new Connection(); |
3238 | 3238 | $sth = $Connection->db->prepare($query); |
3239 | 3239 | $sth->execute(); |
3240 | - } catch(PDOException $e) { |
|
3240 | + } catch (PDOException $e) { |
|
3241 | 3241 | return "error : ".$e->getMessage(); |
3242 | 3242 | } |
3243 | 3243 | } |
@@ -3249,7 +3249,7 @@ discard block |
||
3249 | 3249 | $Connection = new Connection(); |
3250 | 3250 | $sth = $Connection->db->prepare($query); |
3251 | 3251 | $sth->execute(); |
3252 | - } catch(PDOException $e) { |
|
3252 | + } catch (PDOException $e) { |
|
3253 | 3253 | return "error : ".$e->getMessage(); |
3254 | 3254 | } |
3255 | 3255 | } |
@@ -3265,7 +3265,7 @@ discard block |
||
3265 | 3265 | $Connection = new Connection(); |
3266 | 3266 | $sth = $Connection->db->prepare($query); |
3267 | 3267 | $sth->execute(); |
3268 | - } catch(PDOException $e) { |
|
3268 | + } catch (PDOException $e) { |
|
3269 | 3269 | return "error : ".$e->getMessage(); |
3270 | 3270 | } |
3271 | 3271 | } |
@@ -3280,7 +3280,7 @@ discard block |
||
3280 | 3280 | $Connection = new Connection(); |
3281 | 3281 | $sth = $Connection->db->prepare($query); |
3282 | 3282 | $sth->execute(); |
3283 | - } catch(PDOException $e) { |
|
3283 | + } catch (PDOException $e) { |
|
3284 | 3284 | return "error : ".$e->getMessage(); |
3285 | 3285 | } |
3286 | 3286 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | if (!isset($filter_name)) $filter_name = ''; |
26 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
26 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
27 | 27 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
28 | 28 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
29 | 29 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
33 | 33 | if (isset($airline_info[0]['name'])) { |
34 | 34 | $airline_name = $airline_info[0]['name']; |
35 | - } elseif (strpos($airline_icao,'alliance_') !== FALSE) { |
|
35 | + } elseif (strpos($airline_icao, 'alliance_') !== FALSE) { |
|
36 | 36 | $alliance_name = $airline_icao; |
37 | 37 | } |
38 | 38 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $title = _("Statistics"); |
43 | 43 | } |
44 | 44 | |
45 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
45 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | |
48 | 48 | require_once('header.php'); |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | date_default_timezone_set('UTC'); |
71 | 71 | $lastupdate = strtotime($last_update[0]['value']); |
72 | 72 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
73 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
73 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | ?> |
@@ -82,31 +82,31 @@ discard block |
||
82 | 82 | <?php |
83 | 83 | if ($type == 'aircraft') { |
84 | 84 | ?> |
85 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
86 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
87 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
88 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
85 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
86 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
87 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
88 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
89 | 89 | <?php |
90 | 90 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
91 | 91 | ?> |
92 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
93 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
92 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
93 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
94 | 94 | <?php |
95 | 95 | } |
96 | 96 | if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
97 | 97 | ?> |
98 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
99 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
98 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
99 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
100 | 100 | <?php |
101 | 101 | } |
102 | 102 | ?> |
103 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
104 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
103 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
104 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
105 | 105 | <?php |
106 | 106 | if ($airline_icao == '') { |
107 | 107 | ?> |
108 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
109 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
108 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
109 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
110 | 110 | <?php |
111 | 111 | } |
112 | 112 | ?> |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) { |
115 | 115 | if ($airline_icao == '' || $airline_icao == 'all') { |
116 | 116 | ?> |
117 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
118 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
117 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
118 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
119 | 119 | <?php |
120 | 120 | } |
121 | 121 | } |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | <?php |
124 | 124 | } elseif ($type == 'marine') { |
125 | 125 | ?> |
126 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
127 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
128 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
129 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
126 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
127 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
128 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
129 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
130 | 130 | <?php |
131 | 131 | } elseif ($type == 'tracker') { |
132 | 132 | ?> |
133 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
134 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
135 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
136 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
133 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
134 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
135 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
136 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
137 | 137 | <?php |
138 | 138 | } |
139 | 139 | ?> |
140 | 140 | </p> |
141 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
141 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
142 | 142 | <div class="specific-stats"> |
143 | 143 | <?php |
144 | 144 | if ($type == 'aircraft') { |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | <div class="col-md-6"> |
148 | 148 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
149 | 149 | <?php |
150 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
150 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
151 | 151 | if (count($aircraft_array) == 0) { |
152 | 152 | print _("No data available"); |
153 | 153 | } else { |
154 | 154 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
155 | 155 | $aircraft_data = ''; |
156 | - foreach($aircraft_array as $aircraft_item) { |
|
156 | + foreach ($aircraft_array as $aircraft_item) { |
|
157 | 157 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
158 | 158 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
159 | 159 | } |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | ?> |
183 | 183 | </div> |
184 | 184 | </div> |
185 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
185 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
186 | 186 | <?php |
187 | 187 | if ($airline_icao == '' || $airline_icao == 'all') { |
188 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
188 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
189 | 189 | if (count($airline_array) > 0) { |
190 | 190 | print '<div class="col-md-6">'; |
191 | 191 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
192 | 192 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
193 | 193 | $airline_data = ''; |
194 | - foreach($airline_array as $airline_item) { |
|
194 | + foreach ($airline_array as $airline_item) { |
|
195 | 195 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
196 | 196 | } |
197 | 197 | $airline_data = substr($airline_data, 0, -1); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | ?> |
218 | 218 | </div> |
219 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
219 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
220 | 220 | <?php |
221 | 221 | } |
222 | 222 | } |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | <div class="col-md-6"> |
229 | 229 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
230 | 230 | <?php |
231 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
231 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month); |
|
232 | 232 | if (count($marine_array) == 0) print _("No data available"); |
233 | 233 | else { |
234 | 234 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
235 | 235 | $marine_data = ''; |
236 | - foreach($marine_array as $marine_item) { |
|
236 | + foreach ($marine_array as $marine_item) { |
|
237 | 237 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
238 | 238 | } |
239 | 239 | $marine_data = substr($marine_data, 0, -1); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | ?> |
264 | 264 | </div> |
265 | 265 | </div> |
266 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
266 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
267 | 267 | <!-- </div>--> |
268 | 268 | <?php |
269 | 269 | } |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | <div class="col-md-6"> |
274 | 274 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
275 | 275 | <?php |
276 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
276 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
277 | 277 | if (count($tracker_array) == 0) print _("No data available"); |
278 | 278 | else { |
279 | 279 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
280 | 280 | $tracker_data = ''; |
281 | - foreach($tracker_array as $tracker_item) { |
|
281 | + foreach ($tracker_array as $tracker_item) { |
|
282 | 282 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
283 | 283 | } |
284 | 284 | $tracker_data = substr($tracker_data, 0, -1); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ?> |
309 | 309 | </div> |
310 | 310 | </div> |
311 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
311 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
312 | 312 | <!-- </div>--> |
313 | 313 | <?php |
314 | 314 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | else { |
324 | 324 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
325 | 325 | $owner_data = ''; |
326 | - foreach($owner_array as $owner_item) { |
|
326 | + foreach ($owner_array as $owner_item) { |
|
327 | 327 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
328 | 328 | } |
329 | 329 | $owner_data = substr($owner_data, 0, -1); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | </div> |
344 | 344 | --> |
345 | 345 | </div> |
346 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
346 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
347 | 347 | <div class="col-md-6"> |
348 | 348 | <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2> |
349 | 349 | <?php |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | else { |
353 | 353 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
354 | 354 | $owner_data = ''; |
355 | - foreach($countries_array as $owner_item) { |
|
355 | + foreach ($countries_array as $owner_item) { |
|
356 | 356 | $owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],'; |
357 | 357 | } |
358 | 358 | $owner_data = substr($owner_data, 0, -1); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | --> |
374 | 374 | </div> |
375 | 375 | |
376 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
376 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
377 | 377 | ² </div> |
378 | 378 | <div class="row column"> |
379 | 379 | <div class="col-md-6"> |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | else { |
385 | 385 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
386 | 386 | $launch_site_data = ''; |
387 | - foreach($launch_site_array as $launch_site_item) { |
|
387 | + foreach ($launch_site_array as $launch_site_item) { |
|
388 | 388 | $launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],'; |
389 | 389 | } |
390 | 390 | $launch_site_data = substr($launch_site_data, 0, -1); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | ?> |
412 | 412 | <div class="row column"> |
413 | 413 | <?php |
414 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
414 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
415 | 415 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
416 | 416 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
417 | 417 | if (empty($flightover_array)) { |
@@ -422,12 +422,12 @@ discard block |
||
422 | 422 | ?> |
423 | 423 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
424 | 424 | <?php |
425 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
425 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
426 | 426 | if (count($pilot_array) == 0) print _("No data available"); |
427 | 427 | else { |
428 | 428 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
429 | 429 | $pilot_data = ''; |
430 | - foreach($pilot_array as $pilot_item) { |
|
430 | + foreach ($pilot_array as $pilot_item) { |
|
431 | 431 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
432 | 432 | } |
433 | 433 | $pilot_data = substr($pilot_data, 0, -1); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | ?> |
449 | 449 | </div> |
450 | 450 | |
451 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
451 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
452 | 452 | <?php |
453 | 453 | } |
454 | 454 | // else { |
@@ -457,12 +457,12 @@ discard block |
||
457 | 457 | <div class="col-md-6"> |
458 | 458 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
459 | 459 | <?php |
460 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
460 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
461 | 461 | if (count($owner_array) == 0) print _("No data available"); |
462 | 462 | else { |
463 | 463 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
464 | 464 | $owner_data = ''; |
465 | - foreach($owner_array as $owner_item) { |
|
465 | + foreach ($owner_array as $owner_item) { |
|
466 | 466 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
467 | 467 | } |
468 | 468 | $owner_data = substr($owner_data, 0, -1); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | </div> |
482 | 482 | </div> |
483 | 483 | |
484 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
484 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
485 | 485 | <?php |
486 | 486 | } |
487 | 487 | if (!empty($flightover_array)) { |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
496 | 496 | print 'var series = ['; |
497 | 497 | $flightover_data = ''; |
498 | - foreach($flightover_array as $flightover_item) { |
|
498 | + foreach ($flightover_array as $flightover_item) { |
|
499 | 499 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
500 | 500 | } |
501 | 501 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | } |
541 | 541 | ?> |
542 | 542 | </div> |
543 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
543 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
544 | 544 | </div> |
545 | 545 | <?php |
546 | 546 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
557 | 557 | print 'var series = ['; |
558 | 558 | $flightover_data = ''; |
559 | - foreach($flightover_array as $flightover_item) { |
|
559 | + foreach ($flightover_array as $flightover_item) { |
|
560 | 560 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
561 | 561 | } |
562 | 562 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
614 | 614 | print 'var series = ['; |
615 | 615 | $flightover_data = ''; |
616 | - foreach($flightover_array as $flightover_item) { |
|
616 | + foreach ($flightover_array as $flightover_item) { |
|
617 | 617 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
618 | 618 | } |
619 | 619 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -663,14 +663,14 @@ discard block |
||
663 | 663 | <div class="row column"> |
664 | 664 | <div class="col-md-6"> |
665 | 665 | <?php |
666 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
666 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
667 | 667 | if (count($airport_airport_array) > 0) { |
668 | 668 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
669 | 669 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
670 | 670 | print "\n"; |
671 | 671 | print 'var series = ['; |
672 | 672 | $airport_data = ''; |
673 | - foreach($airport_airport_array as $airport_item) { |
|
673 | + foreach ($airport_airport_array as $airport_item) { |
|
674 | 674 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
675 | 675 | } |
676 | 676 | $airport_data = substr($airport_data, 0, -1); |
@@ -720,18 +720,18 @@ discard block |
||
720 | 720 | } |
721 | 721 | ?> |
722 | 722 | </div> |
723 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
723 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
724 | 724 | |
725 | 725 | <div class="col-md-6"> |
726 | 726 | <?php |
727 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
727 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
728 | 728 | if (count($airport_airport_array2) > 0) { |
729 | 729 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
730 | 730 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
731 | 731 | print "\n"; |
732 | 732 | print 'var series = ['; |
733 | 733 | $airport_data = ''; |
734 | - foreach($airport_airport_array2 as $airport_item) |
|
734 | + foreach ($airport_airport_array2 as $airport_item) |
|
735 | 735 | { |
736 | 736 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
737 | 737 | } |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | ?> |
784 | 784 | </div> |
785 | 785 | </div> |
786 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
786 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
787 | 787 | <?php |
788 | 788 | } |
789 | 789 | if ($type == 'aircraft') { |
@@ -795,18 +795,18 @@ discard block |
||
795 | 795 | <div class="col-md-6"> |
796 | 796 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
797 | 797 | <?php |
798 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
798 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
799 | 799 | if (count($year_array) == 0) print _("No data available"); |
800 | 800 | else { |
801 | 801 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
802 | 802 | $year_data = ''; |
803 | 803 | $year_cnt = ''; |
804 | - foreach($year_array as $year_item) { |
|
804 | + foreach ($year_array as $year_item) { |
|
805 | 805 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
806 | 806 | $year_cnt .= $year_item['date_count'].','; |
807 | 807 | } |
808 | 808 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
809 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
809 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
810 | 810 | print 'c3.generate({ |
811 | 811 | bindto: "#chart8", |
812 | 812 | data: { x: "x", |
@@ -819,22 +819,22 @@ discard block |
||
819 | 819 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
820 | 820 | </div> |
821 | 821 | </div> |
822 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
822 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
823 | 823 | <div class="col-md-6"> |
824 | 824 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
825 | 825 | <?php |
826 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
826 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
827 | 827 | if (count($month_array) == 0) print _("No data available"); |
828 | 828 | else { |
829 | 829 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
830 | 830 | $month_data = ''; |
831 | 831 | $month_cnt = ''; |
832 | - foreach($month_array as $month_item) { |
|
832 | + foreach ($month_array as $month_item) { |
|
833 | 833 | $month_data .= '"'.$month_item['date_name'].'",'; |
834 | 834 | $month_cnt .= $month_item['date_count'].','; |
835 | 835 | } |
836 | 836 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
837 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
837 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
838 | 838 | print 'c3.generate({ |
839 | 839 | bindto: "#chart9", |
840 | 840 | data: { x: "x", |
@@ -847,23 +847,23 @@ discard block |
||
847 | 847 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
848 | 848 | </div> |
849 | 849 | </div> |
850 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
850 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
851 | 851 | |
852 | 852 | <div class="col-md-6"> |
853 | 853 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
854 | 854 | <?php |
855 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
855 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
856 | 856 | if (empty($date_array)) print _("No data available"); |
857 | 857 | else { |
858 | 858 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
859 | 859 | $date_data = ''; |
860 | 860 | $date_cnt = ''; |
861 | - foreach($date_array as $date_item) { |
|
861 | + foreach ($date_array as $date_item) { |
|
862 | 862 | $date_data .= '"'.$date_item['date_name'].'",'; |
863 | 863 | $date_cnt .= $date_item['date_count'].','; |
864 | 864 | } |
865 | 865 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
866 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
866 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
867 | 867 | print 'c3.generate({ |
868 | 868 | bindto: "#chart5", |
869 | 869 | data: { x: "x", |
@@ -876,22 +876,22 @@ discard block |
||
876 | 876 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
877 | 877 | </div> |
878 | 878 | </div> |
879 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
879 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
880 | 880 | <div class="col-md-6"> |
881 | 881 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
882 | 882 | <?php |
883 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
883 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
884 | 884 | if (empty($hour_array)) print _("No data available"); |
885 | 885 | else { |
886 | 886 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
887 | 887 | $hour_data = ''; |
888 | 888 | $hour_cnt = ''; |
889 | - foreach($hour_array as $hour_item) { |
|
889 | + foreach ($hour_array as $hour_item) { |
|
890 | 890 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
891 | 891 | $hour_cnt .= $hour_item['hour_count'].','; |
892 | 892 | } |
893 | 893 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
894 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
894 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
895 | 895 | print 'c3.generate({ |
896 | 896 | bindto: "#chart6", |
897 | 897 | data: { |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
905 | 905 | </div> |
906 | 906 | </div> |
907 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
907 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
908 | 908 | </div> |
909 | 909 | <?php |
910 | 910 | } |
@@ -920,18 +920,18 @@ discard block |
||
920 | 920 | <div class="col-md-6"> |
921 | 921 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
922 | 922 | <?php |
923 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
923 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
924 | 924 | if (count($year_array) == 0) print _("No data available"); |
925 | 925 | else { |
926 | 926 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
927 | 927 | $year_data = ''; |
928 | 928 | $year_cnt = ''; |
929 | - foreach($year_array as $year_item) { |
|
929 | + foreach ($year_array as $year_item) { |
|
930 | 930 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
931 | 931 | $year_cnt .= $year_item['date_count'].','; |
932 | 932 | } |
933 | 933 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
934 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
934 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
935 | 935 | print 'c3.generate({ |
936 | 936 | bindto: "#chart8", |
937 | 937 | data: { x: "x", |
@@ -945,22 +945,22 @@ discard block |
||
945 | 945 | </div> |
946 | 946 | </div> |
947 | 947 | |
948 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
948 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
949 | 949 | <div class="col-md-6"> |
950 | 950 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
951 | 951 | <?php |
952 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
952 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
953 | 953 | if (count($month_array) == 0) print _("No data available"); |
954 | 954 | else { |
955 | 955 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
956 | 956 | $month_data = ''; |
957 | 957 | $month_cnt = ''; |
958 | - foreach($month_array as $month_item) { |
|
958 | + foreach ($month_array as $month_item) { |
|
959 | 959 | $month_data .= '"'.$month_item['date_name'].'",'; |
960 | 960 | $month_cnt .= $month_item['date_count'].','; |
961 | 961 | } |
962 | 962 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
963 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
963 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
964 | 964 | print 'c3.generate({ |
965 | 965 | bindto: "#chart9", |
966 | 966 | data: { x: "x", |
@@ -973,23 +973,23 @@ discard block |
||
973 | 973 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
974 | 974 | </div> |
975 | 975 | </div> |
976 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
976 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
977 | 977 | |
978 | 978 | <div class="col-md-6"> |
979 | 979 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
980 | 980 | <?php |
981 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
981 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
982 | 982 | if (empty($date_array)) print _("No data available"); |
983 | 983 | else { |
984 | 984 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
985 | 985 | $date_data = ''; |
986 | 986 | $date_cnt = ''; |
987 | - foreach($date_array as $date_item) { |
|
987 | + foreach ($date_array as $date_item) { |
|
988 | 988 | $date_data .= '"'.$date_item['date_name'].'",'; |
989 | 989 | $date_cnt .= $date_item['date_count'].','; |
990 | 990 | } |
991 | 991 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
992 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
992 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
993 | 993 | print 'c3.generate({ |
994 | 994 | bindto: "#chart5", |
995 | 995 | data: { x: "x", |
@@ -1002,22 +1002,22 @@ discard block |
||
1002 | 1002 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1003 | 1003 | </div> |
1004 | 1004 | </div> |
1005 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1005 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1006 | 1006 | <div class="col-md-6"> |
1007 | 1007 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1008 | 1008 | <?php |
1009 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
1009 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
1010 | 1010 | if (empty($hour_array)) print _("No data available"); |
1011 | 1011 | else { |
1012 | 1012 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1013 | 1013 | $hour_data = ''; |
1014 | 1014 | $hour_cnt = ''; |
1015 | - foreach($hour_array as $hour_item) { |
|
1015 | + foreach ($hour_array as $hour_item) { |
|
1016 | 1016 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1017 | 1017 | $hour_cnt .= $hour_item['hour_count'].','; |
1018 | 1018 | } |
1019 | 1019 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1020 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
1020 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
1021 | 1021 | print 'c3.generate({ |
1022 | 1022 | bindto: "#chart6", |
1023 | 1023 | data: { |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1031 | 1031 | </div> |
1032 | 1032 | </div> |
1033 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1033 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1034 | 1034 | </div> |
1035 | 1035 | <?php |
1036 | 1036 | } |
@@ -1052,12 +1052,12 @@ discard block |
||
1052 | 1052 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
1053 | 1053 | $year_data = ''; |
1054 | 1054 | $year_cnt = ''; |
1055 | - foreach($year_array as $year_item) { |
|
1055 | + foreach ($year_array as $year_item) { |
|
1056 | 1056 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
1057 | 1057 | $year_cnt .= $year_item['date_count'].','; |
1058 | 1058 | } |
1059 | 1059 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1060 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
1060 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
1061 | 1061 | print 'c3.generate({ |
1062 | 1062 | bindto: "#chart8", |
1063 | 1063 | data: { x: "x", |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | </div> |
1072 | 1072 | </div> |
1073 | 1073 | |
1074 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1074 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1075 | 1075 | <div class="col-md-6"> |
1076 | 1076 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1077 | 1077 | <?php |
@@ -1081,12 +1081,12 @@ discard block |
||
1081 | 1081 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1082 | 1082 | $month_data = ''; |
1083 | 1083 | $month_cnt = ''; |
1084 | - foreach($month_array as $month_item) { |
|
1084 | + foreach ($month_array as $month_item) { |
|
1085 | 1085 | $month_data .= '"'.$month_item['date_name'].'",'; |
1086 | 1086 | $month_cnt .= $month_item['date_count'].','; |
1087 | 1087 | } |
1088 | 1088 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
1089 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
1089 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
1090 | 1090 | print 'c3.generate({ |
1091 | 1091 | bindto: "#chart9", |
1092 | 1092 | data: { x: "x", |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1100 | 1100 | </div> |
1101 | 1101 | </div> |
1102 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1102 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1103 | 1103 | |
1104 | 1104 | <div class="col-md-6"> |
1105 | 1105 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1110,12 +1110,12 @@ discard block |
||
1110 | 1110 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1111 | 1111 | $date_data = ''; |
1112 | 1112 | $date_cnt = ''; |
1113 | - foreach($date_array as $date_item) { |
|
1113 | + foreach ($date_array as $date_item) { |
|
1114 | 1114 | $date_data .= '"'.$date_item['date_name'].'",'; |
1115 | 1115 | $date_cnt .= $date_item['date_count'].','; |
1116 | 1116 | } |
1117 | 1117 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1118 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1118 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1119 | 1119 | print 'c3.generate({ |
1120 | 1120 | bindto: "#chart5", |
1121 | 1121 | data: { x: "x", |
@@ -1128,22 +1128,22 @@ discard block |
||
1128 | 1128 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1129 | 1129 | </div> |
1130 | 1130 | </div> |
1131 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1131 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1132 | 1132 | <div class="col-md-6"> |
1133 | 1133 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1134 | 1134 | <?php |
1135 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1135 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1136 | 1136 | if (empty($hour_array)) print _("No data available"); |
1137 | 1137 | else { |
1138 | 1138 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1139 | 1139 | $hour_data = ''; |
1140 | 1140 | $hour_cnt = ''; |
1141 | - foreach($hour_array as $hour_item) { |
|
1141 | + foreach ($hour_array as $hour_item) { |
|
1142 | 1142 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1143 | 1143 | $hour_cnt .= $hour_item['hour_count'].','; |
1144 | 1144 | } |
1145 | 1145 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1146 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1146 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1147 | 1147 | print 'c3.generate({ |
1148 | 1148 | bindto: "#chart6", |
1149 | 1149 | data: { |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1157 | 1157 | </div> |
1158 | 1158 | </div> |
1159 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1159 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1160 | 1160 | </div> |
1161 | 1161 | <?php |
1162 | 1162 | } |
@@ -1178,12 +1178,12 @@ discard block |
||
1178 | 1178 | print '<div id="chart21" class="chart" width="100%"></div><script>'; |
1179 | 1179 | $year_data = ''; |
1180 | 1180 | $year_cnt = ''; |
1181 | - foreach($year_array as $year_item) { |
|
1181 | + foreach ($year_array as $year_item) { |
|
1182 | 1182 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
1183 | 1183 | $year_cnt .= $year_item['date_count'].','; |
1184 | 1184 | } |
1185 | 1185 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1186 | - $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]"; |
|
1186 | + $year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]"; |
|
1187 | 1187 | print 'c3.generate({ |
1188 | 1188 | bindto: "#chart21", |
1189 | 1189 | data: { x: "x", |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | --> |
1200 | 1200 | </div> |
1201 | 1201 | |
1202 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1202 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1203 | 1203 | <div class="col-md-6"> |
1204 | 1204 | <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2> |
1205 | 1205 | <?php |
@@ -1209,12 +1209,12 @@ discard block |
||
1209 | 1209 | print '<div id="chart22" class="chart" width="100%"></div><script>'; |
1210 | 1210 | $year_data = ''; |
1211 | 1211 | $year_cnt = ''; |
1212 | - foreach($year_array as $year_item) { |
|
1212 | + foreach ($year_array as $year_item) { |
|
1213 | 1213 | $year_data .= '"'.$year_item['year_name'].'-01-01'.'",'; |
1214 | 1214 | $year_cnt .= $year_item['date_count'].','; |
1215 | 1215 | } |
1216 | 1216 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1217 | - $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]"; |
|
1217 | + $year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]"; |
|
1218 | 1218 | print 'c3.generate({ |
1219 | 1219 | bindto: "#chart22", |
1220 | 1220 | data: { x: "x", |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | --> |
1231 | 1231 | </div> |
1232 | 1232 | |
1233 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1233 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1234 | 1234 | </div> |
1235 | 1235 | <?php |
1236 | 1236 | } |
@@ -1252,12 +1252,12 @@ discard block |
||
1252 | 1252 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1253 | 1253 | $year_data = ''; |
1254 | 1254 | $year_cnt = ''; |
1255 | - foreach($year_array as $year_item) { |
|
1255 | + foreach ($year_array as $year_item) { |
|
1256 | 1256 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1257 | 1257 | $year_cnt .= $year_item['count'].','; |
1258 | 1258 | } |
1259 | 1259 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1260 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1260 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1261 | 1261 | print 'c3.generate({ |
1262 | 1262 | bindto: "#chart32", |
1263 | 1263 | data: { x: "x", |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1271 | 1271 | </div> |
1272 | 1272 | </div> |
1273 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1273 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1274 | 1274 | |
1275 | 1275 | <div class="row column"> |
1276 | 1276 | <div class="col-md-6"> |
@@ -1282,12 +1282,12 @@ discard block |
||
1282 | 1282 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1283 | 1283 | $year_data = ''; |
1284 | 1284 | $year_cnt = ''; |
1285 | - foreach($year_array as $year_item) { |
|
1285 | + foreach ($year_array as $year_item) { |
|
1286 | 1286 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1287 | 1287 | $year_cnt .= $year_item['count'].','; |
1288 | 1288 | } |
1289 | 1289 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1290 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1290 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1291 | 1291 | print 'c3.generate({ |
1292 | 1292 | bindto: "#chart33", |
1293 | 1293 | data: { x: "x", |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1301 | 1301 | </div> |
1302 | 1302 | </div> |
1303 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1303 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1304 | 1304 | <br/> |
1305 | 1305 | <?php |
1306 | 1306 | } |
@@ -1314,19 +1314,19 @@ discard block |
||
1314 | 1314 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1315 | 1315 | if ($year == '' && $month == '') { |
1316 | 1316 | if ($type == 'aircraft') { |
1317 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1317 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1318 | 1318 | } elseif ($type == 'marine') { |
1319 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1319 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1320 | 1320 | } elseif ($type == 'tracker') { |
1321 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
1321 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
1322 | 1322 | } |
1323 | 1323 | } else { |
1324 | 1324 | if ($type == 'aircraft') { |
1325 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1325 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1326 | 1326 | } elseif ($type == 'marine') { |
1327 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1327 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1328 | 1328 | } elseif ($type == 'tracker') { |
1329 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
1329 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
1330 | 1330 | } |
1331 | 1331 | } |
1332 | 1332 | if (!empty($polar)) { |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | unset($polar_data); |
1336 | 1336 | $Spotter = new Spotter(); |
1337 | 1337 | $data = json_decode($eachpolar['source_data']); |
1338 | - foreach($data as $value => $key) { |
|
1338 | + foreach ($data as $value => $key) { |
|
1339 | 1339 | $direction = $Spotter->parseDirection(($value*22.5)); |
1340 | 1340 | $distance = $key; |
1341 | 1341 | $unit = 'km'; |
@@ -1355,7 +1355,7 @@ discard block |
||
1355 | 1355 | ?> |
1356 | 1356 | <div class="col-md-6"> |
1357 | 1357 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1358 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1358 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1359 | 1359 | <script> |
1360 | 1360 | (function() { |
1361 | 1361 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | color: color, |
1380 | 1380 | unit: '<?php echo $unit; ?>' |
1381 | 1381 | }; |
1382 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1382 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1383 | 1383 | })(); |
1384 | 1384 | </script> |
1385 | 1385 | </div> |
@@ -1394,19 +1394,19 @@ discard block |
||
1394 | 1394 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1395 | 1395 | if ($year == '' && $month == '') { |
1396 | 1396 | if ($type == 'aircraft') { |
1397 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1397 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1398 | 1398 | } elseif ($type == 'marine') { |
1399 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1399 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1400 | 1400 | } elseif ($type == 'tracker') { |
1401 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
1401 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
1402 | 1402 | } |
1403 | 1403 | } else { |
1404 | 1404 | if ($type == 'aircraft') { |
1405 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1405 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1406 | 1406 | } elseif ($type == 'marine') { |
1407 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1407 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1408 | 1408 | } elseif ($type == 'tracker') { |
1409 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
1409 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
1410 | 1410 | } |
1411 | 1411 | } |
1412 | 1412 | if (!empty($msg)) { |
@@ -1414,13 +1414,13 @@ discard block |
||
1414 | 1414 | foreach ($msg as $eachmsg) { |
1415 | 1415 | //$eachmsg = $msg[0]; |
1416 | 1416 | $data = $eachmsg['source_data']; |
1417 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1417 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1418 | 1418 | else $max = 500; |
1419 | 1419 | ?> |
1420 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1420 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1421 | 1421 | <script> |
1422 | 1422 | var g = new JustGage({ |
1423 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1423 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1424 | 1424 | value: <?php echo $data; ?>, |
1425 | 1425 | min: 0, |
1426 | 1426 | max: <?php print $max; ?>, |
@@ -1442,19 +1442,19 @@ discard block |
||
1442 | 1442 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1443 | 1443 | if ($year == '' && $month == '') { |
1444 | 1444 | if ($type == 'aircraft') { |
1445 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1445 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1446 | 1446 | } elseif ($type == 'marine') { |
1447 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1447 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1448 | 1448 | } elseif ($type == 'tracker') { |
1449 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
1449 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
1450 | 1450 | } |
1451 | 1451 | } else { |
1452 | 1452 | if ($type == 'aircraft') { |
1453 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1453 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1454 | 1454 | } elseif ($type == 'marine') { |
1455 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1455 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1456 | 1456 | } elseif ($type == 'tracker') { |
1457 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
1457 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
1458 | 1458 | } |
1459 | 1459 | } |
1460 | 1460 | foreach ($hist as $hists) { |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | $source = $hists['source_name']; |
1465 | 1465 | $hist_array = json_decode($hists['source_data']); |
1466 | 1466 | $unit = 'km'; |
1467 | - foreach($hist_array as $distance => $nb) { |
|
1467 | + foreach ($hist_array as $distance => $nb) { |
|
1468 | 1468 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1469 | 1469 | $distance = round($distance*0.539957); |
1470 | 1470 | $unit = 'nm'; |
@@ -1484,18 +1484,18 @@ discard block |
||
1484 | 1484 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1485 | 1485 | ?> |
1486 | 1486 | <div class="col-md-6"> |
1487 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1487 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1488 | 1488 | <?php |
1489 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1489 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1490 | 1490 | print 'c3.generate({ |
1491 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1491 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1492 | 1492 | data: { x: "x", |
1493 | 1493 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1494 | 1494 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1495 | 1495 | print '</script>'; |
1496 | 1496 | ?> |
1497 | 1497 | </div> |
1498 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1498 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1499 | 1499 | <?php |
1500 | 1500 | } |
1501 | 1501 | ?> |