@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | 4 | |
5 | -setcookie("MapFormat",'2d'); |
|
5 | +setcookie("MapFormat", '2d'); |
|
6 | 6 | |
7 | 7 | // Compressed GeoJson is used if true |
8 | 8 | if (!isset($globalJsonCompress)) $compress = true; |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | |
19 | 19 | <?php |
20 | 20 | if (isset($_GET['famsatid'])) { |
21 | - $famsatid = filter_input(INPUT_GET,'famsatid',FILTER_SANITIZE_STRING); |
|
21 | + $famsatid = filter_input(INPUT_GET, 'famsatid', FILTER_SANITIZE_STRING); |
|
22 | 22 | } |
23 | 23 | if (isset($_GET['ident'])) { |
24 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
24 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
25 | 25 | } |
26 | 26 | if (!isset($ident) && !isset($famsatid)) { |
27 | 27 | ?> |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | <?php |
195 | 195 | } else { |
196 | 196 | ?> |
197 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
197 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
198 | 198 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
199 | 199 | <?php |
200 | 200 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | /* |
211 | 211 | shadowUrl: iconURLShadowpath, |
212 | 212 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
213 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
213 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
214 | 214 | */ |
215 | 215 | }) |
216 | 216 | }) |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | <?php |
251 | 251 | } else { |
252 | 252 | ?> |
253 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
253 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
254 | 254 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
255 | 255 | <?php |
256 | 256 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | <?php |
306 | 306 | } else { |
307 | 307 | ?> |
308 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
308 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
309 | 309 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
310 | 310 | <?php |
311 | 311 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | if (isset($_POST['airline'])) |
10 | 10 | { |
11 | - header('Location: '.$globalURL.'/airline/'.filter_input(INPUT_POST,'airline',FILTER_SANITIZE_STRING)); |
|
11 | + header('Location: '.$globalURL.'/airline/'.filter_input(INPUT_POST, 'airline', FILTER_SANITIZE_STRING)); |
|
12 | 12 | } else { |
13 | 13 | $title = "Airlines"; |
14 | 14 | require_once('header.php'); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | print '<div class="column">'; |
18 | 18 | print '<h1>'._("Airlines").'</h1>'; |
19 | 19 | if (isset($_POST['airline_type'])) { |
20 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
20 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
21 | 21 | //$airline_names = $Spotter->getAllAirlineNames($airline_type); |
22 | 22 | } else { |
23 | 23 | //$airline_names = $Spotter->getAllAirlineNames(); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | print '<div class="alphabet">'; |
30 | 30 | foreach ($alliances as $alliance) { |
31 | 31 | print '<div class="alphabet-airline alphabet-item">'; |
32 | - print '<a href="'.$globalURL.'/airline/alliance_'.str_replace(' ','_',$alliance['alliance']).'">'; |
|
33 | - if (file_exists('images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png')) |
|
32 | + print '<a href="'.$globalURL.'/airline/alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'; |
|
33 | + if (file_exists('images/airlines/'.str_replace(' ', '_', $alliance['alliance']).'.png')) |
|
34 | 34 | { |
35 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
|
35 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ', '_', $alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
|
36 | 36 | } else print $alliance['alliance']; |
37 | 37 | print '</a>'; |
38 | 38 | print '</div>'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $Stats = new Stats(); |
56 | 56 | if (isset($_POST['airline_type'])) |
57 | 57 | { |
58 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
58 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
59 | 59 | //$airline_names = $Stats->getAllAirlineNames($airline_type); |
60 | 60 | $airline_names = $Spotter->getAllAirlineNames($airline_type); |
61 | 61 | } else { |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | } |
69 | 69 | $previous = null; |
70 | 70 | print '<div class="alphabet-legend">'; |
71 | - foreach($airline_names as $value) |
|
71 | + foreach ($airline_names as $value) |
|
72 | 72 | { |
73 | 73 | //echo $value['airline_name']."\n"; |
74 | 74 | //echo mb_substr($value['airline_name'],0,1).' - '.$value['airline_name']."\n"; |
75 | 75 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airline_name'], 0, 1)); |
76 | - if($previous !== $firstLetter) |
|
76 | + if ($previous !== $firstLetter) |
|
77 | 77 | { |
78 | 78 | if ($previous !== null) print ' | '; |
79 | 79 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | } |
83 | 83 | print '</div>'; |
84 | 84 | $previous = null; |
85 | - foreach($airline_names as $value) { |
|
85 | + foreach ($airline_names as $value) { |
|
86 | 86 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airline_name'], 0, 1)); |
87 | 87 | if ($firstLetter != "") |
88 | 88 | { |
89 | - if($previous !== $firstLetter) |
|
89 | + if ($previous !== $firstLetter) |
|
90 | 90 | { |
91 | 91 | if ($previous !== null) print '</div>'; |
92 | 92 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | |
8 | 8 | if (isset($_POST['airport'])) |
9 | 9 | { |
10 | - header('Location: '.$globalURL.'/airport/'.filter_input(INPUT_POST,'airport',FILTER_SANITIZE_STRING)); |
|
11 | -} else if (isset($_GET['airport'])){ |
|
10 | + header('Location: '.$globalURL.'/airport/'.filter_input(INPUT_POST, 'airport', FILTER_SANITIZE_STRING)); |
|
11 | +} else if (isset($_GET['airport'])) { |
|
12 | 12 | $Spotter = new Spotter(); |
13 | 13 | //calculuation for the pagination |
14 | - if($_GET['limit'] == "") |
|
14 | + if ($_GET['limit'] == "") |
|
15 | 15 | { |
16 | 16 | $limit_start = 0; |
17 | 17 | $limit_end = 25; |
18 | 18 | $absolute_difference = 25; |
19 | - } else { |
|
19 | + } else { |
|
20 | 20 | $limit_explode = explode(",", $_GET['limit']); |
21 | 21 | $limit_start = $limit_explode[0]; |
22 | 22 | $limit_end = $limit_explode[1]; |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $limit_previous_1 = $limit_start - $absolute_difference; |
31 | 31 | $limit_previous_2 = $limit_end - $absolute_difference; |
32 | 32 | |
33 | - $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
34 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
33 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
34 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
35 | 35 | $page_url = $globalURL.'/airport/'.$airport; |
36 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport,$limit_start.",".$absolute_difference, $sort); |
|
36 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport, $limit_start.",".$absolute_difference, $sort); |
|
37 | 37 | $airport_array = $Spotter->getAllAirportInfo($airport); |
38 | 38 | |
39 | 39 | if (!empty($airport_array)) |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | $airport_names = $Spotter->getAllAirportNames(); |
53 | 53 | } |
54 | 54 | ksort($airport_names); |
55 | - foreach($airport_names as $airport_name) |
|
55 | + foreach ($airport_names as $airport_name) |
|
56 | 56 | { |
57 | - if($airport == $airport_name['airport_icao']) |
|
57 | + if ($airport == $airport_name['airport_icao']) |
|
58 | 58 | { |
59 | 59 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
60 | 60 | } else { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | print '<div class="table column">'; |
88 | 88 | if ($airport_array[0]['iata'] != "NA") |
89 | 89 | { |
90 | - print '<p>'.sprintf(_("The table below shows the route(s) aircrafts have used to/from <strong>%s</strong>, sorted by the most recent one."),$airport_array[0]['name']).'</p>'; |
|
90 | + print '<p>'.sprintf(_("The table below shows the route(s) aircrafts have used to/from <strong>%s</strong>, sorted by the most recent one."), $airport_array[0]['name']).'</p>'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | include('table-output.php'); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | print '<p>'._("Sorry, the airport does not exist in this database. :(").'</p>'; |
110 | 110 | } |
111 | 111 | } else { |
112 | - $Spotter= new Spotter(); |
|
112 | + $Spotter = new Spotter(); |
|
113 | 113 | $Stats = new Stats(); |
114 | 114 | $Common = new Common(); |
115 | 115 | $title = _("Airports"); |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | ksort($airport_names); |
124 | 124 | $previous = null; |
125 | 125 | print '<div class="alphabet-legend">'; |
126 | - foreach($airport_names as $value) { |
|
126 | + foreach ($airport_names as $value) { |
|
127 | 127 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airport_city'], 0, 1)); |
128 | - if($previous !== $firstLetter) |
|
128 | + if ($previous !== $firstLetter) |
|
129 | 129 | { |
130 | - if ($previous !== null){ |
|
130 | + if ($previous !== null) { |
|
131 | 131 | print ' | '; |
132 | 132 | } |
133 | 133 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | } |
137 | 137 | print '</div>'; |
138 | 138 | $previous = null; |
139 | - foreach($airport_names as $value) { |
|
139 | + foreach ($airport_names as $value) { |
|
140 | 140 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airport_city'], 0, 1)); |
141 | 141 | if ($firstLetter != "") |
142 | 142 | { |
143 | - if($previous !== $firstLetter) |
|
143 | + if ($previous !== $firstLetter) |
|
144 | 144 | { |
145 | - if ($previous !== null){ |
|
145 | + if ($previous !== null) { |
|
146 | 146 | print '</div>'; |
147 | 147 | } |
148 | 148 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -8,25 +8,25 @@ discard block |
||
8 | 8 | * @param string $filename |
9 | 9 | */ |
10 | 10 | public static function import_file($filename) { |
11 | - $filename = filter_var($filename,FILTER_SANITIZE_STRING); |
|
11 | + $filename = filter_var($filename, FILTER_SANITIZE_STRING); |
|
12 | 12 | $Connection = new Connection(); |
13 | 13 | if (!$Connection->connectionExists()) return 'error: DB connection failed'; |
14 | 14 | //Connection::$db->beginTransaction(); |
15 | 15 | $templine = ''; |
16 | - $handle = @fopen($filename,"r"); |
|
16 | + $handle = @fopen($filename, "r"); |
|
17 | 17 | if ($handle) { |
18 | 18 | //$lines = file($filename); |
19 | 19 | //foreach ($lines as $line) |
20 | - while (($line = fgets($handle,4096)) !== false) |
|
20 | + while (($line = fgets($handle, 4096)) !== false) |
|
21 | 21 | { |
22 | - if (substr($line,0,2) == '--' || $line == '') continue; |
|
22 | + if (substr($line, 0, 2) == '--' || $line == '') continue; |
|
23 | 23 | $templine .= $line; |
24 | - if (substr(trim($line), -1,1) == ';') |
|
24 | + if (substr(trim($line), -1, 1) == ';') |
|
25 | 25 | { |
26 | 26 | try { |
27 | 27 | $sth = $Connection->db->prepare($templine); |
28 | 28 | $sth->execute(); |
29 | - } catch(PDOException $e) { |
|
29 | + } catch (PDOException $e) { |
|
30 | 30 | return "error (import ".$filename.") : ".$e->getMessage()."\n"; |
31 | 31 | } |
32 | 32 | $templine = ''; |
@@ -43,21 +43,21 @@ discard block |
||
43 | 43 | $error = ''; |
44 | 44 | $dh = opendir($directory); |
45 | 45 | //foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename) |
46 | - while(false !== ($filename = readdir($dh))) |
|
46 | + while (false !== ($filename = readdir($dh))) |
|
47 | 47 | { |
48 | - if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
48 | + if (preg_match('/\.sql$/', $filename)) $error .= create_db::import_file($directory.$filename); |
|
49 | 49 | } |
50 | 50 | return $error; |
51 | 51 | } |
52 | 52 | |
53 | - public static function create_database($root,$root_pass,$user,$pass,$db,$db_type,$host,$port = '') { |
|
54 | - $root = filter_var($root,FILTER_SANITIZE_STRING); |
|
55 | - $root_pass = filter_var($root_pass,FILTER_SANITIZE_STRING); |
|
56 | - $user = filter_var($user,FILTER_SANITIZE_STRING); |
|
57 | - $password = filter_var($pass,FILTER_SANITIZE_STRING); |
|
58 | - $db = filter_var($db,FILTER_SANITIZE_STRING); |
|
59 | - $db_type = filter_var($db_type,FILTER_SANITIZE_STRING); |
|
60 | - $host = filter_var($host,FILTER_SANITIZE_STRING); |
|
53 | + public static function create_database($root, $root_pass, $user, $pass, $db, $db_type, $host, $port = '') { |
|
54 | + $root = filter_var($root, FILTER_SANITIZE_STRING); |
|
55 | + $root_pass = filter_var($root_pass, FILTER_SANITIZE_STRING); |
|
56 | + $user = filter_var($user, FILTER_SANITIZE_STRING); |
|
57 | + $password = filter_var($pass, FILTER_SANITIZE_STRING); |
|
58 | + $db = filter_var($db, FILTER_SANITIZE_STRING); |
|
59 | + $db_type = filter_var($db_type, FILTER_SANITIZE_STRING); |
|
60 | + $host = filter_var($host, FILTER_SANITIZE_STRING); |
|
61 | 61 | if ($db_type == 'mysql' && $port == '') $port = 3306; |
62 | 62 | elseif ($port == '') $port = 5432; |
63 | 63 | // Dirty hack |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $grantright = $_SERVER['SERVER_ADDR']; |
66 | 66 | } else $grantright = 'localhost'; |
67 | 67 | try { |
68 | - if ($host == 'localhost') $dbh = new PDO($db_type.':host=127.0.0.1',$root,$root_pass); |
|
69 | - else $dbh = new PDO($db_type.':host='.$host.';port='.$port,$root,$root_pass); |
|
68 | + if ($host == 'localhost') $dbh = new PDO($db_type.':host=127.0.0.1', $root, $root_pass); |
|
69 | + else $dbh = new PDO($db_type.':host='.$host.';port='.$port, $root, $root_pass); |
|
70 | 70 | $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
71 | 71 | if ($db_type == 'mysql') { |
72 | 72 | $dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."'; |
77 | 77 | GRANT ALL PRIVILEGES ON DATABASE ".$db." TO ".$user.";"); |
78 | 78 | } |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | $dbh = null; |
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | $globalDebug = FALSE; |
71 | 71 | $dbroot = $_SESSION['database_root']; |
72 | 72 | $dbrootpass = $_SESSION['database_rootpass']; |
73 | - $error .= create_db::create_database($dbroot,$dbrootpass,$globalDBuser,$globalDBpass,$globalDBname,$globalDBdriver,$globalDBhost); |
|
73 | + $error .= create_db::create_database($dbroot, $dbrootpass, $globalDBuser, $globalDBpass, $globalDBname, $globalDBdriver, $globalDBhost); |
|
74 | 74 | sleep(5); |
75 | 75 | if ($error != '') { |
76 | 76 | $_SESSION['error'] = $error; |
77 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database')); |
|
78 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
77 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create database')); |
|
78 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create database')); |
|
79 | 79 | $_SESSION['install'] = 'database_import'; |
80 | 80 | $_SESSION['next'] = 'Create and import tables'; |
81 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
81 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
82 | 82 | print json_encode($result); |
83 | 83 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
84 | 84 | $globalDebug = FALSE; |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | } |
93 | 93 | if ($error != '') { |
94 | 94 | $_SESSION['error'] = $error; |
95 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
96 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
95 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
96 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create and import tables')); |
|
97 | 97 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
98 | 98 | $_SESSION['install'] = 'populate'; |
99 | 99 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -101,23 +101,23 @@ discard block |
||
101 | 101 | $_SESSION['install'] = 'sources'; |
102 | 102 | $_SESSION['next'] = 'Insert data in source table'; |
103 | 103 | } |
104 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
104 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
105 | 105 | print json_encode($result); |
106 | 106 | } elseif (!is_numeric($check_version)) { |
107 | 107 | $error .= $check_version; |
108 | 108 | $_SESSION['error'] = $error; |
109 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
110 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
109 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
110 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
111 | 111 | print json_encode($result); |
112 | 112 | } else { |
113 | 113 | $error .= update_schema::check_version(true); |
114 | 114 | if ($error != '') { |
115 | 115 | $_SESSION['error'] = $error; |
116 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed')); |
|
117 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
116 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Update schema if needed')); |
|
117 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Update schema if needed')); |
|
118 | 118 | $_SESSION['install'] = 'sources'; |
119 | 119 | $_SESSION['next'] = 'Insert data in source table'; |
120 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
120 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
121 | 121 | print json_encode($result); |
122 | 122 | } |
123 | 123 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'waypoints') { |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | $error .= update_db::update_waypoints(); |
127 | 127 | if ($error != '') { |
128 | 128 | $_SESSION['error'] = $error; |
129 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database')); |
|
130 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
129 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate waypoints database')); |
|
130 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate waypoints database')); |
|
131 | 131 | $_SESSION['install'] = 'airspace'; |
132 | 132 | $_SESSION['next'] = 'Populate airspace table'; |
133 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
133 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
134 | 134 | print json_encode($result); |
135 | 135 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'airspace') { |
136 | 136 | include_once('class.update_db.php'); |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | $error .= update_db::update_airspace_fam(); |
139 | 139 | if ($error != '') { |
140 | 140 | $_SESSION['error'] = $error; |
141 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate airspace database')); |
|
142 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate airspace database')); |
|
141 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate airspace database')); |
|
142 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate airspace database')); |
|
143 | 143 | $_SESSION['install'] = 'countries'; |
144 | 144 | $_SESSION['next'] = 'Populate countries table'; |
145 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
145 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
146 | 146 | print json_encode($result); |
147 | 147 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'countries') { |
148 | 148 | include_once('class.update_db.php'); |
@@ -150,31 +150,31 @@ discard block |
||
150 | 150 | $error .= update_db::update_countries(); |
151 | 151 | if ($error != '') { |
152 | 152 | $_SESSION['error'] = $error; |
153 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
|
154 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
153 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate countries database')); |
|
154 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate countries database')); |
|
155 | 155 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
156 | 156 | $_SESSION['install'] = 'notam'; |
157 | 157 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
158 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
158 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
159 | 159 | print json_encode($result); |
160 | 160 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
161 | 161 | $_SESSION['install'] = 'owner'; |
162 | 162 | $_SESSION['next'] = 'Populate owner table with externals data'; |
163 | 163 | unset($_SESSION['owner']); |
164 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
164 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
165 | 165 | print json_encode($result); |
166 | 166 | } else { |
167 | 167 | $_SESSION['install'] = 'sources'; |
168 | 168 | $_SESSION['next'] = 'Insert data in source table'; |
169 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
169 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
170 | 170 | print json_encode($result); |
171 | 171 | } |
172 | 172 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
173 | 173 | if (!is_writable('tmp')) { |
174 | 174 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
175 | 175 | $_SESSION['error'] = $error; |
176 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
177 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
176 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
177 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
178 | 178 | print json_encode($result); |
179 | 179 | } else { |
180 | 180 | include_once('class.update_db.php'); |
@@ -182,19 +182,19 @@ discard block |
||
182 | 182 | $error .= update_db::update_ModeS_fam(); |
183 | 183 | if ($error != '') { |
184 | 184 | $_SESSION['error'] = $error; |
185 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
186 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
185 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
186 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
187 | 187 | $_SESSION['install'] = 'populate_flarm'; |
188 | 188 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
189 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
189 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
190 | 190 | print json_encode($result); |
191 | 191 | } |
192 | 192 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
193 | 193 | if (!is_writable('tmp')) { |
194 | 194 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
195 | 195 | $_SESSION['error'] = $error; |
196 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
197 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
196 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
197 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
198 | 198 | print json_encode($result); |
199 | 199 | } else { |
200 | 200 | include_once('class.update_db.php'); |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $error .= update_db::update_ModeS_ogn(); |
204 | 204 | if ($error != '') { |
205 | 205 | $_SESSION['error'] = $error; |
206 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
207 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
206 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
207 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
208 | 208 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
209 | 209 | $_SESSION['install'] = 'vatsim'; |
210 | 210 | if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | $_SESSION['install'] = 'routes'; |
224 | 224 | $_SESSION['next'] = 'Populate routes table with externals data'; |
225 | 225 | } |
226 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
226 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
227 | 227 | print json_encode($result); |
228 | 228 | } |
229 | 229 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
230 | 230 | if (!is_writable('tmp')) { |
231 | 231 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
232 | 232 | $_SESSION['error'] = $error; |
233 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
234 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
233 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
234 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
235 | 235 | print json_encode($result); |
236 | 236 | } else { |
237 | 237 | include_once('class.update_db.php'); |
@@ -239,19 +239,19 @@ discard block |
||
239 | 239 | $error .= update_db::update_routes_fam(); |
240 | 240 | if ($error != '') { |
241 | 241 | $_SESSION['error'] = $error; |
242 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data')); |
|
243 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
242 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate routes table with externals data')); |
|
243 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate routes table with externals data')); |
|
244 | 244 | $_SESSION['install'] = 'translation'; |
245 | 245 | $_SESSION['next'] = 'Populate translation table with externals data'; |
246 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
246 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
247 | 247 | print json_encode($result); |
248 | 248 | } |
249 | 249 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
250 | 250 | if (!is_writable('tmp')) { |
251 | 251 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
252 | 252 | $_SESSION['error'] = $error; |
253 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
254 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
253 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
254 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
255 | 255 | print json_encode($result); |
256 | 256 | } else { |
257 | 257 | include_once('class.update_db.php'); |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | $error .= update_db::update_translation_fam(); |
260 | 260 | if ($error != '') { |
261 | 261 | $_SESSION['error'] = $error; |
262 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
263 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
262 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
263 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate translation table with externals data')); |
|
264 | 264 | if ($_SESSION['waypoints'] == 1) { |
265 | 265 | $_SESSION['install'] = 'waypoints'; |
266 | 266 | $_SESSION['next'] = 'Populate waypoints table'; |
@@ -276,15 +276,15 @@ discard block |
||
276 | 276 | $_SESSION['install'] = 'sources'; |
277 | 277 | $_SESSION['next'] = 'Insert data in source table'; |
278 | 278 | } |
279 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
279 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
280 | 280 | print json_encode($result); |
281 | 281 | } |
282 | 282 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
283 | 283 | if (!is_writable('tmp')) { |
284 | 284 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
285 | 285 | $_SESSION['error'] = $error; |
286 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
287 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
286 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
287 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
288 | 288 | print json_encode($result); |
289 | 289 | } else { |
290 | 290 | include_once('class.update_db.php'); |
@@ -292,19 +292,19 @@ discard block |
||
292 | 292 | $error = update_db::update_owner_fam(); |
293 | 293 | if ($error != '') { |
294 | 294 | $_SESSION['error'] = $error; |
295 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
296 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
295 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
296 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate owner table with externals data')); |
|
297 | 297 | $_SESSION['install'] = 'sources'; |
298 | 298 | $_SESSION['next'] = 'Insert data in source table'; |
299 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
299 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
300 | 300 | print json_encode($result); |
301 | 301 | } |
302 | 302 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
303 | 303 | if (!is_writable('tmp')) { |
304 | 304 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
305 | 305 | $_SESSION['error'] = $error; |
306 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
307 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
306 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
307 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
308 | 308 | print json_encode($result); |
309 | 309 | } else { |
310 | 310 | include_once('class.update_db.php'); |
@@ -313,24 +313,24 @@ discard block |
||
313 | 313 | $error .= update_db::update_notam(); |
314 | 314 | if ($error != '') { |
315 | 315 | $_SESSION['error'] = $error; |
316 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
317 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
316 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
317 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data')); |
|
318 | 318 | } else { |
319 | 319 | if ($error != '') { |
320 | 320 | $_SESSION['error'] = $error; |
321 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)')); |
|
322 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
321 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data (no source defined)')); |
|
322 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data (no source defined)')); |
|
323 | 323 | } |
324 | 324 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
325 | 325 | $_SESSION['install'] = 'owner'; |
326 | 326 | $_SESSION['next'] = 'Populate owner table'; |
327 | 327 | unset($_SESSION['owner']); |
328 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
328 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
329 | 329 | print json_encode($result); |
330 | 330 | } else { |
331 | 331 | $_SESSION['install'] = 'sources'; |
332 | 332 | $_SESSION['next'] = 'Insert data in source table'; |
333 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
333 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
334 | 334 | print json_encode($result); |
335 | 335 | } |
336 | 336 | } |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | $Source = new Source(); |
368 | 368 | $Source->deleteAllLocation(); |
369 | 369 | foreach ($sources as $src) { |
370 | - if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
370 | + if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'], $src['latitude'], $src['longitude'], $src['altitude'], $src['city'], $src['country'], $src['source'], 'antenna.png'); |
|
371 | 371 | } |
372 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
372 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert data in source table')); |
|
373 | 373 | unset($_SESSION['sources']); |
374 | 374 | } |
375 | 375 | /* |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $_SESSION['install'] = 'finish'; |
395 | 395 | $_SESSION['next'] = 'finish'; |
396 | 396 | } |
397 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
397 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
398 | 398 | print json_encode($result); |
399 | 399 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'vatsim') { |
400 | 400 | include_once('../install/class.create_db.php'); |
@@ -406,48 +406,48 @@ discard block |
||
406 | 406 | $error .= update_db::update_IVAO(); |
407 | 407 | if ($error != '') { |
408 | 408 | $_SESSION['error'] = $error; |
409 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
410 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
409 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
410 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
411 | 411 | } else { |
412 | 412 | $error .= update_db::update_vatsim(); |
413 | 413 | if ($error != '') { |
414 | 414 | $_SESSION['error'] = $error; |
415 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
416 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
415 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
416 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
417 | 417 | } |
418 | 418 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
419 | 419 | $error .= update_db::update_vatsim(); |
420 | 420 | if ($error != '') { |
421 | 421 | $_SESSION['error'] = $error; |
422 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
423 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
422 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
423 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
424 | 424 | } elseif (isset($globalIVAO) && $globalIVAO) { |
425 | 425 | if (file_exists('tmp/ivae_feb2013.zip')) { |
426 | 426 | $error .= update_db::update_IVAO(); |
427 | 427 | if ($error != '') { |
428 | 428 | $_SESSION['error'] = $error; |
429 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
430 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
429 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
430 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
431 | 431 | } else { |
432 | 432 | $error .= update_db::update_vatsim(); |
433 | 433 | if ($error != '') { |
434 | 434 | $_SESSION['error'] = $error; |
435 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)')); |
|
436 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
435 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data (IVAO not found)')); |
|
436 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data (IVAO not found)')); |
|
437 | 437 | } |
438 | 438 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
439 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
|
439 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert phpVMS data')); |
|
440 | 440 | } |
441 | 441 | //$_SESSION['install'] = 'routes'; |
442 | 442 | //$_SESSION['next'] = 'Populate routes table with externals data'; |
443 | 443 | $_SESSION['install'] = 'finish'; |
444 | 444 | $_SESSION['next'] = 'finish'; |
445 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
445 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
446 | 446 | print json_encode($result); |
447 | 447 | } else { |
448 | 448 | //unset($_SESSION['install']); |
449 | 449 | $_SESSION['error'] = 'Unknwon task : '.$_SESSION['install']; |
450 | - $result = array('error' => 'Unknwon task : '.$_SESSION['install'],'done' => $_SESSION['done'],'next' => 'finish','install' => 'finish'); |
|
450 | + $result = array('error' => 'Unknwon task : '.$_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish'); |
|
451 | 451 | print json_encode($result); |
452 | 452 | } |
453 | 453 | ?> |
454 | 454 | \ No newline at end of file |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | try { |
21 | 21 | $sth = $this->db->prepare($query); |
22 | 22 | $sth->execute(array(':name' => $name)); |
23 | - } catch(PDOException $e) { |
|
23 | + } catch (PDOException $e) { |
|
24 | 24 | echo $e->getMessage(); |
25 | 25 | } |
26 | 26 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | try { |
33 | 33 | $sth = $this->db->prepare($query); |
34 | 34 | $sth->execute(); |
35 | - } catch(PDOException $e) { |
|
35 | + } catch (PDOException $e) { |
|
36 | 36 | echo $e->getMessage(); |
37 | 37 | } |
38 | 38 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | try { |
45 | 45 | $sth = $this->db->prepare($query); |
46 | 46 | $sth->execute(); |
47 | - } catch(PDOException $e) { |
|
47 | + } catch (PDOException $e) { |
|
48 | 48 | echo $e->getMessage(); |
49 | 49 | } |
50 | 50 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | try { |
57 | 57 | $sth = $this->db->prepare($query); |
58 | 58 | $sth->execute(array(':type' => $type)); |
59 | - } catch(PDOException $e) { |
|
59 | + } catch (PDOException $e) { |
|
60 | 60 | echo $e->getMessage(); |
61 | 61 | } |
62 | 62 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -64,49 +64,49 @@ discard block |
||
64 | 64 | else return array(); |
65 | 65 | } |
66 | 66 | |
67 | - public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
67 | + public function position_all($timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
68 | 68 | $all_sat = $this->get_tle_names(); |
69 | 69 | $result = array(); |
70 | 70 | foreach ($all_sat as $sat) { |
71 | - $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
|
72 | - $result = array_merge($position,$result); |
|
71 | + $position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second); |
|
72 | + $result = array_merge($position, $result); |
|
73 | 73 | } |
74 | 74 | return $result; |
75 | 75 | } |
76 | 76 | |
77 | - public function position_all_type($type,$timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
77 | + public function position_all_type($type, $timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
78 | 78 | $all_sat = $this->get_tle_names_type($type); |
79 | 79 | $result = array(); |
80 | 80 | foreach ($all_sat as $sat) { |
81 | - $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
|
82 | - if (isset($position[0])) $result = array_merge($position,$result); |
|
81 | + $position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second); |
|
82 | + if (isset($position[0])) $result = array_merge($position, $result); |
|
83 | 83 | else $result[] = $position; |
84 | 84 | } |
85 | 85 | return $result; |
86 | 86 | } |
87 | 87 | |
88 | - public function position($name,$timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
88 | + public function position($name, $timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
89 | 89 | $qth = new Predict_QTH(); |
90 | 90 | $qth->lat = floatval(37.790252); |
91 | 91 | $qth->lon = floatval(-122.419968); |
92 | 92 | |
93 | 93 | $tle_file = $this->get_tle($name); |
94 | 94 | $type = $tle_file['tle_type']; |
95 | - $tle = new Predict_TLE($tle_file['tle_name'],$tle_file['tle_tle1'],$tle_file['tle_tle2']); |
|
95 | + $tle = new Predict_TLE($tle_file['tle_name'], $tle_file['tle_tle1'], $tle_file['tle_tle2']); |
|
96 | 96 | $sat = new Predict_Sat($tle); |
97 | 97 | $predict = new Predict(); |
98 | 98 | //if ($timestamp == '') $now = Predict_Time::get_current_daynum(); |
99 | 99 | if ($timestamp_begin == '') $timestamp_begin = time(); |
100 | 100 | if ($timestamp_end == '') { |
101 | 101 | $now = Predict_Time::unix2daynum($timestamp_begin); |
102 | - $predict->predict_calc($sat,$qth,$now); |
|
103 | - return array('name' => $name, 'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp_begin,'type' => $type); |
|
102 | + $predict->predict_calc($sat, $qth, $now); |
|
103 | + return array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp_begin, 'type' => $type); |
|
104 | 104 | } else { |
105 | 105 | $result = array(); |
106 | - for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp=$timestamp+$second) { |
|
106 | + for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp = $timestamp + $second) { |
|
107 | 107 | $now = Predict_Time::unix2daynum($timestamp); |
108 | - $predict->predict_calc($sat,$qth,$now); |
|
109 | - $result[] = array('name' => $name,'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp,'type' => $type); |
|
108 | + $predict->predict_calc($sat, $qth, $now); |
|
109 | + $result[] = array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp, 'type' => $type); |
|
110 | 110 | } |
111 | 111 | return $result; |
112 | 112 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | try { |
118 | 118 | $sth = $this->db->prepare($query); |
119 | 119 | $sth->execute(array(':name' => $name.'%')); |
120 | - } catch(PDOException $e) { |
|
120 | + } catch (PDOException $e) { |
|
121 | 121 | echo $e->getMessage(); |
122 | 122 | } |
123 | 123 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $sth->execute($query_values); |
146 | 146 | $launch_site_array = array(); |
147 | 147 | $temp_array = array(); |
148 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
148 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
149 | 149 | { |
150 | 150 | $temp_array['launch_site'] = $row['launch_site']; |
151 | 151 | $temp_array['launch_site_count'] = $row['launch_site_count']; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $sth->execute($query_values); |
175 | 175 | $owner_array = array(); |
176 | 176 | $temp_array = array(); |
177 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
177 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
178 | 178 | { |
179 | 179 | $temp_array['owner_name'] = $row['owner_name']; |
180 | 180 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $sth->execute($query_values); |
204 | 204 | $owner_array = array(); |
205 | 205 | $temp_array = array(); |
206 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
206 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
207 | 207 | { |
208 | 208 | $temp_array['country_name'] = $row['country_name']; |
209 | 209 | $temp_array['country_count'] = $row['country_count']; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $sth->execute($query_data); |
248 | 248 | $date_array = array(); |
249 | 249 | $temp_array = array(); |
250 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
250 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
251 | 251 | { |
252 | 252 | $temp_array['year_name'] = $row['year_name']; |
253 | 253 | $temp_array['month_name'] = $row['month_name']; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $sth->execute($query_data); |
293 | 293 | $date_array = array(); |
294 | 294 | $temp_array = array(); |
295 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
295 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
296 | 296 | { |
297 | 297 | $temp_array['year_name'] = $row['year_name']; |
298 | 298 | $temp_array['date_count'] = $row['date_count']; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | header('Content-disposition: attachment; filename="flightairmap-sat.json"'); |
14 | 14 | } |
15 | 15 | } |
16 | -$history = urldecode(filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING)); |
|
16 | +$history = urldecode(filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING)); |
|
17 | 17 | header('Content-Type: text/javascript'); |
18 | 18 | |
19 | 19 | $begintime = microtime(true); |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | |
22 | 22 | $spotter_array = array(); |
23 | 23 | if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') { |
24 | - $sattypes = explode(',',$_COOKIE['sattypes']); |
|
24 | + $sattypes = explode(',', $_COOKIE['sattypes']); |
|
25 | 25 | foreach ($sattypes as $sattype) { |
26 | 26 | //$spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array); |
27 | - $spotter_array = array_merge($Satellite->position_all_type($sattype),$spotter_array); |
|
27 | + $spotter_array = array_merge($Satellite->position_all_type($sattype), $spotter_array); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | //$spotter_array = array_unique($spotter_array,SORT_REGULAR); |
38 | 38 | //print_r($spotter_array); |
39 | -$sqltime = round(microtime(true)-$begintime,2); |
|
39 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
40 | 40 | |
41 | 41 | $output = '{"type":"FeatureCollection","features":['; |
42 | 42 | if (!empty($spotter_array) && is_array($spotter_array)) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $last_name = ''; |
45 | 45 | $coordinatearray = ''; |
46 | 46 | $timearray = array(); |
47 | - foreach($spotter_array as $spotter_item) |
|
47 | + foreach ($spotter_array as $spotter_item) |
|
48 | 48 | { |
49 | 49 | $output_data = ''; |
50 | 50 | $output_data .= '{"type":"Feature","properties":{'; |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | } |
62 | 62 | $output_data .= '"altitude":0,'; |
63 | 63 | $output_data .= '"sqt":'.$sqltime.','; |
64 | - $nextlatlon = $Satellite->position($spotter_item['name'],time()+$globalMapRefresh+20); |
|
64 | + $nextlatlon = $Satellite->position($spotter_item['name'], time() + $globalMapRefresh + 20); |
|
65 | 65 | $nextlat = $nextlatlon['latitude']; |
66 | - if (abs($nextlat-$spotter_item['latitude']) > 90) { |
|
66 | + if (abs($nextlat - $spotter_item['latitude']) > 90) { |
|
67 | 67 | if ($spotter_item['latitude'] < 0) $nexlat = -90; |
68 | 68 | else $nexlat = 90; |
69 | 69 | } |
70 | 70 | $nextlon = $nextlatlon['longitude']; |
71 | - if (abs($nextlon-$spotter_item['longitude']) > 180) { |
|
71 | + if (abs($nextlon - $spotter_item['longitude']) > 180) { |
|
72 | 72 | if ($spotter_item['longitude'] < 0) $nextlon = -180; |
73 | 73 | else $nextlon = 180; |
74 | 74 | } |
@@ -79,27 +79,27 @@ discard block |
||
79 | 79 | $output_data .= ']}},'; |
80 | 80 | $output .= $output_data; |
81 | 81 | if ($history == $spotter_item['name']) { |
82 | - $spotter_history_array = $Satellite->position($spotter_item['name'],time()-6000,time()); |
|
82 | + $spotter_history_array = $Satellite->position($spotter_item['name'], time() - 6000, time()); |
|
83 | 83 | $spotter_history_array = array_reverse($spotter_history_array); |
84 | 84 | $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['name'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
85 | 85 | foreach ($spotter_history_array as $key => $spotter_history) { |
86 | - if ((isset($previous_lon) && abs($previous_lon-$spotter_history['longitude']) > 180) || (isset($previous_lat) && abs($previous_lat-$spotter_history['latitude']) > 90)) { |
|
86 | + if ((isset($previous_lon) && abs($previous_lon - $spotter_history['longitude']) > 180) || (isset($previous_lat) && abs($previous_lat - $spotter_history['latitude']) > 90)) { |
|
87 | 87 | break; |
88 | 88 | } |
89 | 89 | $output_history .= '['; |
90 | - $output_history .= $spotter_history['longitude'].', '; |
|
91 | - $output_history .= $spotter_history['latitude']; |
|
90 | + $output_history .= $spotter_history['longitude'].', '; |
|
91 | + $output_history .= $spotter_history['latitude']; |
|
92 | 92 | $output_history .= '],'; |
93 | 93 | $previous_lon = $spotter_history['longitude']; |
94 | 94 | $previous_lat = $spotter_history['latitude']; |
95 | 95 | } |
96 | - $output_history = substr($output_history,0,-1); |
|
96 | + $output_history = substr($output_history, 0, -1); |
|
97 | 97 | $output_history .= ']}},'; |
98 | 98 | $output .= $output_history; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | -if (isset($output_data)) $output = substr($output,0,-1); |
|
102 | +if (isset($output_data)) $output = substr($output, 0, -1); |
|
103 | 103 | $output .= ']}'; |
104 | 104 | print $output; |
105 | 105 | ?> |
@@ -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'] == 'true') || !isset($_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; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | / @param String $source source of data |
26 | 26 | */ |
27 | 27 | |
28 | - public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') { |
|
28 | + public function addSchedule($ident, $departure_airport_icao, $departure_airport_time, $arrival_airport_icao, $arrival_airport_time, $source = 'website') { |
|
29 | 29 | date_default_timezone_set('UTC'); |
30 | - $date = date("Y-m-d H:i:s",time()); |
|
30 | + $date = date("Y-m-d H:i:s", time()); |
|
31 | 31 | //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
32 | 32 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
33 | 33 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
@@ -35,69 +35,69 @@ discard block |
||
35 | 35 | try { |
36 | 36 | $sth = $this->db->prepare($query); |
37 | 37 | $sth->execute($query_values); |
38 | - } catch(PDOException $e) { |
|
38 | + } catch (PDOException $e) { |
|
39 | 39 | return "error : ".$e->getMessage(); |
40 | 40 | } |
41 | 41 | if ($sth->fetchColumn() > 0) { |
42 | 42 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
43 | 43 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
44 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
44 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao); |
|
45 | 45 | } elseif ($arrival_airport_time == '') { |
46 | 46 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao"; |
47 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
|
47 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao); |
|
48 | 48 | } elseif ($departure_airport_time == '') { |
49 | 49 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
50 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
50 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time); |
|
51 | 51 | } else { |
52 | 52 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time"; |
53 | 53 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
54 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
54 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time); |
|
55 | 55 | } |
56 | 56 | try { |
57 | 57 | $sth = $this->db->prepare($query); |
58 | 58 | $sth->execute($query_values); |
59 | - } catch(PDOException $e) { |
|
59 | + } catch (PDOException $e) { |
|
60 | 60 | return "error : ".$e->getMessage(); |
61 | 61 | } |
62 | 62 | if ($sth->fetchColumn() == 0) { |
63 | 63 | //$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident'; |
64 | 64 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
65 | 65 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
66 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
66 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
67 | 67 | } elseif ($arrival_airport_time == '') { |
68 | 68 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
69 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
69 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
70 | 70 | } elseif ($departure_airport_time == '') { |
71 | 71 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
72 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
72 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
73 | 73 | } else { |
74 | 74 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
75 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
75 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
76 | 76 | } |
77 | 77 | try { |
78 | 78 | $sth = $this->db->prepare($query); |
79 | 79 | $sth->execute($query_values); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | } else { |
84 | 84 | //$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident'; |
85 | 85 | $query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident'; |
86 | - $query_values = array(':ident' => $ident,':date' => $date); |
|
86 | + $query_values = array(':ident' => $ident, ':date' => $date); |
|
87 | 87 | try { |
88 | 88 | $sth = $this->db->prepare($query); |
89 | 89 | $sth->execute($query_values); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | } else { |
95 | 95 | $query = 'INSERT INTO routes (CallSign,FromAirport_ICAO, FromAirport_Time, ToAirport_ICAO, ToAirport_Time,date_added,source) VALUES (:ident,:departure_airport_icao,:departure_airport_time,:arrival_airport_icao,:arrival_airport_time,:date,:source)'; |
96 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
96 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
97 | 97 | try { |
98 | 98 | $sth = $this->db->prepare($query); |
99 | 99 | $sth->execute($query_values); |
100 | - } catch(PDOException $e) { |
|
100 | + } catch (PDOException $e) { |
|
101 | 101 | return "error : ".$e->getMessage(); |
102 | 102 | } |
103 | 103 | } |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | |
107 | 107 | public function getSchedule($ident) { |
108 | 108 | $Translation = new Translation($this->db); |
109 | - $operator = $Translation->checkTranslation($ident,false); |
|
109 | + $operator = $Translation->checkTranslation($ident, false); |
|
110 | 110 | if ($ident != $operator) { |
111 | 111 | $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1"; |
112 | - $query_values = array(':ident' => $ident,'operator' => $operator); |
|
112 | + $query_values = array(':ident' => $ident, 'operator' => $operator); |
|
113 | 113 | } else { |
114 | 114 | $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1"; |
115 | 115 | $query_values = array(':ident' => $ident); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | try { |
118 | 118 | $sth = $this->db->prepare($query); |
119 | 119 | $sth->execute($query_values); |
120 | - } catch(PDOException $e) { |
|
120 | + } catch (PDOException $e) { |
|
121 | 121 | return "error : ".$e->getMessage(); |
122 | 122 | } |
123 | 123 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | try { |
142 | 142 | $sth = $this->db->prepare($query); |
143 | 143 | $sth->execute($query_values); |
144 | - } catch(PDOException $e) { |
|
144 | + } catch (PDOException $e) { |
|
145 | 145 | return "error : ".$e->getMessage(); |
146 | 146 | } |
147 | 147 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | * @param String $carrier IATA code |
157 | 157 | * @return Flight departure and arrival airports and time |
158 | 158 | */ |
159 | - private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') { |
|
159 | + private function getAirFrance($callsign, $date = 'NOW', $carrier = 'AF') { |
|
160 | 160 | $Common = new Common(); |
161 | 161 | $check_date = new Datetime($date); |
162 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
163 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
162 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
163 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
164 | 164 | $url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym'); |
165 | 165 | $json = $Common->getData($url); |
166 | 166 | |
167 | 167 | $parsed_json = json_decode($json); |
168 | - if (property_exists($parsed_json,'errors') === false) { |
|
168 | + if (property_exists($parsed_json, 'errors') === false) { |
|
169 | 169 | //$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'}; |
170 | 170 | $originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'}; |
171 | 171 | //$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'}; |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | //$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'}; |
176 | 176 | $arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'}; |
177 | 177 | |
178 | - preg_match('/\((.*?)\)/',$originShort,$originiata); |
|
178 | + preg_match('/\((.*?)\)/', $originShort, $originiata); |
|
179 | 179 | $DepartureAirportIata = $originiata[1]; |
180 | - preg_match('/\((.*?)\)/',$destinationShort,$destinationiata); |
|
180 | + preg_match('/\((.*?)\)/', $destinationShort, $destinationiata); |
|
181 | 181 | $ArrivalAirportIata = $destinationiata[1]; |
182 | 182 | |
183 | 183 | /* |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $arrivalTime = gmdate('H:i',strtotime($arrivalTime)); |
187 | 187 | */ |
188 | 188 | |
189 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance'); |
|
189 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airfrance'); |
|
190 | 190 | } else return array(); |
191 | 191 | } |
192 | 192 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | $Common = new Common(); |
202 | 202 | date_default_timezone_set($globalTimezone); |
203 | 203 | $check_date = new Datetime($date); |
204 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
205 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
204 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
205 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
206 | 206 | $url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign; |
207 | 207 | $json = $Common->getData($url); |
208 | 208 | $parsed_json = json_decode($json); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'}; |
215 | 215 | $arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'}; |
216 | 216 | |
217 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet'); |
|
217 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_easyjet'); |
|
218 | 218 | } else return array(); |
219 | 219 | } |
220 | 220 | |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | */ |
226 | 226 | private function getRyanair($callsign) { |
227 | 227 | $Common = new Common(); |
228 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
229 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
228 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
229 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
230 | 230 | $url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/"; |
231 | 231 | $post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}'; |
232 | - $headers = array('Content-Type: application/json','Content-Length: ' . strlen($post)); |
|
233 | - $json = $Common->getData($url,'post',$post,$headers); |
|
232 | + $headers = array('Content-Type: application/json', 'Content-Length: '.strlen($post)); |
|
233 | + $json = $Common->getData($url, 'post', $post, $headers); |
|
234 | 234 | $parsed_json = json_decode($json); |
235 | 235 | if (isset($parsed_json->{'flightInfo'})) { |
236 | 236 | $flights = $parsed_json->{'flightInfo'}; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name |
240 | 240 | $departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'}; |
241 | 241 | $arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'}; |
242 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
242 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
243 | 243 | } else return array(); |
244 | 244 | } else return array(); |
245 | 245 | } |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | */ |
252 | 252 | private function getSwiss($callsign) { |
253 | 253 | $Common = new Common(); |
254 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
255 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
254 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
255 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
256 | 256 | $url = "http://www.world-of-swiss.com/fr/routenetwork.json"; |
257 | 257 | $json = $Common->getData($url); |
258 | 258 | $parsed_json = json_decode($json); |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | if ($flight->{'no'} == "Vol LX ".$numvol) { |
267 | 267 | $DepartureAirportIata = $flight->{'from'}->{'code'}; //city |
268 | 268 | $ArrivalAirportIata = $flight->{'to'}->{'code'}; //city |
269 | - $departureTime = substr($flight->{'from'}->{'hour'},0,5); |
|
270 | - $arrivalTime = substr($flight->{'to'}->{'hour'},0,5); |
|
269 | + $departureTime = substr($flight->{'from'}->{'hour'},0, 5); |
|
270 | + $arrivalTime = substr($flight->{'to'}->{'hour'},0, 5); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) { |
274 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss'); |
|
274 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_swiss'); |
|
275 | 275 | } else return array(); |
276 | 276 | } else return array(); |
277 | 277 | } |
@@ -286,21 +286,21 @@ discard block |
||
286 | 286 | global $globalBritishAirwaysKey; |
287 | 287 | $Common = new Common(); |
288 | 288 | $check_date = new Datetime($date); |
289 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
290 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
289 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
290 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
291 | 291 | if ($globalBritishAirwaysKey == '') return array(); |
292 | 292 | $url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json"; |
293 | 293 | $headers = array('Client-Key: '.$globalBritishAirwaysKey); |
294 | - $json = $Common->getData($url,'get','',$headers); |
|
294 | + $json = $Common->getData($url, 'get', '', $headers); |
|
295 | 295 | if ($json == '') return array(); |
296 | 296 | $parsed_json = json_decode($json); |
297 | 297 | $flights = $parsed_json->{'FlightsResponse'}; |
298 | 298 | if (count($flights) > 0) { |
299 | 299 | $DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'}; |
300 | 300 | $ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'}; |
301 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
302 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
303 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways'); |
|
301 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
302 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
303 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_britishairways'); |
|
304 | 304 | } else return array(); |
305 | 305 | } |
306 | 306 | |
@@ -314,27 +314,27 @@ discard block |
||
314 | 314 | global $globalLufthansaKey; |
315 | 315 | $Common = new Common(); |
316 | 316 | $check_date = new Datetime($date); |
317 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
318 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
317 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
318 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
319 | 319 | if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array(); |
320 | 320 | $url = "https://api.lufthansa.com/v1/oauth/token"; |
321 | - $post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials'); |
|
322 | - $data = $Common->getData($url,'post',$post); |
|
321 | + $post = array('client_id' => $globalLufthansaKey['key'], 'client_secret' => $globalLufthansaKey['secret'], 'grant_type' => 'client_credentials'); |
|
322 | + $data = $Common->getData($url, 'post', $post); |
|
323 | 323 | $parsed_data = json_decode($data); |
324 | 324 | if (!isset($parsed_data->{'access_token'})) return array(); |
325 | 325 | $token = $parsed_data->{'access_token'}; |
326 | 326 | |
327 | 327 | $url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d'); |
328 | - $headers = array('Authorization: Bearer '.$token,'Accept: application/json'); |
|
329 | - $json = $Common->getData($url,'get','',$headers); |
|
328 | + $headers = array('Authorization: Bearer '.$token, 'Accept: application/json'); |
|
329 | + $json = $Common->getData($url, 'get', '', $headers); |
|
330 | 330 | if ($json == '') return array(); |
331 | 331 | $parsed_json = json_decode($json); |
332 | 332 | if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) { |
333 | 333 | $DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'}; |
334 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
334 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
335 | 335 | $ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'}; |
336 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
337 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa'); |
|
336 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
337 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_lufthansa'); |
|
338 | 338 | } else return array(); |
339 | 339 | } |
340 | 340 | |
@@ -348,23 +348,23 @@ discard block |
||
348 | 348 | global $globalTransaviaKey; |
349 | 349 | $Common = new Common(); |
350 | 350 | $check_date = new Datetime($date); |
351 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
352 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
351 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
352 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
353 | 353 | if ($globalTransaviaKey == '') return array(); |
354 | 354 | $url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
355 | 355 | //$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
356 | 356 | $headers = array('apikey: '.$globalTransaviaKey); |
357 | - $json = $Common->getData($url,'get','',$headers); |
|
357 | + $json = $Common->getData($url, 'get', '', $headers); |
|
358 | 358 | //echo 'result : '.$json; |
359 | 359 | if ($json == '') return array(); |
360 | 360 | $parsed_json = json_decode($json); |
361 | 361 | |
362 | 362 | if (isset($parsed_json->{'data'}[0])) { |
363 | 363 | $DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'}; |
364 | - $departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
364 | + $departureTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
365 | 365 | $ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'}; |
366 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
367 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia'); |
|
366 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
367 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_transavia'); |
|
368 | 368 | } else return array(); |
369 | 369 | } |
370 | 370 | |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function getTunisair($callsign) { |
377 | 377 | $Common = new Common(); |
378 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
379 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
378 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
379 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
380 | 380 | $url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp"; |
381 | 381 | $data = $Common->getData($url); |
382 | 382 | $table = $Common->table2array($data); |
383 | 383 | foreach ($table as $flight) { |
384 | - if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) { |
|
385 | - return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair'); |
|
384 | + if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d', $numvol)) { |
|
385 | + return array('DepartureAirportIATA' => $flight[2], 'DepartureTime' => str_replace('.', ':', $flight[5]), 'ArrivalAirportIATA' => $flight[3], 'ArrivalTime' => str_replace('.', ':', $flight[6]), 'Source' => 'website_tunisair'); |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | return array(); |
@@ -393,21 +393,21 @@ discard block |
||
393 | 393 | * @param String $callsign The callsign |
394 | 394 | * @return Flight departure and arrival airports and time |
395 | 395 | */ |
396 | - public function getVueling($callsign,$date = 'NOW') { |
|
396 | + public function getVueling($callsign, $date = 'NOW') { |
|
397 | 397 | $Common = new Common(); |
398 | 398 | $check_date = new Datetime($date); |
399 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
400 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
401 | - $final_date = str_replace('/','%2F',$check_date->format('d/m/Y')); |
|
399 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
400 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
401 | + $final_date = str_replace('/', '%2F', $check_date->format('d/m/Y')); |
|
402 | 402 | $url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB"; |
403 | 403 | $data = $Common->getData($url); |
404 | - $data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data)); |
|
404 | + $data = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $data)); |
|
405 | 405 | if ($data != '') { |
406 | - preg_match('/flightOri=[A-Z]{3}/',$data,$result); |
|
407 | - $DepartureAirportIata = str_replace('flightOri=','',$result[0]); |
|
408 | - preg_match('/flightDest=[A-Z]{3}/',$data,$result); |
|
409 | - $ArrivalAirportIata = str_replace('flightDest=','',$result[0]); |
|
410 | - if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling'); |
|
406 | + preg_match('/flightOri=[A-Z]{3}/', $data, $result); |
|
407 | + $DepartureAirportIata = str_replace('flightOri=', '', $result[0]); |
|
408 | + preg_match('/flightDest=[A-Z]{3}/', $data, $result); |
|
409 | + $ArrivalAirportIata = str_replace('flightDest=', '', $result[0]); |
|
410 | + if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'Source' => 'website_vueling'); |
|
411 | 411 | else return array(); |
412 | 412 | } |
413 | 413 | return array(); |
@@ -421,27 +421,27 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function getIberia($callsign, $date = 'NOW') { |
423 | 423 | $Common = new Common(); |
424 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
424 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
425 | 425 | $check_date = new Datetime($date); |
426 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
426 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
427 | 427 | $url = "https://www.iberia.com/web/flightDetail.do"; |
428 | - $post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB'); |
|
429 | - $data = $Common->getData($url,'post',$post); |
|
428 | + $post = array('numvuelo' => $numvol, 'fecha' => $check_date->format('Ymd'), 'airlineID' => 'IB'); |
|
429 | + $data = $Common->getData($url, 'post', $post); |
|
430 | 430 | if ($data != '') { |
431 | 431 | $table = $Common->table2array($data); |
432 | 432 | //print_r($table); |
433 | 433 | if (count($table) > 0) { |
434 | 434 | $flight = $table; |
435 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
436 | - preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch); |
|
435 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
436 | + preg_match('/([A-Z]{3})/', $flight[5][0], $ArrivalAirportIataMatch); |
|
437 | 437 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
438 | 438 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
439 | - $departureTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[3][2]))),0,5); |
|
440 | - $arrivalTime = trim(str_replace(' lunes','',str_replace(' ','',$flight[5][1]))); |
|
439 | + $departureTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[3][2]))), 0, 5); |
|
440 | + $arrivalTime = trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][1]))); |
|
441 | 441 | if ($arrivalTime == 'Hora estimada de llegada') { |
442 | - $arrivalTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[5][2]))),0,5); |
|
443 | - } else $arrivalTime = substr($arrivalTime,0,5); |
|
444 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia'); |
|
442 | + $arrivalTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][2]))), 0, 5); |
|
443 | + } else $arrivalTime = substr($arrivalTime, 0, 5); |
|
444 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_iberia'); |
|
445 | 445 | } |
446 | 446 | } |
447 | 447 | return array(); |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | * @return Flight departure and arrival airports and time |
455 | 455 | */ |
456 | 456 | |
457 | - private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') { |
|
457 | + private function getStarAlliance($callsign, $date = 'NOW', $carrier = '') { |
|
458 | 458 | $Common = new Common(); |
459 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
459 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
460 | 460 | $check_date = new Datetime($date); |
461 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
461 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
462 | 462 | $url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y'); |
463 | 463 | $data = $Common->getData($url); |
464 | 464 | if ($data != '') { |
@@ -467,13 +467,13 @@ discard block |
||
467 | 467 | $flight = $table; |
468 | 468 | //print_r($table); |
469 | 469 | if (isset($flight[25]) && isset($flight[29])) { |
470 | - preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch); |
|
471 | - preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch); |
|
470 | + preg_match('/([A-Z]{3})/', $flight[25][1], $DepartureAirportIataMatch); |
|
471 | + preg_match('/([A-Z]{3})/', $flight[25][3], $ArrivalAirportIataMatch); |
|
472 | 472 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
473 | 473 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
474 | - $departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5); |
|
475 | - $arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5); |
|
476 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance'); |
|
474 | + $departureTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][0])), 0, 5); |
|
475 | + $arrivalTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][1])), 0, 5); |
|
476 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_staralliance'); |
|
477 | 477 | } else return array(); |
478 | 478 | } |
479 | 479 | |
@@ -491,10 +491,10 @@ discard block |
||
491 | 491 | */ |
492 | 492 | private function getAlitalia($callsign, $date = 'NOW') { |
493 | 493 | $Common = new Common(); |
494 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
494 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
495 | 495 | $check_date = new Datetime($date); |
496 | - $url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
497 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
496 | + $url = "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
497 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
498 | 498 | $data = $Common->getData($url); |
499 | 499 | if ($data != '') { |
500 | 500 | $table = $Common->text2array($data); |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $ArrivalAirportIata = ''; |
503 | 503 | $departureTime = $table[4]; |
504 | 504 | $arrivalTime = $table[5]; |
505 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia'); |
|
505 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_alitalia'); |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -514,21 +514,21 @@ discard block |
||
514 | 514 | */ |
515 | 515 | private function getBrussels($callsign, $date = 'NOW') { |
516 | 516 | $Common = new Common(); |
517 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
517 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
518 | 518 | $check_date = new Datetime($date); |
519 | - $url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302"; |
|
519 | + $url = "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302"; |
|
520 | 520 | //http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber"; |
521 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
521 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
522 | 522 | $data = $Common->getData($url); |
523 | 523 | if ($data != '') { |
524 | 524 | //echo $data; |
525 | - $parsed_json = json_decode($data,true); |
|
525 | + $parsed_json = json_decode($data, true); |
|
526 | 526 | if (isset($parsed_json[0]['FromAirportCode'])) { |
527 | 527 | $DepartureAirportIata = $parsed_json[0]['FromAirportCode']; |
528 | 528 | $ArrivalAirportIata = $parsed_json[0]['ToAirportCode']; |
529 | - $departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
530 | - $arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
531 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels'); |
|
529 | + $departureTime = date('H:i', strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
530 | + $arrivalTime = date('H:i', strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
531 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_brussels'); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | } |
@@ -605,21 +605,21 @@ discard block |
||
605 | 605 | */ |
606 | 606 | private function getFlyTap($callsign) { |
607 | 607 | $Common = new Common(); |
608 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
609 | - $url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
608 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
609 | + $url = "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
610 | 610 | //$check_date = new Datetime($date); |
611 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
612 | - $post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1'); |
|
613 | - $data = $Common->getData($url,'post',$post); |
|
611 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
612 | + $post = array('arrivalsdepartures_content' => 'number', 'arrivalsdepartures_tp' => $numvol, 'arrivalsdepartures_trk' => 'ARR', 'arrivalsdepartures_date_trk' => '1', 'aptCode' => '', 'arrivalsdepartures' => 'DEP', 'arrivalsdepartures_date' => '1', 'aptCodeFrom' => '', 'aptCodeTo' => '', 'arrivalsdepartures2' => 'DEP', 'arrivalsdepartures_date2' => '1'); |
|
613 | + $data = $Common->getData($url, 'post', $post); |
|
614 | 614 | if ($data != '') { |
615 | 615 | $table = $Common->table2array($data); |
616 | - $departureTime = trim(substr($table[15][0],0,5)); |
|
617 | - $arrivalTime = trim(substr($table[35][0],0,5)); |
|
618 | - preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch); |
|
619 | - preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch); |
|
616 | + $departureTime = trim(substr($table[15][0], 0, 5)); |
|
617 | + $arrivalTime = trim(substr($table[35][0], 0, 5)); |
|
618 | + preg_match('/([A-Z]{3})/', $table[11][0], $DepartureAirportIataMatch); |
|
619 | + preg_match('/([A-Z]{3})/', $table[31][0], $ArrivalAirportIataMatch); |
|
620 | 620 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
621 | 621 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
622 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap'); |
|
622 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flytap'); |
|
623 | 623 | } |
624 | 624 | return array(); |
625 | 625 | } |
@@ -641,10 +641,10 @@ discard block |
||
641 | 641 | } |
642 | 642 | } |
643 | 643 | if ($airline_icao == '') return array(); |
644 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
645 | - $url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
644 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
645 | + $url = "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
646 | 646 | //$check_date = new Datetime($date); |
647 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
647 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
648 | 648 | $data = $Common->getData($url); |
649 | 649 | if ($data != '') { |
650 | 650 | $table = $Common->table2array($data); |
@@ -654,13 +654,13 @@ discard block |
||
654 | 654 | $darr = ''; |
655 | 655 | $ahour = ''; |
656 | 656 | $aarr = ''; |
657 | - $n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr); |
|
657 | + $n = sscanf($sched, '%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])', $dhour, $darr, $ahour, $aarr); |
|
658 | 658 | if ($n == 7) { |
659 | 659 | $departureTime = $dhour; |
660 | 660 | $arrivalTime = $ahour; |
661 | - $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
662 | - $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
663 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
661 | + $DepartureAirportIata = str_replace(array('(', ')'), '', $darr); |
|
662 | + $ArrivalAirportIata = str_replace(array('(', ')'), '', $aarr); |
|
663 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightmapper'); |
|
664 | 664 | } |
665 | 665 | } |
666 | 666 | } |
@@ -684,20 +684,20 @@ discard block |
||
684 | 684 | } |
685 | 685 | } |
686 | 686 | */ |
687 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
688 | - $url= "http://fr.flightaware.com/live/flight/".$callsign; |
|
687 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
688 | + $url = "http://fr.flightaware.com/live/flight/".$callsign; |
|
689 | 689 | //$check_date = new Datetime($date); |
690 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
690 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
691 | 691 | $data = $Common->getData($url); |
692 | 692 | if ($data != '') { |
693 | 693 | $table = $Common->table2array($data); |
694 | 694 | if (isset($table[11][0])) { |
695 | - $departureTime = str_replace('h',':',substr($table[5][0],0,5)); |
|
696 | - $arrivalTime = str_replace('h',':',substr($table[5][1],0,5)); |
|
695 | + $departureTime = str_replace('h', ':', substr($table[5][0], 0, 5)); |
|
696 | + $arrivalTime = str_replace('h', ':', substr($table[5][1], 0, 5)); |
|
697 | 697 | echo $table[3][0]; |
698 | - sscanf($table[3][0],'%*[^(] (%3[A-Z] / %*4[A-Z])',$DepartureAirportIata); |
|
699 | - sscanf($table[3][1],'%*[^(] (%3[A-Z] / %*4[A-Z])',$ArrivalAirportIata); |
|
700 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightaware'); |
|
698 | + sscanf($table[3][0], '%*[^(] (%3[A-Z] / %*4[A-Z])', $DepartureAirportIata); |
|
699 | + sscanf($table[3][1], '%*[^(] (%3[A-Z] / %*4[A-Z])', $ArrivalAirportIata); |
|
700 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightaware'); |
|
701 | 701 | } |
702 | 702 | } |
703 | 703 | return array(); |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | */ |
711 | 711 | public function getCostToTravel($callsign) { |
712 | 712 | $Common = new Common(); |
713 | - $url= "http://www.costtotravel.com/flight-number/".$callsign; |
|
713 | + $url = "http://www.costtotravel.com/flight-number/".$callsign; |
|
714 | 714 | //$check_date = new Datetime($date); |
715 | 715 | //if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
716 | 716 | $data = $Common->getData($url); |
@@ -718,11 +718,11 @@ discard block |
||
718 | 718 | $table = $Common->table2array($data); |
719 | 719 | //print_r($table); |
720 | 720 | if (isset($table[11][1])) { |
721 | - $departureTime = substr($table[11][1],0,5); |
|
722 | - $arrivalTime = substr($table[17][1],0,5); |
|
723 | - $DepartureAirportIata = substr($table[13][1],0,3); |
|
724 | - $ArrivalAirportIata = substr($table[15][1],0,3); |
|
725 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel'); |
|
721 | + $departureTime = substr($table[11][1], 0, 5); |
|
722 | + $arrivalTime = substr($table[17][1], 0, 5); |
|
723 | + $DepartureAirportIata = substr($table[13][1], 0, 3); |
|
724 | + $ArrivalAirportIata = substr($table[15][1], 0, 3); |
|
725 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_costtotravel'); |
|
726 | 726 | } |
727 | 727 | } |
728 | 728 | return array(); |
@@ -734,14 +734,14 @@ discard block |
||
734 | 734 | * @param String $date date we want flight number info |
735 | 735 | * @return Flight departure and arrival airports and time |
736 | 736 | */ |
737 | - private function getAirCanada($callsign,$date = 'NOW') { |
|
737 | + private function getAirCanada($callsign, $date = 'NOW') { |
|
738 | 738 | $Common = new Common(); |
739 | 739 | if (class_exists("DomDocument") === FALSE) return array(); |
740 | 740 | date_default_timezone_set('UTC'); |
741 | 741 | $check_date = new Datetime($date); |
742 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
743 | - $url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249"; |
|
744 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
742 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
743 | + $url = "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249"; |
|
744 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
745 | 745 | $data = $Common->getData($url); |
746 | 746 | $dom = new DomDocument(); |
747 | 747 | $dom->loadXML($data); |
@@ -749,11 +749,11 @@ discard block |
||
749 | 749 | $departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0); |
750 | 750 | if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) { |
751 | 751 | $DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
752 | - $departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
752 | + $departureTime = date('H:i', strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
753 | 753 | $arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0); |
754 | 754 | $ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
755 | - $arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
756 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada'); |
|
755 | + $arrivalTime = date('H:i', strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
756 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_aircanada'); |
|
757 | 757 | } else return array(); |
758 | 758 | } |
759 | 759 | |
@@ -765,21 +765,21 @@ discard block |
||
765 | 765 | */ |
766 | 766 | private function getVietnamAirlines($callsign, $date = 'NOW') { |
767 | 767 | $Common = new Common(); |
768 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
768 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
769 | 769 | $check_date = new Datetime($date); |
770 | - $url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&"; |
|
771 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
770 | + $url = "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&"; |
|
771 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
772 | 772 | $data = $Common->getData($url); |
773 | 773 | if ($data != '') { |
774 | 774 | $table = $Common->table2array($data); |
775 | 775 | $flight = $table; |
776 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
777 | - preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch); |
|
776 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
777 | + preg_match('/([A-Z]{3})/', $flight[21][0], $ArrivalAirportIataMatch); |
|
778 | 778 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
779 | 779 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
780 | 780 | $departureTime = $flight[5][1]; |
781 | 781 | $arrivalTime = $flight[23][1]; |
782 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines'); |
|
782 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_vietnamairlines'); |
|
783 | 783 | } |
784 | 784 | } |
785 | 785 | |
@@ -790,16 +790,16 @@ discard block |
||
790 | 790 | * @param String $carrier airline code |
791 | 791 | * @return Flight departure and arrival airports and time |
792 | 792 | */ |
793 | - private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') { |
|
793 | + private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') { |
|
794 | 794 | $Common = new Common(); |
795 | 795 | date_default_timezone_set('UTC'); |
796 | 796 | //AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair |
797 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
797 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
798 | 798 | $check_date = new Datetime($date); |
799 | - $url= "http://www.airberlin.com/en-US/site/aims.php"; |
|
800 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
801 | - $post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier); |
|
802 | - $data = $Common->getData($url,'post',$post); |
|
799 | + $url = "http://www.airberlin.com/en-US/site/aims.php"; |
|
800 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
801 | + $post = array('type' => 'departure', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => $carrier); |
|
802 | + $data = $Common->getData($url, 'post', $post); |
|
803 | 803 | //echo $data; |
804 | 804 | $DepartureAirportIata = ''; |
805 | 805 | $ArrivalAirportIata = ''; |
@@ -812,8 +812,8 @@ discard block |
||
812 | 812 | if (isset($flight[5][2])) $departureAirport = $flight[5][2]; |
813 | 813 | else $departureAirport = ''; |
814 | 814 | } else return array(); |
815 | - $post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB'); |
|
816 | - $data = $Common->getData($url,'post',$post); |
|
815 | + $post = array('type' => 'arrival', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => 'AB'); |
|
816 | + $data = $Common->getData($url, 'post', $post); |
|
817 | 817 | if ($data != '') { |
818 | 818 | $table = $Common->table2array($data); |
819 | 819 | $flight = $table; |
@@ -841,13 +841,13 @@ discard block |
||
841 | 841 | } |
842 | 842 | } |
843 | 843 | if (isset($DepartureAirportIata)) { |
844 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin'); |
|
844 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airberlin'); |
|
845 | 845 | } else return array(); |
846 | 846 | } |
847 | 847 | |
848 | 848 | |
849 | 849 | |
850 | - public function fetchSchedule($ident,$date = 'NOW') { |
|
850 | + public function fetchSchedule($ident, $date = 'NOW') { |
|
851 | 851 | global $globalSchedulesSources, $globalSchedulesFetch; |
852 | 852 | //$Common = new Common(); |
853 | 853 | if (!$globalSchedulesFetch) return array(); |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | // Brussels Airlines |
918 | 918 | case "BEL": |
919 | 919 | case "SN": |
920 | - return $this->getBrussels($ident,$date); |
|
920 | + return $this->getBrussels($ident, $date); |
|
921 | 921 | /* |
922 | 922 | // Copa Airlines |
923 | 923 | case "CMP": |
@@ -1002,17 +1002,17 @@ discard block |
||
1002 | 1002 | // Air France |
1003 | 1003 | case "AF": |
1004 | 1004 | case "AFR": |
1005 | - return $this->getAirFrance($ident,$date,'AF'); |
|
1005 | + return $this->getAirFrance($ident, $date, 'AF'); |
|
1006 | 1006 | // HOP |
1007 | 1007 | case "A5": |
1008 | 1008 | case "HOP": |
1009 | - return $this->getAirFrance($ident,$date,'A5'); |
|
1009 | + return $this->getAirFrance($ident, $date, 'A5'); |
|
1010 | 1010 | // EasyJet |
1011 | 1011 | case "U2": |
1012 | 1012 | case "DS": |
1013 | 1013 | case "EZY": |
1014 | 1014 | case "EZS": |
1015 | - return $this->getEasyJet($ident,$date); |
|
1015 | + return $this->getEasyJet($ident, $date); |
|
1016 | 1016 | // Ryanair |
1017 | 1017 | case "FR": |
1018 | 1018 | case "RYR": |
@@ -1062,25 +1062,25 @@ discard block |
||
1062 | 1062 | return $this->getIberia($ident); |
1063 | 1063 | // Vietnam Airlines |
1064 | 1064 | case "HVN": |
1065 | - return $this->getVietnamAirlines($ident,$date); |
|
1065 | + return $this->getVietnamAirlines($ident, $date); |
|
1066 | 1066 | // Air Berlin |
1067 | 1067 | case "AB": |
1068 | 1068 | case "BER": |
1069 | - return $this->getAirBerlin($ident,$date,'AB'); |
|
1069 | + return $this->getAirBerlin($ident, $date, 'AB'); |
|
1070 | 1070 | // NIKI |
1071 | 1071 | case "HG": |
1072 | 1072 | case "NLY": |
1073 | - return $this->getAirBerlin($ident,$date,'HG'); |
|
1073 | + return $this->getAirBerlin($ident, $date, 'HG'); |
|
1074 | 1074 | // BelAir |
1075 | 1075 | case "4T": |
1076 | 1076 | case "BHP": |
1077 | - return $this->getAirBerlin($ident,$date,'4T'); |
|
1077 | + return $this->getAirBerlin($ident, $date, '4T'); |
|
1078 | 1078 | default: |
1079 | 1079 | // Randomly use a generic function to get hours |
1080 | 1080 | if (strlen($airline_icao) == 2) { |
1081 | - if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1081 | + if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1082 | 1082 | if (count($globalSchedulesSources) > 0) { |
1083 | - $rand = mt_rand(0,count($globalSchedulesSources)-1); |
|
1083 | + $rand = mt_rand(0, count($globalSchedulesSources) - 1); |
|
1084 | 1084 | $source = $globalSchedulesSources[$rand]; |
1085 | 1085 | if ($source == 'flightmapper') return $this->getFlightMapper($ident); |
1086 | 1086 | elseif ($source == 'costtotravel') return $this->getCostToTravel($ident); |