@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | |
12 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
13 | -$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1",""); |
|
12 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
13 | +$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", ""); |
|
14 | 14 | $airport_array = $Spotter->getAllAirportInfo($airport); |
15 | 15 | |
16 | 16 | if (!empty($airport_array)) |
17 | 17 | { |
18 | - $title = sprintf(_("Most Common Aircraft to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
18 | + $title = sprintf(_("Most Common Aircraft to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
21 | 21 | print '<form action="'.$globalURL.'/airport" method="post">'; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | 26 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
27 | 27 | ksort($airport_names); |
28 | - foreach($airport_names as $airport_name) |
|
28 | + foreach ($airport_names as $airport_name) |
|
29 | 29 | { |
30 | - if($airport == $airport_name['airport_icao']) |
|
30 | + if ($airport == $airport_name['airport_icao']) |
|
31 | 31 | { |
32 | 32 | 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>'; |
33 | 33 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | include('airport-sub-menu.php'); |
59 | 59 | print '<div class="column">'; |
60 | 60 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
61 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
61 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
62 | 62 | |
63 | 63 | $aircraft_array = $Spotter->countAllAircraftTypesByAirport($airport); |
64 | 64 | if (!empty($aircraft_array)) |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | print '</thead>'; |
74 | 74 | print '<tbody>'; |
75 | 75 | $i = 1; |
76 | - foreach($aircraft_array as $aircraft_item) |
|
76 | + foreach ($aircraft_array as $aircraft_item) |
|
77 | 77 | { |
78 | 78 | print '<tr>'; |
79 | 79 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = urldecode(filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING)); |
|
10 | +$airline = urldecode(filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING)); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | // $spotter_array = $Spotter->getSpotterDataByAirline('',"0,1","",array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
15 | 15 | $alliance = true; |
16 | 16 | } else { |
17 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
17 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | if (!empty($spotter_array) || $alliance === true) |
21 | 21 | { |
22 | 22 | if ($alliance) { |
23 | - $title = sprintf(_("Most Common Aircraft from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
23 | + $title = sprintf(_("Most Common Aircraft from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
24 | 24 | } else { |
25 | - $title = sprintf(_("Most Common Aircraft from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
25 | + $title = sprintf(_("Most Common Aircraft from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
26 | 26 | } |
27 | 27 | require_once('header.php'); |
28 | 28 | print '<div class="select-item">'; |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $alliances = $Spotter->getAllAllianceNames(); |
33 | 33 | if (!empty($alliances)) { |
34 | 34 | foreach ($alliances as $al) { |
35 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
36 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
35 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
36 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
37 | 37 | } else { |
38 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | print '<option disabled>────────────────</option>'; |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $Stats = new Stats(); |
44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
45 | 45 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
46 | - foreach($airline_names as $airline_name) |
|
46 | + foreach ($airline_names as $airline_name) |
|
47 | 47 | { |
48 | - if($airline == $airline_name['airline_icao']) |
|
48 | + if ($airline == $airline_name['airline_icao']) |
|
49 | 49 | { |
50 | 50 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
51 | 51 | } else { |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | print '</div>'; |
80 | 80 | } else { |
81 | 81 | print '<div class="info column">'; |
82 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
83 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
82 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
83 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
84 | 84 | { |
85 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
85 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
86 | 86 | } |
87 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
87 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
88 | 88 | print '</div>'; |
89 | 89 | } |
90 | 90 | } else { |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | print '<div class="column">'; |
96 | 96 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
97 | 97 | if ($alliance === false) { |
98 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
98 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
99 | 99 | } else { |
100 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
100 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /* |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $aircraft_array = $Spotter->countAllAircraftTypesByAirline($airline); |
108 | 108 | } |
109 | 109 | */ |
110 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline); |
|
110 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline); |
|
111 | 111 | if (!empty($aircraft_array)) |
112 | 112 | { |
113 | 113 | print '<div class="table-responsive">'; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | print '</thead>'; |
121 | 121 | print '<tbody>'; |
122 | 122 | $i = 1; |
123 | - foreach($aircraft_array as $aircraft_item) |
|
123 | + foreach ($aircraft_array as $aircraft_item) |
|
124 | 124 | { |
125 | 125 | print '<tr>'; |
126 | 126 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | if (!isset($filter_name)) $filter_name = ''; |
26 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
26 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
27 | 27 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
28 | 28 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
29 | 29 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
33 | 33 | if (isset($airline_info[0]['name'])) { |
34 | 34 | $airline_name = $airline_info[0]['name']; |
35 | - } elseif (strpos($airline_icao,'alliance_') !== FALSE) { |
|
35 | + } elseif (strpos($airline_icao, 'alliance_') !== FALSE) { |
|
36 | 36 | $alliance_name = $airline_icao; |
37 | 37 | } |
38 | 38 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $title = _("Statistics"); |
43 | 43 | } |
44 | 44 | |
45 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
45 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | |
48 | 48 | require_once('header.php'); |
49 | 49 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | date_default_timezone_set('UTC'); |
75 | 75 | $lastupdate = strtotime($last_update[0]['value']); |
76 | 76 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
77 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
77 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | ?> |
@@ -86,31 +86,31 @@ discard block |
||
86 | 86 | <?php |
87 | 87 | if ($type == 'aircraft') { |
88 | 88 | ?> |
89 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
90 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
91 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
92 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
89 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
90 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
91 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
92 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
93 | 93 | <?php |
94 | 94 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
95 | 95 | ?> |
96 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
97 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
96 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
97 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
98 | 98 | <?php |
99 | 99 | } |
100 | 100 | if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
101 | 101 | ?> |
102 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
103 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
102 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
103 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
104 | 104 | <?php |
105 | 105 | } |
106 | 106 | ?> |
107 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircraft types"); ?></span> |
|
108 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
107 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircraft types"); ?></span> |
|
108 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
109 | 109 | <?php |
110 | 110 | if ($airline_icao == '') { |
111 | 111 | ?> |
112 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
113 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
112 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
113 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
114 | 114 | <?php |
115 | 115 | } |
116 | 116 | ?> |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) { |
119 | 119 | if ($airline_icao == '' || $airline_icao == 'all') { |
120 | 120 | ?> |
121 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
122 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
121 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
122 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
123 | 123 | <?php |
124 | 124 | } |
125 | 125 | } |
@@ -127,22 +127,22 @@ discard block |
||
127 | 127 | <?php |
128 | 128 | } elseif ($type == 'marine') { |
129 | 129 | ?> |
130 | - <span><span class="badge"><?php print number_format($Stats->countOverallMarine($filter_name,$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
131 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
132 | - <span><span class="badge"><?php print number_format($Stats->countOverallMarineTypes($filter_name,$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
133 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
130 | + <span><span class="badge"><?php print number_format($Stats->countOverallMarine($filter_name, $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
131 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
132 | + <span><span class="badge"><?php print number_format($Stats->countOverallMarineTypes($filter_name, $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
133 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
134 | 134 | <?php |
135 | 135 | } elseif ($type == 'tracker') { |
136 | 136 | ?> |
137 | - <span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
138 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
139 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
140 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
137 | + <span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name, $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
138 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
139 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
140 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
141 | 141 | <?php |
142 | 142 | } |
143 | 143 | ?> |
144 | 144 | </p> |
145 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
145 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
146 | 146 | <div class="specific-stats"> |
147 | 147 | <?php |
148 | 148 | if ($type == 'aircraft') { |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | <div class="col-md-6"> |
152 | 152 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
153 | 153 | <?php |
154 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
154 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
155 | 155 | if (count($aircraft_array) == 0) { |
156 | 156 | print _("No data available"); |
157 | 157 | } else { |
158 | 158 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
159 | 159 | $aircraft_data = ''; |
160 | - foreach($aircraft_array as $aircraft_item) { |
|
160 | + foreach ($aircraft_array as $aircraft_item) { |
|
161 | 161 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
162 | 162 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
163 | 163 | } |
@@ -186,16 +186,16 @@ discard block |
||
186 | 186 | ?> |
187 | 187 | </div> |
188 | 188 | </div> |
189 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
189 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
190 | 190 | <?php |
191 | 191 | if ($airline_icao == '' || $airline_icao == 'all') { |
192 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
192 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
193 | 193 | if (count($airline_array) > 0) { |
194 | 194 | print '<div class="col-md-6">'; |
195 | 195 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
196 | 196 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
197 | 197 | $airline_data = ''; |
198 | - foreach($airline_array as $airline_item) { |
|
198 | + foreach ($airline_array as $airline_item) { |
|
199 | 199 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
200 | 200 | } |
201 | 201 | $airline_data = substr($airline_data, 0, -1); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | ?> |
222 | 222 | </div> |
223 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
223 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
224 | 224 | <?php |
225 | 225 | } |
226 | 226 | } |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | <div class="col-md-6"> |
233 | 233 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
234 | 234 | <?php |
235 | - $marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month); |
|
235 | + $marine_array = $Stats->countAllMarineTypes(true, $filter_name, $year, $month); |
|
236 | 236 | if (count($marine_array) == 0) print _("No data available"); |
237 | 237 | else { |
238 | 238 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
239 | 239 | $marine_data = ''; |
240 | - foreach($marine_array as $marine_item) { |
|
240 | + foreach ($marine_array as $marine_item) { |
|
241 | 241 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
242 | 242 | } |
243 | 243 | $marine_data = substr($marine_data, 0, -1); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | ?> |
267 | 267 | </div> |
268 | 268 | </div> |
269 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
269 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
270 | 270 | <!-- </div>--> |
271 | 271 | <?php |
272 | 272 | } |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | <div class="col-md-6"> |
277 | 277 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
278 | 278 | <?php |
279 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
279 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
280 | 280 | if (count($tracker_array) == 0) print _("No data available"); |
281 | 281 | else { |
282 | 282 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
283 | 283 | $tracker_data = ''; |
284 | - foreach($tracker_array as $tracker_item) { |
|
284 | + foreach ($tracker_array as $tracker_item) { |
|
285 | 285 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
286 | 286 | } |
287 | 287 | $tracker_data = substr($tracker_data, 0, -1); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | ?> |
312 | 312 | </div> |
313 | 313 | </div> |
314 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
314 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
315 | 315 | <!-- </div>--> |
316 | 316 | <?php |
317 | 317 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | else { |
327 | 327 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
328 | 328 | $owner_data = ''; |
329 | - foreach($owner_array as $owner_item) { |
|
329 | + foreach ($owner_array as $owner_item) { |
|
330 | 330 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
331 | 331 | } |
332 | 332 | $owner_data = substr($owner_data, 0, -1); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | </div> |
347 | 347 | --> |
348 | 348 | </div> |
349 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
349 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
350 | 350 | <div class="col-md-6"> |
351 | 351 | <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2> |
352 | 352 | <?php |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | else { |
356 | 356 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
357 | 357 | $owner_data = ''; |
358 | - foreach($countries_array as $owner_item) { |
|
358 | + foreach ($countries_array as $owner_item) { |
|
359 | 359 | $owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],'; |
360 | 360 | } |
361 | 361 | $owner_data = substr($owner_data, 0, -1); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | --> |
377 | 377 | </div> |
378 | 378 | |
379 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
379 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
380 | 380 | ² </div> |
381 | 381 | <div class="row column"> |
382 | 382 | <div class="col-md-6"> |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | else { |
388 | 388 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
389 | 389 | $launch_site_data = ''; |
390 | - foreach($launch_site_array as $launch_site_item) { |
|
390 | + foreach ($launch_site_array as $launch_site_item) { |
|
391 | 391 | $launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],'; |
392 | 392 | } |
393 | 393 | $launch_site_data = substr($launch_site_data, 0, -1); |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | ?> |
415 | 415 | <div class="row column"> |
416 | 416 | <?php |
417 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
417 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
418 | 418 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
419 | 419 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
420 | 420 | if (empty($flightover_array)) { |
@@ -425,12 +425,12 @@ discard block |
||
425 | 425 | ?> |
426 | 426 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
427 | 427 | <?php |
428 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
428 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
429 | 429 | if (count($pilot_array) == 0) print _("No data available"); |
430 | 430 | else { |
431 | 431 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
432 | 432 | $pilot_data = ''; |
433 | - foreach($pilot_array as $pilot_item) { |
|
433 | + foreach ($pilot_array as $pilot_item) { |
|
434 | 434 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
435 | 435 | } |
436 | 436 | $pilot_data = substr($pilot_data, 0, -1); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | ?> |
452 | 452 | </div> |
453 | 453 | |
454 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
454 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
455 | 455 | <?php |
456 | 456 | } |
457 | 457 | // else { |
@@ -460,12 +460,12 @@ discard block |
||
460 | 460 | <div class="col-md-6"> |
461 | 461 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
462 | 462 | <?php |
463 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
463 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
464 | 464 | if (count($owner_array) == 0) print _("No data available"); |
465 | 465 | else { |
466 | 466 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
467 | 467 | $owner_data = ''; |
468 | - foreach($owner_array as $owner_item) { |
|
468 | + foreach ($owner_array as $owner_item) { |
|
469 | 469 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
470 | 470 | } |
471 | 471 | $owner_data = substr($owner_data, 0, -1); |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | </div> |
485 | 485 | </div> |
486 | 486 | |
487 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
487 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
488 | 488 | <?php |
489 | 489 | } |
490 | 490 | if (!empty($flightover_array)) { |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
499 | 499 | print 'var series = ['; |
500 | 500 | $flightover_data = ''; |
501 | - foreach($flightover_array as $flightover_item) { |
|
501 | + foreach ($flightover_array as $flightover_item) { |
|
502 | 502 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
503 | 503 | } |
504 | 504 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -543,12 +543,12 @@ discard block |
||
543 | 543 | } |
544 | 544 | ?> |
545 | 545 | </div> |
546 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
546 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
547 | 547 | </div> |
548 | 548 | <?php |
549 | 549 | } |
550 | 550 | if ($type == 'marine') { |
551 | - $flightover_array = $Stats->countAllMarineOverCountries(true,$filter_name,$year,$month); |
|
551 | + $flightover_array = $Stats->countAllMarineOverCountries(true, $filter_name, $year, $month); |
|
552 | 552 | ?> |
553 | 553 | <!-- <div class="row column">--> |
554 | 554 | <div class="col-md-6"> |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
560 | 560 | print 'var series = ['; |
561 | 561 | $flightover_data = ''; |
562 | - foreach($flightover_array as $flightover_item) { |
|
562 | + foreach ($flightover_array as $flightover_item) { |
|
563 | 563 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
564 | 564 | } |
565 | 565 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | <div class="more"> |
600 | 600 | <a href="<?php print $globalURL; ?>/marine/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
601 | 601 | </div> |
602 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
602 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
603 | 603 | </div> |
604 | 604 | </div> |
605 | 605 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
618 | 618 | print 'var series = ['; |
619 | 619 | $flightover_data = ''; |
620 | - foreach($flightover_array as $flightover_item) { |
|
620 | + foreach ($flightover_array as $flightover_item) { |
|
621 | 621 | $flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],'; |
622 | 622 | } |
623 | 623 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -667,14 +667,14 @@ discard block |
||
667 | 667 | <div class="row column"> |
668 | 668 | <div class="col-md-6"> |
669 | 669 | <?php |
670 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
670 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
671 | 671 | if (count($airport_airport_array) > 0) { |
672 | 672 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
673 | 673 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
674 | 674 | print "\n"; |
675 | 675 | print 'var series = ['; |
676 | 676 | $airport_data = ''; |
677 | - foreach($airport_airport_array as $airport_item) { |
|
677 | + foreach ($airport_airport_array as $airport_item) { |
|
678 | 678 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
679 | 679 | } |
680 | 680 | $airport_data = substr($airport_data, 0, -1); |
@@ -724,18 +724,18 @@ discard block |
||
724 | 724 | } |
725 | 725 | ?> |
726 | 726 | </div> |
727 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
727 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
728 | 728 | |
729 | 729 | <div class="col-md-6"> |
730 | 730 | <?php |
731 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
731 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
732 | 732 | if (count($airport_airport_array2) > 0) { |
733 | 733 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
734 | 734 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
735 | 735 | print "\n"; |
736 | 736 | print 'var series = ['; |
737 | 737 | $airport_data = ''; |
738 | - foreach($airport_airport_array2 as $airport_item) |
|
738 | + foreach ($airport_airport_array2 as $airport_item) |
|
739 | 739 | { |
740 | 740 | if (isset($airport_item['airport_arrival_longitude']) && isset($airport_item['airport_arrival_latitude'])) { |
741 | 741 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | ?> |
790 | 790 | </div> |
791 | 791 | </div> |
792 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
792 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
793 | 793 | <?php |
794 | 794 | } |
795 | 795 | if ($type == 'aircraft') { |
@@ -801,18 +801,18 @@ discard block |
||
801 | 801 | <div class="col-md-6"> |
802 | 802 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
803 | 803 | <?php |
804 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
804 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
805 | 805 | if (count($year_array) == 0) print _("No data available"); |
806 | 806 | else { |
807 | 807 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
808 | 808 | $year_data = ''; |
809 | 809 | $year_cnt = ''; |
810 | - foreach($year_array as $year_item) { |
|
810 | + foreach ($year_array as $year_item) { |
|
811 | 811 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
812 | 812 | $year_cnt .= $year_item['date_count'].','; |
813 | 813 | } |
814 | 814 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
815 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
815 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
816 | 816 | print 'c3.generate({ |
817 | 817 | bindto: "#chart8", |
818 | 818 | data: { x: "x", |
@@ -825,22 +825,22 @@ discard block |
||
825 | 825 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
826 | 826 | </div> |
827 | 827 | </div> |
828 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
828 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
829 | 829 | <div class="col-md-6"> |
830 | 830 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
831 | 831 | <?php |
832 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
832 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
833 | 833 | if (count($month_array) == 0) print _("No data available"); |
834 | 834 | else { |
835 | 835 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
836 | 836 | $month_data = ''; |
837 | 837 | $month_cnt = ''; |
838 | - foreach($month_array as $month_item) { |
|
838 | + foreach ($month_array as $month_item) { |
|
839 | 839 | $month_data .= '"'.$month_item['date_name'].'",'; |
840 | 840 | $month_cnt .= $month_item['date_count'].','; |
841 | 841 | } |
842 | 842 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
843 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
843 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
844 | 844 | print 'c3.generate({ |
845 | 845 | bindto: "#chart9", |
846 | 846 | data: { x: "x", |
@@ -853,23 +853,23 @@ discard block |
||
853 | 853 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
854 | 854 | </div> |
855 | 855 | </div> |
856 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
856 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
857 | 857 | |
858 | 858 | <div class="col-md-6"> |
859 | 859 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
860 | 860 | <?php |
861 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
861 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
862 | 862 | if (empty($date_array)) print _("No data available"); |
863 | 863 | else { |
864 | 864 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
865 | 865 | $date_data = ''; |
866 | 866 | $date_cnt = ''; |
867 | - foreach($date_array as $date_item) { |
|
867 | + foreach ($date_array as $date_item) { |
|
868 | 868 | $date_data .= '"'.$date_item['date_name'].'",'; |
869 | 869 | $date_cnt .= $date_item['date_count'].','; |
870 | 870 | } |
871 | 871 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
872 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
872 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
873 | 873 | print 'c3.generate({ |
874 | 874 | bindto: "#chart5", |
875 | 875 | data: { x: "x", |
@@ -882,22 +882,22 @@ discard block |
||
882 | 882 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
883 | 883 | </div> |
884 | 884 | </div> |
885 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
885 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
886 | 886 | <div class="col-md-6"> |
887 | 887 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
888 | 888 | <?php |
889 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
889 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
890 | 890 | if (empty($hour_array)) print _("No data available"); |
891 | 891 | else { |
892 | 892 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
893 | 893 | $hour_data = ''; |
894 | 894 | $hour_cnt = ''; |
895 | - foreach($hour_array as $hour_item) { |
|
895 | + foreach ($hour_array as $hour_item) { |
|
896 | 896 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
897 | 897 | $hour_cnt .= $hour_item['hour_count'].','; |
898 | 898 | } |
899 | 899 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
900 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
900 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
901 | 901 | print 'c3.generate({ |
902 | 902 | bindto: "#chart6", |
903 | 903 | data: { |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
911 | 911 | </div> |
912 | 912 | </div> |
913 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
913 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
914 | 914 | </div> |
915 | 915 | <?php |
916 | 916 | } |
@@ -926,18 +926,18 @@ discard block |
||
926 | 926 | <div class="col-md-6"> |
927 | 927 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
928 | 928 | <?php |
929 | - $year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name); |
|
929 | + $year_array = $Stats->countAllMarineMonthsLastYear(true, $filter_name); |
|
930 | 930 | if (count($year_array) == 0) print _("No data available"); |
931 | 931 | else { |
932 | 932 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
933 | 933 | $year_data = ''; |
934 | 934 | $year_cnt = ''; |
935 | - foreach($year_array as $year_item) { |
|
935 | + foreach ($year_array as $year_item) { |
|
936 | 936 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
937 | 937 | $year_cnt .= $year_item['date_count'].','; |
938 | 938 | } |
939 | 939 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
940 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
940 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
941 | 941 | print 'c3.generate({ |
942 | 942 | bindto: "#chart8", |
943 | 943 | data: { x: "x", |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | </div> |
952 | 952 | </div> |
953 | 953 | |
954 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
954 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
955 | 955 | <div class="col-md-6"> |
956 | 956 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
957 | 957 | <?php |
@@ -961,12 +961,12 @@ discard block |
||
961 | 961 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
962 | 962 | $month_data = ''; |
963 | 963 | $month_cnt = ''; |
964 | - foreach($month_array as $month_item) { |
|
964 | + foreach ($month_array as $month_item) { |
|
965 | 965 | $month_data .= '"'.$month_item['date_name'].'",'; |
966 | 966 | $month_cnt .= $month_item['date_count'].','; |
967 | 967 | } |
968 | 968 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
969 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
969 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
970 | 970 | print 'c3.generate({ |
971 | 971 | bindto: "#chart9", |
972 | 972 | data: { x: "x", |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
980 | 980 | </div> |
981 | 981 | </div> |
982 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
982 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
983 | 983 | |
984 | 984 | <div class="col-md-6"> |
985 | 985 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -990,12 +990,12 @@ discard block |
||
990 | 990 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
991 | 991 | $date_data = ''; |
992 | 992 | $date_cnt = ''; |
993 | - foreach($date_array as $date_item) { |
|
993 | + foreach ($date_array as $date_item) { |
|
994 | 994 | $date_data .= '"'.$date_item['date_name'].'",'; |
995 | 995 | $date_cnt .= $date_item['date_count'].','; |
996 | 996 | } |
997 | 997 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
998 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
998 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
999 | 999 | print 'c3.generate({ |
1000 | 1000 | bindto: "#chart5", |
1001 | 1001 | data: { x: "x", |
@@ -1008,22 +1008,22 @@ discard block |
||
1008 | 1008 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1009 | 1009 | </div> |
1010 | 1010 | </div> |
1011 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1011 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1012 | 1012 | <div class="col-md-6"> |
1013 | 1013 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1014 | 1014 | <?php |
1015 | - $hour_array = $Stats->countAllMarineHours('hour',true,$filter_name); |
|
1015 | + $hour_array = $Stats->countAllMarineHours('hour', true, $filter_name); |
|
1016 | 1016 | if (empty($hour_array)) print _("No data available"); |
1017 | 1017 | else { |
1018 | 1018 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1019 | 1019 | $hour_data = ''; |
1020 | 1020 | $hour_cnt = ''; |
1021 | - foreach($hour_array as $hour_item) { |
|
1021 | + foreach ($hour_array as $hour_item) { |
|
1022 | 1022 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1023 | 1023 | $hour_cnt .= $hour_item['hour_count'].','; |
1024 | 1024 | } |
1025 | 1025 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1026 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
1026 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
1027 | 1027 | print 'c3.generate({ |
1028 | 1028 | bindto: "#chart6", |
1029 | 1029 | data: { |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1037 | 1037 | </div> |
1038 | 1038 | </div> |
1039 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1039 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1040 | 1040 | </div> |
1041 | 1041 | <?php |
1042 | 1042 | } |
@@ -1058,12 +1058,12 @@ discard block |
||
1058 | 1058 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
1059 | 1059 | $year_data = ''; |
1060 | 1060 | $year_cnt = ''; |
1061 | - foreach($year_array as $year_item) { |
|
1061 | + foreach ($year_array as $year_item) { |
|
1062 | 1062 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
1063 | 1063 | $year_cnt .= $year_item['date_count'].','; |
1064 | 1064 | } |
1065 | 1065 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1066 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
1066 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
1067 | 1067 | print 'c3.generate({ |
1068 | 1068 | bindto: "#chart8", |
1069 | 1069 | data: { x: "x", |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | </div> |
1078 | 1078 | </div> |
1079 | 1079 | |
1080 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1080 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1081 | 1081 | <div class="col-md-6"> |
1082 | 1082 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1083 | 1083 | <?php |
@@ -1087,12 +1087,12 @@ discard block |
||
1087 | 1087 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1088 | 1088 | $month_data = ''; |
1089 | 1089 | $month_cnt = ''; |
1090 | - foreach($month_array as $month_item) { |
|
1090 | + foreach ($month_array as $month_item) { |
|
1091 | 1091 | $month_data .= '"'.$month_item['date_name'].'",'; |
1092 | 1092 | $month_cnt .= $month_item['date_count'].','; |
1093 | 1093 | } |
1094 | 1094 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
1095 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
1095 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
1096 | 1096 | print 'c3.generate({ |
1097 | 1097 | bindto: "#chart9", |
1098 | 1098 | data: { x: "x", |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1106 | 1106 | </div> |
1107 | 1107 | </div> |
1108 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1108 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1109 | 1109 | |
1110 | 1110 | <div class="col-md-6"> |
1111 | 1111 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1116,12 +1116,12 @@ discard block |
||
1116 | 1116 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1117 | 1117 | $date_data = ''; |
1118 | 1118 | $date_cnt = ''; |
1119 | - foreach($date_array as $date_item) { |
|
1119 | + foreach ($date_array as $date_item) { |
|
1120 | 1120 | $date_data .= '"'.$date_item['date_name'].'",'; |
1121 | 1121 | $date_cnt .= $date_item['date_count'].','; |
1122 | 1122 | } |
1123 | 1123 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1124 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1124 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1125 | 1125 | print 'c3.generate({ |
1126 | 1126 | bindto: "#chart5", |
1127 | 1127 | data: { x: "x", |
@@ -1134,22 +1134,22 @@ discard block |
||
1134 | 1134 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1135 | 1135 | </div> |
1136 | 1136 | </div> |
1137 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1137 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1138 | 1138 | <div class="col-md-6"> |
1139 | 1139 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1140 | 1140 | <?php |
1141 | - $hour_array = $Stats->countAllTrackerHours('hour',true); |
|
1141 | + $hour_array = $Stats->countAllTrackerHours('hour', true); |
|
1142 | 1142 | if (empty($hour_array)) print _("No data available"); |
1143 | 1143 | else { |
1144 | 1144 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1145 | 1145 | $hour_data = ''; |
1146 | 1146 | $hour_cnt = ''; |
1147 | - foreach($hour_array as $hour_item) { |
|
1147 | + foreach ($hour_array as $hour_item) { |
|
1148 | 1148 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1149 | 1149 | $hour_cnt .= $hour_item['hour_count'].','; |
1150 | 1150 | } |
1151 | 1151 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1152 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1152 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1153 | 1153 | print 'c3.generate({ |
1154 | 1154 | bindto: "#chart6", |
1155 | 1155 | data: { |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1163 | 1163 | </div> |
1164 | 1164 | </div> |
1165 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1165 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1166 | 1166 | </div> |
1167 | 1167 | <?php |
1168 | 1168 | } |
@@ -1184,12 +1184,12 @@ discard block |
||
1184 | 1184 | print '<div id="chart21" class="chart" width="100%"></div><script>'; |
1185 | 1185 | $year_data = ''; |
1186 | 1186 | $year_cnt = ''; |
1187 | - foreach($year_array as $year_item) { |
|
1187 | + foreach ($year_array as $year_item) { |
|
1188 | 1188 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
1189 | 1189 | $year_cnt .= $year_item['date_count'].','; |
1190 | 1190 | } |
1191 | 1191 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1192 | - $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]"; |
|
1192 | + $year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]"; |
|
1193 | 1193 | print 'c3.generate({ |
1194 | 1194 | bindto: "#chart21", |
1195 | 1195 | data: { x: "x", |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | --> |
1206 | 1206 | </div> |
1207 | 1207 | |
1208 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1208 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1209 | 1209 | <div class="col-md-6"> |
1210 | 1210 | <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2> |
1211 | 1211 | <?php |
@@ -1215,12 +1215,12 @@ discard block |
||
1215 | 1215 | print '<div id="chart22" class="chart" width="100%"></div><script>'; |
1216 | 1216 | $year_data = ''; |
1217 | 1217 | $year_cnt = ''; |
1218 | - foreach($year_array as $year_item) { |
|
1218 | + foreach ($year_array as $year_item) { |
|
1219 | 1219 | $year_data .= '"'.$year_item['year_name'].'-01-01'.'",'; |
1220 | 1220 | $year_cnt .= $year_item['date_count'].','; |
1221 | 1221 | } |
1222 | 1222 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1223 | - $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]"; |
|
1223 | + $year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]"; |
|
1224 | 1224 | print 'c3.generate({ |
1225 | 1225 | bindto: "#chart22", |
1226 | 1226 | data: { x: "x", |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | --> |
1237 | 1237 | </div> |
1238 | 1238 | |
1239 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1239 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1240 | 1240 | </div> |
1241 | 1241 | <?php |
1242 | 1242 | } |
@@ -1258,12 +1258,12 @@ discard block |
||
1258 | 1258 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1259 | 1259 | $year_data = ''; |
1260 | 1260 | $year_cnt = ''; |
1261 | - foreach($year_array as $year_item) { |
|
1261 | + foreach ($year_array as $year_item) { |
|
1262 | 1262 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1263 | 1263 | $year_cnt .= $year_item['count'].','; |
1264 | 1264 | } |
1265 | 1265 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1266 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1266 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1267 | 1267 | print 'c3.generate({ |
1268 | 1268 | bindto: "#chart32", |
1269 | 1269 | data: { x: "x", |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1277 | 1277 | </div> |
1278 | 1278 | </div> |
1279 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1279 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1280 | 1280 | |
1281 | 1281 | <div class="row column"> |
1282 | 1282 | <div class="col-md-6"> |
@@ -1288,12 +1288,12 @@ discard block |
||
1288 | 1288 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1289 | 1289 | $year_data = ''; |
1290 | 1290 | $year_cnt = ''; |
1291 | - foreach($year_array as $year_item) { |
|
1291 | + foreach ($year_array as $year_item) { |
|
1292 | 1292 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1293 | 1293 | $year_cnt .= $year_item['count'].','; |
1294 | 1294 | } |
1295 | 1295 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1296 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1296 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1297 | 1297 | print 'c3.generate({ |
1298 | 1298 | bindto: "#chart33", |
1299 | 1299 | data: { x: "x", |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1307 | 1307 | </div> |
1308 | 1308 | </div> |
1309 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1309 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1310 | 1310 | <br/> |
1311 | 1311 | <?php |
1312 | 1312 | } |
@@ -1320,19 +1320,19 @@ discard block |
||
1320 | 1320 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1321 | 1321 | if ($year == '' && $month == '') { |
1322 | 1322 | if ($type == 'aircraft') { |
1323 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1323 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1324 | 1324 | } elseif ($type == 'marine') { |
1325 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1325 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1326 | 1326 | } elseif ($type == 'tracker') { |
1327 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
1327 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
1328 | 1328 | } |
1329 | 1329 | } else { |
1330 | 1330 | if ($type == 'aircraft') { |
1331 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1331 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1332 | 1332 | } elseif ($type == 'marine') { |
1333 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1333 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1334 | 1334 | } elseif ($type == 'tracker') { |
1335 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
1335 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
1336 | 1336 | } |
1337 | 1337 | } |
1338 | 1338 | if (!empty($polar)) { |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | unset($polar_data); |
1342 | 1342 | $Spotter = new Spotter(); |
1343 | 1343 | $data = json_decode($eachpolar['source_data']); |
1344 | - foreach($data as $value => $key) { |
|
1344 | + foreach ($data as $value => $key) { |
|
1345 | 1345 | $direction = $Spotter->parseDirection(($value*22.5)); |
1346 | 1346 | $distance = $key; |
1347 | 1347 | $unit = 'km'; |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | ?> |
1362 | 1362 | <div class="col-md-6"> |
1363 | 1363 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1364 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1364 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1365 | 1365 | <script> |
1366 | 1366 | (function() { |
1367 | 1367 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | color: color, |
1386 | 1386 | unit: '<?php echo $unit; ?>' |
1387 | 1387 | }; |
1388 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1388 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1389 | 1389 | })(); |
1390 | 1390 | </script> |
1391 | 1391 | </div> |
@@ -1400,19 +1400,19 @@ discard block |
||
1400 | 1400 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1401 | 1401 | if ($year == '' && $month == '') { |
1402 | 1402 | if ($type == 'aircraft') { |
1403 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1403 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1404 | 1404 | } elseif ($type == 'marine') { |
1405 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1405 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1406 | 1406 | } elseif ($type == 'tracker') { |
1407 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
1407 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
1408 | 1408 | } |
1409 | 1409 | } else { |
1410 | 1410 | if ($type == 'aircraft') { |
1411 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1411 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1412 | 1412 | } elseif ($type == 'marine') { |
1413 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1413 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1414 | 1414 | } elseif ($type == 'tracker') { |
1415 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
1415 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
1416 | 1416 | } |
1417 | 1417 | } |
1418 | 1418 | if (!empty($msg)) { |
@@ -1420,13 +1420,13 @@ discard block |
||
1420 | 1420 | foreach ($msg as $eachmsg) { |
1421 | 1421 | //$eachmsg = $msg[0]; |
1422 | 1422 | $data = $eachmsg['source_data']; |
1423 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1423 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1424 | 1424 | else $max = 500; |
1425 | 1425 | ?> |
1426 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1426 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1427 | 1427 | <script> |
1428 | 1428 | var g = new JustGage({ |
1429 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1429 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1430 | 1430 | value: <?php echo $data; ?>, |
1431 | 1431 | min: 0, |
1432 | 1432 | max: <?php print $max; ?>, |
@@ -1448,19 +1448,19 @@ discard block |
||
1448 | 1448 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1449 | 1449 | if ($year == '' && $month == '') { |
1450 | 1450 | if ($type == 'aircraft') { |
1451 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1451 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1452 | 1452 | } elseif ($type == 'marine') { |
1453 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1453 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1454 | 1454 | } elseif ($type == 'tracker') { |
1455 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
1455 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
1456 | 1456 | } |
1457 | 1457 | } else { |
1458 | 1458 | if ($type == 'aircraft') { |
1459 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1459 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1460 | 1460 | } elseif ($type == 'marine') { |
1461 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1461 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1462 | 1462 | } elseif ($type == 'tracker') { |
1463 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
1463 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
1464 | 1464 | } |
1465 | 1465 | } |
1466 | 1466 | foreach ($hist as $hists) { |
@@ -1470,7 +1470,7 @@ discard block |
||
1470 | 1470 | $source = $hists['source_name']; |
1471 | 1471 | $hist_array = json_decode($hists['source_data']); |
1472 | 1472 | $unit = 'km'; |
1473 | - foreach($hist_array as $distance => $nb) { |
|
1473 | + foreach ($hist_array as $distance => $nb) { |
|
1474 | 1474 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1475 | 1475 | $distance = round($distance*0.539957); |
1476 | 1476 | $unit = 'nm'; |
@@ -1490,18 +1490,18 @@ discard block |
||
1490 | 1490 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1491 | 1491 | ?> |
1492 | 1492 | <div class="col-md-6"> |
1493 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1493 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1494 | 1494 | <?php |
1495 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1495 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1496 | 1496 | print 'c3.generate({ |
1497 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1497 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1498 | 1498 | data: { x: "x", |
1499 | 1499 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1500 | 1500 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1501 | 1501 | print '</script>'; |
1502 | 1502 | ?> |
1503 | 1503 | </div> |
1504 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1504 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1505 | 1505 | <?php |
1506 | 1506 | } |
1507 | 1507 | ?> |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | require_once('require/class.Connection.php'); |
8 | 8 | require_once('require/class.Spotter.php'); |
9 | 9 | require_once('require/class.Language.php'); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
12 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
12 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
13 | 13 | $Spotter = new Spotter(); |
14 | 14 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
15 | 15 | |
16 | 16 | if (!empty($spotter_array)) |
17 | 17 | { |
18 | - $title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
18 | + $title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="info column">'; |
21 | 21 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | include('route-sub-menu.php'); |
27 | 27 | print '<div class="column">'; |
28 | 28 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
29 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
29 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
30 | 30 | |
31 | 31 | $aircraft_array = $Spotter->countAllAircraftTypesByRoute($departure_airport, $arrival_airport); |
32 | 32 | if (!empty($aircraft_array)) |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | print '</thead>'; |
42 | 42 | print '<tbody>'; |
43 | 43 | $i = 1; |
44 | - foreach($aircraft_array as $aircraft_item) |
|
44 | + foreach ($aircraft_array as $aircraft_item) |
|
45 | 45 | { |
46 | 46 | print '<tr>'; |
47 | 47 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
17 | 17 | if ($sort != '') { |
18 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
18 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
19 | 19 | } else { |
20 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", '',$filter); |
|
20 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", '', $filter); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if (!empty($spotter_array)) |
24 | 24 | { |
25 | - $title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['aircraft_owner']); |
|
25 | + $title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['aircraft_owner']); |
|
26 | 26 | require_once('header.php'); |
27 | 27 | print '<div class="info column">'; |
28 | 28 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | include('owner-sub-menu.php'); |
34 | 34 | print '<div class="column">'; |
35 | 35 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
36 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
36 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
37 | 37 | |
38 | - $aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner,$filter); |
|
38 | + $aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner, $filter); |
|
39 | 39 | if (!empty($aircraft_array)) |
40 | 40 | { |
41 | 41 | print '<div class="table-responsive">'; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | print '</thead>'; |
48 | 48 | print '<tbody>'; |
49 | 49 | $i = 1; |
50 | - foreach($aircraft_array as $aircraft_item) |
|
50 | + foreach ($aircraft_array as $aircraft_item) |
|
51 | 51 | { |
52 | 52 | print '<tr>'; |
53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | //require_once('require/class.SpotterLive.php'); |
8 | 8 | require_once('require/class.SpotterArchive.php'); |
9 | 9 | |
10 | -if (!isset($_GET['owner'])){ |
|
10 | +if (!isset($_GET['owner'])) { |
|
11 | 11 | header('Location: '.$globalURL.''); |
12 | 12 | } else { |
13 | 13 | $Spotter = new Spotter(); |
14 | 14 | $SpotterArchive = new SpotterArchive(); |
15 | 15 | //$Translation = new Translation(); |
16 | 16 | //calculuation for the pagination |
17 | - if(!isset($_GET['limit'])) |
|
17 | + if (!isset($_GET['limit'])) |
|
18 | 18 | { |
19 | 19 | $limit_start = 0; |
20 | 20 | $limit_end = 25; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | } else { |
23 | 23 | $limit_explode = explode(",", $_GET['limit']); |
24 | 24 | if (isset($limit_explode[1])) { |
25 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
26 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
26 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
27 | 27 | } else { |
28 | 28 | $limit_start = 0; |
29 | 29 | $limit_end = 25; |
@@ -40,29 +40,29 @@ discard block |
||
40 | 40 | |
41 | 41 | $page_url = $globalURL.'/owner/'.$_GET['owner']; |
42 | 42 | |
43 | - $owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
44 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
45 | - $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | - $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
43 | + $owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
44 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
45 | + $year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | + $month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | $filter = array(); |
48 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
49 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
48 | + if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
49 | + if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
50 | 50 | if ($sort != '') |
51 | 51 | { |
52 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
52 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
53 | 53 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
54 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
54 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
55 | 55 | } |
56 | 56 | } else { |
57 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
57 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
58 | 58 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
59 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
59 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | if (!empty($spotter_array)) |
64 | 64 | { |
65 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
|
65 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']); |
|
66 | 66 | //$ident = $spotter_array[0]['ident']; |
67 | 67 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
68 | 68 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -122,23 +122,23 @@ discard block |
||
122 | 122 | $Stats = new Stats(); |
123 | 123 | if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
124 | 124 | else $flights = 0; |
125 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
125 | + if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter); |
|
126 | 126 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
127 | - $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
|
127 | + $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter)); |
|
128 | 128 | print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>'; |
129 | - $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter)); |
|
129 | + $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter)); |
|
130 | 130 | print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>'; |
131 | - $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter)); |
|
131 | + $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter)); |
|
132 | 132 | print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>'; |
133 | - $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
|
133 | + $airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter)); |
|
134 | 134 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
135 | - $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
|
135 | + $duration = $Spotter->getFlightDurationByOwner($owner, $filter); |
|
136 | 136 | if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
137 | 137 | print '</div>'; |
138 | 138 | |
139 | 139 | include('owner-sub-menu.php'); |
140 | 140 | print '<div class="table column">'; |
141 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
141 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
142 | 142 | |
143 | 143 | include('table-output.php'); |
144 | 144 | print '<div class="pagination">'; |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | die; |
51 | 51 | } |
52 | 52 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
53 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
53 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine')); |
|
57 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver', 'enable-aircraft', 'disable-aircraft', 'enable-tracker', 'disable-tracker', 'enable-marine', 'disable-marine')); |
|
58 | 58 | //if (isset($options['s'])) $hosts = array($options['s']); |
59 | 59 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
60 | 60 | if (isset($options['s'])) { |
61 | 61 | $globalSources = array(); |
62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
63 | 63 | else $globalSources[] = array('host' => $options['s']); |
64 | 64 | } elseif (isset($options['source'])) { |
65 | 65 | $globalSources = array(); |
66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
66 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
67 | 67 | else $globalSources[] = array('host' => $options['source']); |
68 | 68 | } |
69 | 69 | if (isset($options['aprsserverhost'])) { |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | else $id_source = 1; |
105 | 105 | if (isset($globalServer) && $globalServer) { |
106 | 106 | if ($globalDebug) echo "Using Server Mode\n"; |
107 | - $SI=new SpotterServer(); |
|
107 | + $SI = new SpotterServer(); |
|
108 | 108 | /* |
109 | 109 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
110 | 110 | $SI = new adsb2aprs(); |
111 | 111 | $SI->connect(); |
112 | 112 | */ |
113 | -} else $SI=new SpotterImport($Connection->db); |
|
113 | +} else $SI = new SpotterImport($Connection->db); |
|
114 | 114 | |
115 | 115 | if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
116 | 116 | if (isset($globalMarine) && $globalMarine) { |
@@ -124,17 +124,17 @@ discard block |
||
124 | 124 | $MI = new MarineImport($Connection->db); |
125 | 125 | } |
126 | 126 | //$APRS=new APRS($Connection->db); |
127 | -$SBS=new SBS(); |
|
127 | +$SBS = new SBS(); |
|
128 | 128 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
129 | - $ACARS=new ACARS($Connection->db,true); |
|
130 | - $Source=new Source($Connection->db); |
|
129 | + $ACARS = new ACARS($Connection->db, true); |
|
130 | + $Source = new Source($Connection->db); |
|
131 | 131 | } |
132 | -$Common=new Common(); |
|
132 | +$Common = new Common(); |
|
133 | 133 | date_default_timezone_set('UTC'); |
134 | 134 | //$servertz = system('date +%Z'); |
135 | 135 | // signal handler - playing nice with sockets and dump1090 |
136 | 136 | if (function_exists('pcntl_fork')) { |
137 | - pcntl_signal(SIGINT, function() { |
|
137 | + pcntl_signal(SIGINT, function() { |
|
138 | 138 | global $sockets; |
139 | 139 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
140 | 140 | die("Bye!\n"); |
@@ -150,40 +150,40 @@ discard block |
||
150 | 150 | |
151 | 151 | function connect_all($hosts) { |
152 | 152 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
153 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
153 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
154 | 154 | $reset++; |
155 | 155 | if ($globalDebug) echo 'Connect to all...'."\n"; |
156 | 156 | foreach ($hosts as $id => $value) { |
157 | 157 | $host = $value['host']; |
158 | 158 | $globalSources[$id]['last_exec'] = 0; |
159 | 159 | // Here we check type of source(s) |
160 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
161 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
160 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
161 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
162 | 162 | //$formats[$id] = 'deltadbtxt'; |
163 | 163 | $globalSources[$id]['format'] = 'deltadbtxt'; |
164 | 164 | //$last_exec['deltadbtxt'] = 0; |
165 | 165 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
166 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
166 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
167 | 167 | //$formats[$id] = 'vatsimtxt'; |
168 | 168 | $globalSources[$id]['format'] = 'vatsimtxt'; |
169 | 169 | //$last_exec['vatsimtxt'] = 0; |
170 | 170 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
171 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
171 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
172 | 172 | //$formats[$id] = 'aircraftlistjson'; |
173 | 173 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
174 | 174 | //$last_exec['aircraftlistjson'] = 0; |
175 | 175 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
176 | - } else if (preg_match('/aircraft.json$/i',$host)) { |
|
176 | + } else if (preg_match('/aircraft.json$/i', $host)) { |
|
177 | 177 | //$formats[$id] = 'aircraftjson'; |
178 | 178 | $globalSources[$id]['format'] = 'aircraftjson'; |
179 | 179 | //$last_exec['aircraftlistjson'] = 0; |
180 | 180 | if ($globalDebug) echo "Connect to aircraft.json source (".$host.")...\n"; |
181 | - } else if (preg_match('/aircraft$/i',$host)) { |
|
181 | + } else if (preg_match('/aircraft$/i', $host)) { |
|
182 | 182 | //$formats[$id] = 'planefinderclient'; |
183 | 183 | $globalSources[$id]['format'] = 'planefinderclient'; |
184 | 184 | //$last_exec['aircraftlistjson'] = 0; |
185 | 185 | if ($globalDebug) echo "Connect to planefinderclient source (".$host.")...\n"; |
186 | - } else if (preg_match('/opensky/i',$host)) { |
|
186 | + } else if (preg_match('/opensky/i', $host)) { |
|
187 | 187 | //$formats[$id] = 'aircraftlistjson'; |
188 | 188 | $globalSources[$id]['format'] = 'opensky'; |
189 | 189 | //$last_exec['aircraftlistjson'] = 0; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | exit(0); |
201 | 201 | } |
202 | 202 | */ |
203 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
203 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
204 | 204 | //$formats[$id] = 'planeupdatefaa'; |
205 | 205 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
206 | 206 | //$last_exec['planeupdatefaa'] = 0; |
@@ -209,37 +209,37 @@ discard block |
||
209 | 209 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
210 | 210 | exit(0); |
211 | 211 | } |
212 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
212 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
213 | 213 | //$formats[$id] = 'phpvmacars'; |
214 | 214 | $globalSources[$id]['format'] = 'phpvmacars'; |
215 | 215 | //$last_exec['phpvmacars'] = 0; |
216 | 216 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
217 | - } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
|
217 | + } else if (preg_match('/\/api\/v1\/acars\/data$/i', $host)) { |
|
218 | 218 | //$formats[$id] = 'phpvmacars'; |
219 | 219 | $globalSources[$id]['format'] = 'vaos'; |
220 | 220 | //$last_exec['phpvmacars'] = 0; |
221 | 221 | if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
222 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
222 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
223 | 223 | //$formats[$id] = 'phpvmacars'; |
224 | 224 | $globalSources[$id]['format'] = 'vam'; |
225 | 225 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
226 | - } else if (preg_match('/whazzup/i',$host)) { |
|
226 | + } else if (preg_match('/whazzup/i', $host)) { |
|
227 | 227 | //$formats[$id] = 'whazzup'; |
228 | 228 | $globalSources[$id]['format'] = 'whazzup'; |
229 | 229 | //$last_exec['whazzup'] = 0; |
230 | 230 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
231 | - } else if (preg_match('/blitzortung/i',$host)) { |
|
231 | + } else if (preg_match('/blitzortung/i', $host)) { |
|
232 | 232 | $globalSources[$id]['format'] = 'blitzortung'; |
233 | 233 | if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
234 | - } else if (preg_match('/airwhere/i',$host)) { |
|
234 | + } else if (preg_match('/airwhere/i', $host)) { |
|
235 | 235 | $globalSources[$id]['format'] = 'airwhere'; |
236 | 236 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
237 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
237 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
238 | 238 | //$formats[$id] = 'pirepsjson'; |
239 | 239 | $globalSources[$id]['format'] = 'pirepsjson'; |
240 | 240 | //$last_exec['pirepsjson'] = 0; |
241 | 241 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
242 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
242 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
243 | 243 | //$formats[$id] = 'fr24json'; |
244 | 244 | $globalSources[$id]['format'] = 'fr24json'; |
245 | 245 | //$last_exec['fr24json'] = 0; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
249 | 249 | exit(0); |
250 | 250 | } |
251 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
251 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
252 | 252 | //$formats[$id] = 'fr24json'; |
253 | 253 | $globalSources[$id]['format'] = 'myshiptracking'; |
254 | 254 | //$last_exec['fr24json'] = 0; |
@@ -258,21 +258,21 @@ discard block |
||
258 | 258 | exit(0); |
259 | 259 | } |
260 | 260 | //} else if (preg_match('/10001/',$host)) { |
261 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
261 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
262 | 262 | //$formats[$id] = 'tsv'; |
263 | 263 | $globalSources[$id]['format'] = 'tsv'; |
264 | 264 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
265 | 265 | } |
266 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
266 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
267 | 267 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
268 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
268 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
269 | 269 | if ($idf !== false) { |
270 | 270 | $httpfeeds[$id] = $idf; |
271 | 271 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
272 | 272 | } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
273 | 273 | } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
274 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
275 | - $hostport = explode(':',$host); |
|
274 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
275 | + $hostport = explode(':', $host); |
|
276 | 276 | if (isset($hostport[1])) { |
277 | 277 | $port = $hostport[1]; |
278 | 278 | $hostn = $hostport[0]; |
@@ -282,19 +282,19 @@ discard block |
||
282 | 282 | } |
283 | 283 | $Common = new Common(); |
284 | 284 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
285 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
285 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
286 | 286 | } else { |
287 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
287 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
288 | 288 | } |
289 | 289 | if ($s) { |
290 | 290 | $sockets[$id] = $s; |
291 | 291 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
292 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
292 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
293 | 293 | //$formats[$id] = 'aprs'; |
294 | 294 | $globalSources[$id]['format'] = 'aprs'; |
295 | 295 | //$aprs_connect = 0; |
296 | 296 | //$use_aprs = true; |
297 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
297 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
298 | 298 | $globalSources[$id]['format'] = 'vrstcp'; |
299 | 299 | } elseif ($port == '10001') { |
300 | 300 | //$formats[$id] = 'tsv'; |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
336 | 336 | else $timeout = 20; |
337 | 337 | $errno = ''; |
338 | -$errstr=''; |
|
338 | +$errstr = ''; |
|
339 | 339 | |
340 | 340 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
341 | 341 | /* Initiate connections to all the hosts simultaneously */ |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | //connect_all($globalSources); |
344 | 344 | |
345 | 345 | if (isset($globalProxy) && $globalProxy) { |
346 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
346 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
347 | 347 | } else { |
348 | 348 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
349 | 349 | } |
@@ -373,16 +373,16 @@ discard block |
||
373 | 373 | |
374 | 374 | if ($use_aprs) { |
375 | 375 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
376 | - $APRS=new APRS(); |
|
376 | + $APRS = new APRS(); |
|
377 | 377 | $aprs_connect = 0; |
378 | 378 | $aprs_keep = 120; |
379 | 379 | $aprs_last_tx = time(); |
380 | 380 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
381 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
381 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
382 | 382 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
383 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
383 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
384 | 384 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
385 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
385 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
386 | 386 | if ($aprs_full) $aprs_filter = ''; |
387 | 387 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
388 | 388 | else $aprs_pass = '-1'; |
@@ -396,12 +396,12 @@ discard block |
||
396 | 396 | sleep(1); |
397 | 397 | if ($globalDebug) echo "SCAN MODE \n\n"; |
398 | 398 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
399 | -$endtime = time()+$globalCronEnd; |
|
399 | +$endtime = time() + $globalCronEnd; |
|
400 | 400 | $i = 1; |
401 | 401 | $tt = array(); |
402 | 402 | // Delete all ATC |
403 | 403 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
404 | - $ATC=new ATC($Connection->db); |
|
404 | + $ATC = new ATC($Connection->db); |
|
405 | 405 | } |
406 | 406 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
407 | 407 | $ATC->deleteAll(); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | while ($i > 0) { |
412 | 412 | if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
413 | 413 | |
414 | - if (!$globalDaemon) $i = $endtime-time(); |
|
414 | + if (!$globalDaemon) $i = $endtime - time(); |
|
415 | 415 | // Delete old ATC |
416 | 416 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
417 | 417 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | } |
426 | 426 | if ($max < $globalMinFetch) { |
427 | 427 | if ($globalDebug) echo 'Sleeping...'."\n"; |
428 | - sleep($globalMinFetch-$max+2); |
|
428 | + sleep($globalMinFetch - $max + 2); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | //$buffer = $Common->getData($hosts[$id]); |
445 | 445 | $buffer = $Common->getData($value['host']); |
446 | 446 | if ($buffer != '') $reset = 0; |
447 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
448 | - $buffer = explode('\n',$buffer); |
|
447 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
448 | + $buffer = explode('\n', $buffer); |
|
449 | 449 | foreach ($buffer as $line) { |
450 | 450 | if ($line != '' && count($line) > 7) { |
451 | 451 | $line = explode(',', $line); |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | ) |
479 | 479 | ) { |
480 | 480 | date_default_timezone_set('CET'); |
481 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
481 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
482 | 482 | date_default_timezone_set('UTC'); |
483 | 483 | if ($buffer != '') $reset = 0; |
484 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
485 | - $buffer = explode('\n',$buffer); |
|
484 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
485 | + $buffer = explode('\n', $buffer); |
|
486 | 486 | foreach ($buffer as $line) { |
487 | 487 | if ($line != '') { |
488 | 488 | //echo "'".$line."'\n"; |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | $ais_data = $AIS->parse_line(trim($line)); |
491 | 491 | $data = array(); |
492 | 492 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
493 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
493 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
494 | 494 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
495 | 495 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
496 | 496 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
503 | 503 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
504 | 504 | if (isset($ais_data['timestamp'])) { |
505 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
505 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
506 | 506 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
507 | 507 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
508 | 508 | $add = true; |
@@ -525,21 +525,21 @@ discard block |
||
525 | 525 | $w = $e = null; |
526 | 526 | |
527 | 527 | if (isset($arr[$id])) { |
528 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
528 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
529 | 529 | if ($nn > 0) { |
530 | 530 | foreach ($httpfeeds as $feed) { |
531 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
531 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
532 | 532 | if ($buffer === FALSE) { |
533 | 533 | connect_all($globalSources); |
534 | 534 | } |
535 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
536 | - $buffer = explode('\n',$buffer); |
|
535 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
536 | + $buffer = explode('\n', $buffer); |
|
537 | 537 | foreach ($buffer as $line) { |
538 | 538 | if ($line != '') { |
539 | 539 | $ais_data = $AIS->parse_line(trim($line)); |
540 | 540 | $data = array(); |
541 | 541 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
542 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
542 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
543 | 543 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
544 | 544 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
545 | 545 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
552 | 552 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
553 | 553 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
554 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
554 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
555 | 555 | if (isset($ais_data['timestamp'])) { |
556 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
556 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
557 | 557 | } else { |
558 | 558 | $data['datetime'] = date('Y-m-d H:i:s'); |
559 | 559 | } |
@@ -585,10 +585,10 @@ discard block |
||
585 | 585 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
586 | 586 | ) |
587 | 587 | ) { |
588 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
588 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
589 | 589 | if ($buffer != '') { |
590 | 590 | //echo $buffer; |
591 | - $all_data = json_decode($buffer,true); |
|
591 | + $all_data = json_decode($buffer, true); |
|
592 | 592 | //print_r($all_data); |
593 | 593 | if (isset($all_data[0]['DATA'])) { |
594 | 594 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $data['ident'] = $line['NAME']; |
598 | 598 | $data['mmsi'] = $line['MMSI']; |
599 | 599 | if (strlen($data['mmsi']) > 9) { |
600 | - $data['mmsi'] = substr($data['mmsi'],-9); |
|
600 | + $data['mmsi'] = substr($data['mmsi'], -9); |
|
601 | 601 | } |
602 | 602 | $data['speed'] = $line['SOG']; |
603 | 603 | $data['heading'] = $line['COG']; |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | //$data['type_id'] = $line['TYPE']; |
608 | 608 | $data['imo'] = $line['IMO']; |
609 | 609 | if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
610 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
611 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
610 | + if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s', strtotime($line['ARV'])); |
|
611 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
612 | 612 | $data['format_source'] = 'myshiptracking'; |
613 | 613 | $data['id_source'] = $id_source; |
614 | 614 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -625,16 +625,16 @@ discard block |
||
625 | 625 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
626 | 626 | ) |
627 | 627 | ) { |
628 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
628 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
629 | 629 | if ($buffer != '') { |
630 | - $all_data = json_decode($buffer,true); |
|
630 | + $all_data = json_decode($buffer, true); |
|
631 | 631 | if (isset($all_data[0]['mmsi'])) { |
632 | 632 | foreach ($all_data as $line) { |
633 | 633 | if ($line != '') { |
634 | 634 | $data = array(); |
635 | 635 | $data['ident'] = $line['shipname']; |
636 | 636 | $data['callsign'] = $line['callsign']; |
637 | - $data['mmsi'] = substr($line['mmsi'],-9); |
|
637 | + $data['mmsi'] = substr($line['mmsi'], -9); |
|
638 | 638 | $data['speed'] = $line['sog']; |
639 | 639 | if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
640 | 640 | $data['latitude'] = $line['latitude']; |
@@ -661,14 +661,14 @@ discard block |
||
661 | 661 | ) { |
662 | 662 | $buffer = $Common->getData($value['host']); |
663 | 663 | if ($buffer != '') { |
664 | - $all_data = json_decode($buffer,true); |
|
664 | + $all_data = json_decode($buffer, true); |
|
665 | 665 | if (isset($all_data['features'][0]['id'])) { |
666 | 666 | foreach ($all_data['features'] as $line) { |
667 | 667 | print_r($line); |
668 | 668 | $data = array(); |
669 | 669 | if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
670 | 670 | if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
671 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
671 | + if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'], -9); |
|
672 | 672 | if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
673 | 673 | if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
674 | 674 | if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
@@ -695,31 +695,31 @@ discard block |
||
695 | 695 | ) |
696 | 696 | ) { |
697 | 697 | echo 'download...'; |
698 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
698 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
699 | 699 | echo 'done !'."\n"; |
700 | 700 | // FIXME: Need more work |
701 | 701 | if ($buffer != '') $reset = 0; |
702 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
703 | - $buffer = explode('\n',$buffer); |
|
702 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
703 | + $buffer = explode('\n', $buffer); |
|
704 | 704 | foreach ($buffer as $line) { |
705 | 705 | if ($line != '') { |
706 | 706 | $data = array(); |
707 | 707 | echo $line."\n"; |
708 | - $data['mmsi'] = (int)substr($line,0,9); |
|
709 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
710 | - $data['status_id'] = substr($line,21,2); |
|
711 | - $data['type_id'] = substr($line,24,3); |
|
712 | - $data['latitude'] = substr($line,29,9); |
|
713 | - $data['longitude'] = substr($line,41,9); |
|
714 | - $data['speed'] = round(substr($line,51,5)); |
|
708 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
709 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
710 | + $data['status_id'] = substr($line, 21, 2); |
|
711 | + $data['type_id'] = substr($line, 24, 3); |
|
712 | + $data['latitude'] = substr($line, 29, 9); |
|
713 | + $data['longitude'] = substr($line, 41, 9); |
|
714 | + $data['speed'] = round(substr($line, 51, 5)); |
|
715 | 715 | //$data['course'] = substr($line,57,5); |
716 | - $data['heading'] = round(substr($line,63,3)); |
|
716 | + $data['heading'] = round(substr($line, 63, 3)); |
|
717 | 717 | //$data['draft'] = substr($line,67,4); |
718 | 718 | //$data['length'] = substr($line,72,3); |
719 | 719 | //$data['beam'] = substr($line,76,2); |
720 | - $data['ident'] = trim(utf8_encode(substr($line,78,20))); |
|
720 | + $data['ident'] = trim(utf8_encode(substr($line, 78, 20))); |
|
721 | 721 | //$data['callsign'] = trim(substr($line,100,7); |
722 | - $data['arrival_code'] = substr($line,108,20); |
|
722 | + $data['arrival_code'] = substr($line, 108, 20); |
|
723 | 723 | //$data['etaDate'] = substr($line,129,5); |
724 | 724 | //$data['etaTime'] = substr($line,135,5); |
725 | 725 | $data['format_source'] = 'shipplotter'; |
@@ -750,8 +750,8 @@ discard block |
||
750 | 750 | ) { |
751 | 751 | //$buffer = $Common->getData($hosts[$id]); |
752 | 752 | $buffer = $Common->getData($value['host']); |
753 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
754 | - $buffer = explode('\n',$buffer); |
|
753 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
754 | + $buffer = explode('\n', $buffer); |
|
755 | 755 | $reset = 0; |
756 | 756 | foreach ($buffer as $line) { |
757 | 757 | if ($line != '') { |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
763 | 763 | $data['pilot_id'] = $line[1]; |
764 | 764 | $data['pilot_name'] = $line[2]; |
765 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
765 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
766 | 766 | $data['ident'] = $line[0]; // ident |
767 | 767 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
768 | 768 | $data['speed'] = $line[8]; // speed |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
779 | 779 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
780 | 780 | $data['departure_airport_icao'] = $line[11]; |
781 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
781 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
782 | 782 | $data['arrival_airport_icao'] = $line[13]; |
783 | 783 | $data['frequency'] = $line[4]; |
784 | 784 | $data['type'] = $line[18]; |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | $data['id_source'] = $id_source; |
788 | 788 | //$data['arrival_airport_time'] = ; |
789 | 789 | if ($line[9] != '') { |
790 | - $aircraft_data = explode('/',$line[9]); |
|
790 | + $aircraft_data = explode('/', $line[9]); |
|
791 | 791 | if (isset($aircraft_data[1])) { |
792 | 792 | $data['aircraft_icao'] = $aircraft_data[1]; |
793 | 793 | } |
@@ -802,9 +802,9 @@ discard block |
||
802 | 802 | if ($line[3] === 'PILOT') $SI->add($data); |
803 | 803 | elseif ($line[3] === 'ATC') { |
804 | 804 | //print_r($data); |
805 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
806 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
807 | - $typec = substr($data['ident'],-3); |
|
805 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
806 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
807 | + $typec = substr($data['ident'], -3); |
|
808 | 808 | if ($typec === 'APP') $data['type'] = 'Approach'; |
809 | 809 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
810 | 810 | elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
@@ -816,8 +816,8 @@ discard block |
||
816 | 816 | elseif ($data['type'] === '') $data['type'] = 'Observer'; |
817 | 817 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
818 | 818 | if (isset($ATC)) { |
819 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
820 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
819 | + if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
820 | + else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
821 | 821 | } |
822 | 822 | } |
823 | 823 | unset($data); |
@@ -833,24 +833,24 @@ discard block |
||
833 | 833 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
834 | 834 | ) |
835 | 835 | ) { |
836 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
836 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
837 | 837 | if ($buffer != '') { |
838 | 838 | $all_data = simplexml_load_string($buffer); |
839 | - foreach($all_data->children() as $childdata) { |
|
839 | + foreach ($all_data->children() as $childdata) { |
|
840 | 840 | $data = array(); |
841 | 841 | $line = $childdata; |
842 | 842 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
843 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
844 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
845 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
846 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
847 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
848 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
849 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
843 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
844 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
845 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
846 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
847 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
848 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
849 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
850 | 850 | $data['altitude_relative'] = 'AMSL'; |
851 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
851 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
852 | 852 | $data['aircraft_icao'] = 'PARAGLIDER'; |
853 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
853 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
854 | 854 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
855 | 855 | $data['format_source'] = $value['format']; |
856 | 856 | $SI->add($data); |
@@ -858,22 +858,22 @@ discard block |
||
858 | 858 | } |
859 | 859 | } |
860 | 860 | $Source->deleteOldLocationByType('gs'); |
861 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
861 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
862 | 862 | if ($buffer != '') { |
863 | 863 | $all_data = simplexml_load_string($buffer); |
864 | - foreach($all_data->children() as $childdata) { |
|
864 | + foreach ($all_data->children() as $childdata) { |
|
865 | 865 | $data = array(); |
866 | 866 | $line = $childdata; |
867 | - $data['id'] = (int)$line['gsID']; |
|
868 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
869 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
870 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
867 | + $data['id'] = (int) $line['gsID']; |
|
868 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
869 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
870 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
871 | 871 | $data['altitude_relative'] = 'AMSL'; |
872 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
872 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
873 | 873 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
874 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
874 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
875 | 875 | } else { |
876 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
876 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
877 | 877 | } |
878 | 878 | unset($data); |
879 | 879 | } |
@@ -891,9 +891,9 @@ discard block |
||
891 | 891 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
892 | 892 | ) |
893 | 893 | ) { |
894 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
894 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
895 | 895 | if ($buffer != '') { |
896 | - $all_data = json_decode($buffer,true); |
|
896 | + $all_data = json_decode($buffer, true); |
|
897 | 897 | if (isset($all_data['acList'])) { |
898 | 898 | $reset = 0; |
899 | 899 | foreach ($all_data['acList'] as $line) { |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
910 | 910 | $data['emergency'] = ''; // emergency |
911 | 911 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
912 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
912 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
913 | 913 | else $data['datetime'] = date('Y-m-d H:i:s'); |
914 | 914 | //$data['datetime'] = date('Y-m-d H:i:s'); |
915 | 915 | if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | $data['verticalrate'] = $line['vrt']; // verticale rate |
935 | 935 | $data['squawk'] = $line['squawk']; // squawk |
936 | 936 | $data['emergency'] = ''; // emergency |
937 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
937 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
938 | 938 | else $data['datetime'] = date('Y-m-d H:i:s'); |
939 | 939 | $data['format_source'] = 'aircraftlistjson'; |
940 | 940 | $data['id_source'] = $id_source; |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | ) |
956 | 956 | ) { |
957 | 957 | $buffer = $Common->getData($value['host']); |
958 | - $all_data = json_decode($buffer,true); |
|
958 | + $all_data = json_decode($buffer, true); |
|
959 | 959 | if (isset($all_data['planes'])) { |
960 | 960 | $reset = 0; |
961 | 961 | foreach ($all_data['planes'] as $key => $line) { |
@@ -972,12 +972,12 @@ discard block |
||
972 | 972 | $data['emergency'] = ''; // emergency |
973 | 973 | $data['registration'] = $line[2]; |
974 | 974 | $data['aircraft_icao'] = $line[0]; |
975 | - $deparr = explode('-',$line[1]); |
|
975 | + $deparr = explode('-', $line[1]); |
|
976 | 976 | if (count($deparr) === 2) { |
977 | 977 | $data['departure_airport_icao'] = $deparr[0]; |
978 | 978 | $data['arrival_airport_icao'] = $deparr[1]; |
979 | 979 | } |
980 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
980 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
981 | 981 | $data['format_source'] = 'planeupdatefaa'; |
982 | 982 | $data['id_source'] = $id_source; |
983 | 983 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | ) |
996 | 996 | ) { |
997 | 997 | $buffer = $Common->getData($value['host']); |
998 | - $all_data = json_decode($buffer,true); |
|
998 | + $all_data = json_decode($buffer, true); |
|
999 | 999 | if (isset($all_data['states'])) { |
1000 | 1000 | $reset = 0; |
1001 | 1001 | foreach ($all_data['states'] as $key => $line) { |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | //$data['emergency'] = ''; // emergency |
1013 | 1013 | //$data['registration'] = $line[2]; |
1014 | 1014 | //$data['aircraft_icao'] = $line[0]; |
1015 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
1015 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
1016 | 1016 | $data['format_source'] = 'opensky'; |
1017 | 1017 | $data['id_source'] = $id_source; |
1018 | 1018 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | ) |
1030 | 1030 | ) { |
1031 | 1031 | $buffer = $Common->getData($value['host']); |
1032 | - $all_data = json_decode($buffer,true); |
|
1033 | - if (isset($all_data['aircraft']) && isset($all_data['now']) && $all_data['now'] > time()-1800) { |
|
1032 | + $all_data = json_decode($buffer, true); |
|
1033 | + if (isset($all_data['aircraft']) && isset($all_data['now']) && $all_data['now'] > time() - 1800) { |
|
1034 | 1034 | $reset = 0; |
1035 | 1035 | foreach ($all_data['aircraft'] as $key => $line) { |
1036 | 1036 | $data = array(); |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | ) |
1069 | 1069 | ) { |
1070 | 1070 | $buffer = $Common->getData($value['host']); |
1071 | - $all_data = json_decode($buffer,true); |
|
1071 | + $all_data = json_decode($buffer, true); |
|
1072 | 1072 | if (isset($all_data['aircraft'])) { |
1073 | 1073 | $reset = 0; |
1074 | 1074 | foreach ($all_data['aircraft'] as $key => $line) { |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | //$data['emergency'] = ''; // emergency |
1086 | 1086 | if (isset($line['reg'])) $data['registration'] = $line['reg']; |
1087 | 1087 | if (isset($line['type'])) $data['aircraft_icao'] = $line['type']; |
1088 | - $data['datetime'] = date('Y-m-d H:i:s',$line['pos_update_time']); |
|
1088 | + $data['datetime'] = date('Y-m-d H:i:s', $line['pos_update_time']); |
|
1089 | 1089 | $data['format_source'] = 'planefinderclient'; |
1090 | 1090 | $data['id_source'] = $id_source; |
1091 | 1091 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | ) { |
1105 | 1105 | //$buffer = $Common->getData($hosts[$id]); |
1106 | 1106 | $buffer = $Common->getData($value['host']); |
1107 | - $all_data = json_decode($buffer,true); |
|
1107 | + $all_data = json_decode($buffer, true); |
|
1108 | 1108 | if (!empty($all_data)) $reset = 0; |
1109 | 1109 | foreach ($all_data as $key => $line) { |
1110 | 1110 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -1142,11 +1142,11 @@ discard block |
||
1142 | 1142 | ) |
1143 | 1143 | ) { |
1144 | 1144 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
1145 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
1145 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
1146 | 1146 | //echo $buffer; |
1147 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
1148 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
1149 | - $all_data = json_decode($buffer,true); |
|
1147 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
1148 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
1149 | + $all_data = json_decode($buffer, true); |
|
1150 | 1150 | if (json_last_error() != JSON_ERROR_NONE) { |
1151 | 1151 | die(json_last_error_msg()); |
1152 | 1152 | } |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | //$data['departure_airport_iata'] = $line[11]; |
1170 | 1170 | //$data['arrival_airport_iata'] = $line[12]; |
1171 | 1171 | //$data['emergency'] = ''; // emergency |
1172 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
1172 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
1173 | 1173 | $data['format_source'] = 'radarvirtueljson'; |
1174 | 1174 | $data['id_source'] = $id_source; |
1175 | 1175 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1190,14 +1190,14 @@ discard block |
||
1190 | 1190 | ) { |
1191 | 1191 | //$buffer = $Common->getData($hosts[$id]); |
1192 | 1192 | $buffer = $Common->getData($value['host'].'?'.time()); |
1193 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
1193 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
1194 | 1194 | |
1195 | 1195 | if (isset($all_data['pireps'])) { |
1196 | 1196 | $reset = 0; |
1197 | 1197 | foreach ($all_data['pireps'] as $line) { |
1198 | 1198 | $data = array(); |
1199 | 1199 | $data['id'] = $line['id']; |
1200 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
1200 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1201 | 1201 | $data['ident'] = $line['callsign']; // ident |
1202 | 1202 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
1203 | 1203 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -1227,9 +1227,9 @@ discard block |
||
1227 | 1227 | $SI->add($data); |
1228 | 1228 | // print_r($data); |
1229 | 1229 | } elseif ($line['icon'] === 'ct') { |
1230 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
1231 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
1232 | - $typec = substr($data['ident'],-3); |
|
1230 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
1231 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
1232 | + $typec = substr($data['ident'], -3); |
|
1233 | 1233 | $data['type'] = ''; |
1234 | 1234 | if ($typec === 'APP') $data['type'] = 'Approach'; |
1235 | 1235 | elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
1241 | 1241 | elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
1242 | 1242 | else $data['type'] = 'Observer'; |
1243 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1243 | + if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
1244 | 1244 | } |
1245 | 1245 | unset($data); |
1246 | 1246 | } |
@@ -1257,14 +1257,14 @@ discard block |
||
1257 | 1257 | //$buffer = $Common->getData($hosts[$id]); |
1258 | 1258 | if ($globalDebug) echo 'Get Data...'."\n"; |
1259 | 1259 | $buffer = $Common->getData($value['host']); |
1260 | - $all_data = json_decode($buffer,true); |
|
1260 | + $all_data = json_decode($buffer, true); |
|
1261 | 1261 | if ($buffer != '' && is_array($all_data)) { |
1262 | 1262 | $reset = 0; |
1263 | 1263 | foreach ($all_data as $line) { |
1264 | 1264 | $data = array(); |
1265 | 1265 | //$data['id'] = $line['id']; // id not usable |
1266 | 1266 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
1267 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1267 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1268 | 1268 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
1269 | 1269 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
1270 | 1270 | $data['ident'] = $line['flightnum']; // ident |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | //$data['datetime'] = $line['lastupdate']; |
1280 | 1280 | //$data['last_update'] = $line['lastupdate']; |
1281 | 1281 | if (isset($value['timezone'])) { |
1282 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1282 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
1283 | 1283 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1284 | 1284 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1285 | 1285 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1295,14 +1295,14 @@ discard block |
||
1295 | 1295 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
1296 | 1296 | if (isset($line['aircraftname'])) { |
1297 | 1297 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1298 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
1299 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
1298 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
1299 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
1300 | 1300 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
1301 | 1301 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
1302 | 1302 | else { |
1303 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
1304 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1305 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1303 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
1304 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
1305 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
1306 | 1306 | } |
1307 | 1307 | } |
1308 | 1308 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | //$buffer = $Common->getData($hosts[$id]); |
1328 | 1328 | if ($globalDebug) echo 'Get Data...'."\n"; |
1329 | 1329 | $buffer = $Common->getData($value['host']); |
1330 | - $all_data = json_decode($buffer,true); |
|
1330 | + $all_data = json_decode($buffer, true); |
|
1331 | 1331 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
1332 | 1332 | $reset = 0; |
1333 | 1333 | foreach ($all_data['ACARSData'] as $line) { |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
1339 | 1339 | if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
1340 | 1340 | if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
1341 | - $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
|
1341 | + $data['ident'] = str_replace(' ', '', $line['bid']['flightnum']); // ident |
|
1342 | 1342 | if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
1343 | 1343 | $data['altitude'] = $line['altitude']; // altitude |
1344 | 1344 | $data['speed'] = $line['groundspeed']; // speed |
@@ -1349,7 +1349,7 @@ discard block |
||
1349 | 1349 | //$data['squawk'] = ''; // squawk |
1350 | 1350 | //$data['emergency'] = ''; // emergency |
1351 | 1351 | if (isset($value['timezone'])) { |
1352 | - $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
|
1352 | + $datetime = new DateTime($line['updated_at'], new DateTimeZone($value['timezone'])); |
|
1353 | 1353 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1354 | 1354 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1355 | 1355 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1385,14 +1385,14 @@ discard block |
||
1385 | 1385 | //$buffer = $Common->getData($hosts[$id]); |
1386 | 1386 | if ($globalDebug) echo 'Get Data...'."\n"; |
1387 | 1387 | $buffer = $Common->getData($value['host']); |
1388 | - $all_data = json_decode($buffer,true); |
|
1388 | + $all_data = json_decode($buffer, true); |
|
1389 | 1389 | if ($buffer != '' && is_array($all_data)) { |
1390 | 1390 | $reset = 0; |
1391 | 1391 | foreach ($all_data as $line) { |
1392 | 1392 | $data = array(); |
1393 | 1393 | //$data['id'] = $line['id']; // id not usable |
1394 | 1394 | $data['id'] = trim($line['flight_id']); |
1395 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1395 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1396 | 1396 | $data['pilot_name'] = $line['pilot_name']; |
1397 | 1397 | $data['pilot_id'] = $line['pilot_id']; |
1398 | 1398 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1436,24 +1436,24 @@ discard block |
||
1436 | 1436 | //$buffer = $Common->getData($hosts[$id]); |
1437 | 1437 | if ($globalDebug) echo 'Get Data...'."\n"; |
1438 | 1438 | $buffer = $Common->getData($value['host']); |
1439 | - $all_data = json_decode($buffer,true); |
|
1439 | + $all_data = json_decode($buffer, true); |
|
1440 | 1440 | if ($buffer != '') { |
1441 | 1441 | $Source->deleteLocationBySource('blitzortung'); |
1442 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
1443 | - $buffer = explode('\n',$buffer); |
|
1442 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
1443 | + $buffer = explode('\n', $buffer); |
|
1444 | 1444 | foreach ($buffer as $buffer_line) { |
1445 | - $line = json_decode($buffer_line,true); |
|
1445 | + $line = json_decode($buffer_line, true); |
|
1446 | 1446 | if (isset($line['time'])) { |
1447 | 1447 | $data = array(); |
1448 | 1448 | $data['altitude'] = $line['alt']; // altitude |
1449 | 1449 | $data['latitude'] = $line['lat']; // lat |
1450 | 1450 | $data['longitude'] = $line['lon']; // long |
1451 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line['time'],0,10)); |
|
1451 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line['time'], 0, 10)); |
|
1452 | 1452 | $data['id_source'] = $id_source; |
1453 | 1453 | $data['format_source'] = 'blitzortung'; |
1454 | 1454 | $SI->add($data); |
1455 | 1455 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1456 | - $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
|
1456 | + $Source->addLocation('', $data['latitude'], $data['longitude'], 0, '', '', 'blitzortung', 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime']); |
|
1457 | 1457 | unset($data); |
1458 | 1458 | } |
1459 | 1459 | } |
@@ -1476,11 +1476,11 @@ discard block |
||
1476 | 1476 | //$value = $formats[$nb]; |
1477 | 1477 | $format = $globalSources[$nb]['format']; |
1478 | 1478 | if ($format === 'sbs' || $format === 'aprs' || $format === 'famaprs' || $format === 'raw' || $format === 'tsv' || $format === 'acarssbs3') { |
1479 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
1479 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
1480 | 1480 | } elseif ($format === 'vrstcp') { |
1481 | 1481 | $buffer = @socket_read($r, 6000); |
1482 | 1482 | } else { |
1483 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
1483 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
1484 | 1484 | } |
1485 | 1485 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
1486 | 1486 | //echo $buffer."\n"; |
@@ -1490,8 +1490,8 @@ discard block |
||
1490 | 1490 | //$SI::del(); |
1491 | 1491 | if ($buffer !== FALSE) { |
1492 | 1492 | if ($format === 'vrstcp') { |
1493 | - $buffer = explode('},{',$buffer); |
|
1494 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1493 | + $buffer = explode('},{', $buffer); |
|
1494 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
1495 | 1495 | } |
1496 | 1496 | // SBS format is CSV format |
1497 | 1497 | if ($buffer !== FALSE && $buffer !== '') { |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | $ais_data = $AIS->parse_line(trim($buffer)); |
1516 | 1516 | $data = array(); |
1517 | 1517 | if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
1518 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
1518 | + if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9); |
|
1519 | 1519 | if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
1520 | 1520 | if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
1521 | 1521 | if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
@@ -1526,13 +1526,13 @@ discard block |
||
1526 | 1526 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
1527 | 1527 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
1528 | 1528 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
1529 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1529 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
1530 | 1530 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1531 | 1531 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1532 | 1532 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
1533 | 1533 | |
1534 | 1534 | if (isset($ais_data['timestamp'])) { |
1535 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
1535 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
1536 | 1536 | } else { |
1537 | 1537 | $data['datetime'] = date('Y-m-d H:i:s'); |
1538 | 1538 | } |
@@ -1543,10 +1543,10 @@ discard block |
||
1543 | 1543 | } elseif ($format === 'flightgearsp') { |
1544 | 1544 | //echo $buffer."\n"; |
1545 | 1545 | if (strlen($buffer) > 5) { |
1546 | - $line = explode(',',$buffer); |
|
1546 | + $line = explode(',', $buffer); |
|
1547 | 1547 | $data = array(); |
1548 | 1548 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
1549 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
1549 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1550 | 1550 | $data['ident'] = $line[6]; |
1551 | 1551 | $data['aircraft_name'] = $line[7]; |
1552 | 1552 | $data['longitude'] = $line[1]; |
@@ -1563,16 +1563,16 @@ discard block |
||
1563 | 1563 | } elseif ($format === 'acars') { |
1564 | 1564 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1565 | 1565 | $ACARS->add(trim($buffer)); |
1566 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1566 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1567 | 1567 | $ACARS->deleteLiveAcarsData(); |
1568 | 1568 | } elseif ($format === 'flightgearmp') { |
1569 | - if (substr($buffer,0,1) != '#') { |
|
1569 | + if (substr($buffer, 0, 1) != '#') { |
|
1570 | 1570 | $data = array(); |
1571 | 1571 | //echo $buffer."\n"; |
1572 | - $line = explode(' ',$buffer); |
|
1572 | + $line = explode(' ', $buffer); |
|
1573 | 1573 | if (count($line) === 11) { |
1574 | - $userserver = explode('@',$line[0]); |
|
1575 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1574 | + $userserver = explode('@', $line[0]); |
|
1575 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
1576 | 1576 | $data['ident'] = $userserver[0]; |
1577 | 1577 | $data['registration'] = $userserver[0]; |
1578 | 1578 | $data['latitude'] = $line[4]; |
@@ -1580,8 +1580,8 @@ discard block |
||
1580 | 1580 | $data['altitude'] = $line[6]; |
1581 | 1581 | $data['datetime'] = date('Y-m-d H:i:s'); |
1582 | 1582 | $aircraft_type = $line[10]; |
1583 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1584 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1583 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
1584 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
1585 | 1585 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1586 | 1586 | if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1587 | 1587 | } |
@@ -1590,8 +1590,8 @@ discard block |
||
1590 | 1590 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
1591 | 1591 | die; |
1592 | 1592 | } elseif ($format === 'vrstcp') { |
1593 | - foreach($buffer as $all_data) { |
|
1594 | - $line = json_decode('{'.$all_data.'}',true); |
|
1593 | + foreach ($buffer as $all_data) { |
|
1594 | + $line = json_decode('{'.$all_data.'}', true); |
|
1595 | 1595 | $data = array(); |
1596 | 1596 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
1597 | 1597 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1617,16 +1617,16 @@ discard block |
||
1617 | 1617 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1618 | 1618 | unset($data); |
1619 | 1619 | } |
1620 | - } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
|
1620 | + } elseif ($format === 'tsv' || substr($buffer, 0, 4) === 'clock') { |
|
1621 | 1621 | $line = explode("\t", $buffer); |
1622 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1622 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
1623 | 1623 | $key = $line[$k]; |
1624 | - $lined[$key] = $line[$k+1]; |
|
1624 | + $lined[$key] = $line[$k + 1]; |
|
1625 | 1625 | } |
1626 | 1626 | if (count($lined) > 3) { |
1627 | 1627 | $data['hex'] = $lined['hexid']; |
1628 | 1628 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1629 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1629 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
1630 | 1630 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
1631 | 1631 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
1632 | 1632 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1645,23 +1645,23 @@ discard block |
||
1645 | 1645 | } else $error = true; |
1646 | 1646 | } elseif ($format === 'aprs' && $use_aprs) { |
1647 | 1647 | if ($aprs_connect === 0) { |
1648 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
1648 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
1649 | 1649 | $aprs_connect = 1; |
1650 | 1650 | } |
1651 | 1651 | |
1652 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1652 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
1653 | 1653 | $aprs_last_tx = time(); |
1654 | 1654 | $data_aprs = "# Keep alive"; |
1655 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1655 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1656 | 1656 | } |
1657 | 1657 | |
1658 | 1658 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
1659 | 1659 | //echo 'APRS data : '.$buffer."\n"; |
1660 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1661 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1660 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
1661 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
1662 | 1662 | //echo $buffer."\n"; |
1663 | 1663 | date_default_timezone_set('UTC'); |
1664 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1664 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
1665 | 1665 | $line = $APRS->parse($buffer); |
1666 | 1666 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
1667 | 1667 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
1677 | 1677 | if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
1678 | 1678 | if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
1679 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1679 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
1680 | 1680 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1681 | 1681 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1682 | 1682 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -1759,29 +1759,29 @@ discard block |
||
1759 | 1759 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
1760 | 1760 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
1761 | 1761 | $Source->deleteOldLocationByType('gs'); |
1762 | - if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
|
1763 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1762 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'gs')) > 0) { |
|
1763 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1764 | 1764 | } else { |
1765 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1765 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1766 | 1766 | } |
1767 | 1767 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
1768 | 1768 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1769 | 1769 | if ($globalDebug) echo '# Weather Station added'."\n"; |
1770 | 1770 | $Source->deleteOldLocationByType('wx'); |
1771 | 1771 | $weather_data = json_encode($line); |
1772 | - if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
|
1773 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
1772 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'wx')) > 0) { |
|
1773 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
1774 | 1774 | } else { |
1775 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
1775 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
1776 | 1776 | } |
1777 | 1777 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
1778 | 1778 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1779 | 1779 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1780 | 1780 | $Source->deleteOldLocationByType('lightning'); |
1781 | - if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
|
1782 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
1781 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'lightning')) > 0) { |
|
1782 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
1783 | 1783 | } else { |
1784 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
1784 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
1785 | 1785 | } |
1786 | 1786 | } elseif ($globalDebug) { |
1787 | 1787 | echo '/!\ Not added: '.$buffer."\n"; |
@@ -1790,7 +1790,7 @@ discard block |
||
1790 | 1790 | unset($data); |
1791 | 1791 | } |
1792 | 1792 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
1793 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
1793 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
1794 | 1794 | } |
1795 | 1795 | /* |
1796 | 1796 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] === 'Car' || $line['symbol'] === 'Ambulance' || $line['symbol'] === 'Van' || $line['symbol'] === 'Truck' || $line['symbol'] === 'Truck (18 Wheeler)' || $line['symbol'] === 'Motorcycle')) { |
@@ -1799,7 +1799,7 @@ discard block |
||
1799 | 1799 | */ |
1800 | 1800 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
1801 | 1801 | elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
1802 | - if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
1802 | + if (isset($globalSources[$nb]['last_weather_clean']) && time() - $globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
1803 | 1803 | $Source->deleteOldLocationByType('lightning'); |
1804 | 1804 | $Source->deleteOldLocationByType('wx'); |
1805 | 1805 | $globalSources[$nb]['last_weather_clean'] = time(); |
@@ -1884,7 +1884,7 @@ discard block |
||
1884 | 1884 | connect_all($sourceee); |
1885 | 1885 | $sourceee = array(); |
1886 | 1886 | //connect_all($globalSources); |
1887 | - $tt[$format]=0; |
|
1887 | + $tt[$format] = 0; |
|
1888 | 1888 | break; |
1889 | 1889 | } |
1890 | 1890 | //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."..."; |
@@ -1894,14 +1894,14 @@ discard block |
||
1894 | 1894 | } else { |
1895 | 1895 | $error = socket_strerror(socket_last_error()); |
1896 | 1896 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1897 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1897 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
1898 | 1898 | if (isset($globalDebug)) echo "Restarting...\n"; |
1899 | 1899 | // Restart the script if possible |
1900 | 1900 | if (is_array($sockets)) { |
1901 | 1901 | if ($globalDebug) echo "Shutdown all sockets..."; |
1902 | 1902 | |
1903 | 1903 | foreach ($sockets as $sock) { |
1904 | - @socket_shutdown($sock,2); |
|
1904 | + @socket_shutdown($sock, 2); |
|
1905 | 1905 | @socket_close($sock); |
1906 | 1906 | } |
1907 | 1907 |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | $currentdate = date('Y-m-d'); |
35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
36 | 36 | if (!empty($sourcestat)) { |
37 | - foreach($sourcestat as $srcst) { |
|
37 | + foreach ($sourcestat as $srcst) { |
|
38 | 38 | $type = $srcst['stats_type']; |
39 | 39 | if ($type == 'polar' || $type == 'hist') { |
40 | 40 | $source = $srcst['source_name']; |
41 | 41 | $data = $srcst['source_data']; |
42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
42 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | if (isset($globalGeoid) && $globalGeoid) { |
52 | 52 | try { |
53 | 53 | $GeoidClass = new GeoidHeight(); |
54 | - } catch(Exception $e) { |
|
54 | + } catch (Exception $e) { |
|
55 | 55 | if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
56 | 56 | $GeoidClass = FALSE; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - public function get_Schedule($id,$ident) { |
|
61 | + public function get_Schedule($id, $ident) { |
|
62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
63 | 63 | // Get schedule here, so it's done only one time |
64 | 64 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
85 | 85 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
88 | 88 | // Should also check if route schedule = route from DB |
89 | 89 | if ($schedule['DepartureAirportIATA'] != '') { |
90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
107 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
108 | 108 | } |
109 | 109 | } else $scheduleexist = true; |
110 | 110 | } else $scheduleexist = true; |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | if ($scheduleexist) { |
113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
114 | 114 | $sch = $Schedule->getSchedule($operator); |
115 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
116 | - if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']); |
|
115 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
116 | + if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'], $sch['departure_airport_icao'], $sch['departure_airport_time'], $sch['arrival_airport_icao'], $sch['arrival_airport_time']); |
|
117 | 117 | } |
118 | 118 | $Spotter->db = null; |
119 | 119 | $Schedule->db = null; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
141 | 141 | $Spotter = new Spotter($this->db); |
142 | 142 | $real_arrival = $this->arrival($key); |
143 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
143 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $airport_time = ''; |
155 | 155 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
156 | 156 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
157 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
157 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
158 | 158 | if (isset($closestAirports[0])) { |
159 | 159 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
160 | 160 | $airport_icao = $closestAirports[0]['icao']; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | break; |
170 | 170 | } |
171 | 171 | } |
172 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
172 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
173 | 173 | $airport_icao = $closestAirports[0]['icao']; |
174 | 174 | $airport_time = $this->all_flights[$key]['datetime']; |
175 | 175 | } else { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } else { |
183 | 183 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
184 | 184 | } |
185 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
185 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
194 | 194 | foreach ($this->all_flights as $key => $flight) { |
195 | 195 | if (isset($flight['lastupdate'])) { |
196 | - if ($flight['lastupdate'] < (time()-1800)) { |
|
196 | + if ($flight['lastupdate'] < (time() - 1800)) { |
|
197 | 197 | $this->delKey($key); |
198 | 198 | } |
199 | 199 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $real_arrival = $this->arrival($key); |
210 | 210 | $Spotter = new Spotter($this->db); |
211 | 211 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
212 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
212 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
213 | 213 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
214 | 214 | } |
215 | 215 | } |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | $send = false; |
243 | 243 | |
244 | 244 | // SBS format is CSV format |
245 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
245 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
246 | 246 | //print_r($line); |
247 | 247 | if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
248 | - if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
248 | + if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'], 0, 1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
249 | 249 | |
250 | 250 | // Increment message number |
251 | 251 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
@@ -278,25 +278,25 @@ discard block |
||
278 | 278 | if (!isset($this->all_flights[$id])) { |
279 | 279 | if ($globalDebug) echo 'New flight...'."\n"; |
280 | 280 | $this->all_flights[$id] = array(); |
281 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
282 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
283 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
281 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
282 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'altitude_previous' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true, 'source_type' => '')); |
|
283 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
284 | 284 | if (!isset($line['id'])) { |
285 | 285 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
286 | 286 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
287 | 287 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
288 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
288 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
289 | 289 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
290 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
290 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
291 | 291 | if ($globalAllFlights !== FALSE) $dataFound = true; |
292 | 292 | } |
293 | 293 | if (isset($line['source_type']) && $line['source_type'] != '') { |
294 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
294 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | //print_r($this->all_flights); |
298 | 298 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
299 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
299 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
300 | 300 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
301 | 301 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
302 | 302 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -305,20 +305,20 @@ discard block |
||
305 | 305 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
306 | 306 | $Spotter = new Spotter($this->db); |
307 | 307 | if (isset($this->all_flights[$id]['source_type'])) { |
308 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
308 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
309 | 309 | } else { |
310 | 310 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
311 | 311 | } |
312 | 312 | $Spotter->db = null; |
313 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
314 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
313 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
314 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | if ($globalAllFlights !== FALSE) $dataFound = true; |
318 | 318 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
319 | 319 | } |
320 | 320 | if (isset($line['id']) && !isset($line['hex'])) { |
321 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
322 | 322 | } |
323 | 323 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
324 | 324 | $icao = $line['aircraft_icao']; |
@@ -327,14 +327,14 @@ discard block |
||
327 | 327 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
328 | 328 | $Spotter->db = null; |
329 | 329 | } |
330 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
330 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
331 | 331 | } elseif (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
332 | 332 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
333 | 333 | // Get aircraft ICAO from aircraft name |
334 | 334 | $Spotter = new Spotter($this->db); |
335 | 335 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
336 | 336 | $Spotter->db = null; |
337 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
337 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -342,15 +342,15 @@ discard block |
||
342 | 342 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
343 | 343 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
344 | 344 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
345 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
345 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
346 | 346 | } |
347 | 347 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
348 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
348 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
349 | 349 | } |
350 | 350 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
351 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
351 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
352 | 352 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
353 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
353 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
354 | 354 | } else { |
355 | 355 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
356 | 356 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -361,31 +361,31 @@ discard block |
||
361 | 361 | */ |
362 | 362 | return ''; |
363 | 363 | } |
364 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
364 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
365 | 365 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
366 | 366 | return ''; |
367 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
367 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
368 | 368 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
369 | 369 | return ''; |
370 | 370 | } elseif (!isset($line['datetime'])) { |
371 | 371 | date_default_timezone_set('UTC'); |
372 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
372 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
373 | 373 | } else { |
374 | 374 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
375 | 375 | return ''; |
376 | 376 | } |
377 | 377 | |
378 | 378 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') { |
379 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
379 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
380 | 380 | } |
381 | 381 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
382 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
382 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
383 | 383 | } |
384 | 384 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
385 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
385 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id']))); |
|
386 | 386 | } |
387 | 387 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
388 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
388 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name']))); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
394 | 394 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
395 | 395 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
396 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
397 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
398 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
399 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
400 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
396 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
397 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
398 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
399 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
400 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
401 | 401 | } else { |
402 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
402 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
403 | 403 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
404 | 404 | $timeelapsed = microtime(true); |
405 | 405 | $Spotter = new Spotter($this->db); |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
410 | 410 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
411 | 411 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
412 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
412 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
413 | 413 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
414 | 414 | $Spotter->db = null; |
415 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
415 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
416 | 416 | } |
417 | 417 | } |
418 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
418 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
419 | 419 | |
420 | 420 | /* |
421 | 421 | if (!isset($line['id'])) { |
@@ -425,25 +425,25 @@ discard block |
||
425 | 425 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
426 | 426 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
427 | 427 | */ |
428 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
428 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
429 | 429 | |
430 | 430 | //$putinarchive = true; |
431 | 431 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
432 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
432 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
433 | 433 | } |
434 | 434 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
435 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
435 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
436 | 436 | } |
437 | 437 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
438 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
438 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
439 | 439 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
440 | 440 | $timeelapsed = microtime(true); |
441 | 441 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
442 | 442 | $Spotter = new Spotter($this->db); |
443 | 443 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
444 | 444 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
445 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
445 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
446 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
447 | 447 | } |
448 | 448 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
449 | 449 | $timeelapsed = microtime(true); |
@@ -457,35 +457,35 @@ discard block |
||
457 | 457 | $Translation->db = null; |
458 | 458 | } |
459 | 459 | $Spotter->db = null; |
460 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
460 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
461 | 461 | } |
462 | 462 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
463 | 463 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
464 | 464 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
465 | 465 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
466 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
466 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
467 | 467 | } |
468 | 468 | } |
469 | 469 | if (!isset($globalFork)) $globalFork = TRUE; |
470 | 470 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
471 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
471 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
476 | 476 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
477 | 477 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
478 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
479 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
478 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
479 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
480 | 480 | //$dataFound = true; |
481 | 481 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
482 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
482 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
483 | 483 | if ($distance > 1000 && $distance < 10000) { |
484 | 484 | // use datetime |
485 | 485 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
486 | 486 | $speed = $speed*3.6; |
487 | 487 | if ($speed < 1000) { |
488 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
488 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
489 | 489 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
490 | 490 | } else { |
491 | 491 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
501 | 501 | return false; |
502 | 502 | } |
503 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
503 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
504 | 504 | else unset($timediff); |
505 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
505 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']); |
|
506 | 506 | else unset($timediff_archive); |
507 | 507 | if ($this->tmd > 5 |
508 | 508 | || (isset($line['format_source']) |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | || ($timediff > 30 |
528 | 528 | && isset($this->all_flights[$id]['latitude']) |
529 | 529 | && isset($this->all_flights[$id]['longitude']) |
530 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
530 | + && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')) |
|
531 | 531 | ) |
532 | 532 | ) { |
533 | 533 | |
534 | 534 | if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) { |
535 | 535 | if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
536 | 536 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
537 | - || !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
537 | + || !$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
538 | 538 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
539 | 539 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
540 | 540 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | $timeelapsed = microtime(true); |
545 | 545 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
546 | 546 | $Spotter = new Spotter($this->db); |
547 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
547 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
548 | 548 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
549 | 549 | else $this->all_flights[$id]['over_country'] = ''; |
550 | 550 | $Spotter->db = null; |
551 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
551 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
552 | 552 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
553 | 553 | } |
554 | 554 | } |
@@ -574,13 +574,13 @@ discard block |
||
574 | 574 | $this->all_flights[$id]['time_last_coord'] = time(); |
575 | 575 | } |
576 | 576 | //if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
577 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
|
577 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.0001)) { |
|
578 | 578 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
579 | 579 | $dataFound = true; |
580 | 580 | $this->all_flights[$id]['time_last_coord'] = time(); |
581 | 581 | } |
582 | 582 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
583 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
583 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
584 | 584 | /* |
585 | 585 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
586 | 586 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -602,13 +602,13 @@ discard block |
||
602 | 602 | $this->all_flights[$id]['time_last_coord'] = time(); |
603 | 603 | } |
604 | 604 | //if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
605 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
|
605 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > 0.0001)) { |
|
606 | 606 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
607 | 607 | $dataFound = true; |
608 | 608 | $this->all_flights[$id]['time_last_coord'] = time(); |
609 | 609 | } |
610 | 610 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
611 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
611 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
612 | 612 | /* |
613 | 613 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
614 | 614 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -626,46 +626,46 @@ discard block |
||
626 | 626 | } else if ($globalDebug && $timediff > 30) { |
627 | 627 | $this->tmd = $this->tmd + 1; |
628 | 628 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
629 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
630 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
629 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
630 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
631 | 631 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
632 | 632 | } |
633 | 633 | } |
634 | 634 | if (isset($line['last_update']) && $line['last_update'] != '') { |
635 | 635 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
636 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
636 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
637 | 637 | } |
638 | 638 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
639 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
639 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
640 | 640 | //$dataFound = true; |
641 | 641 | } |
642 | 642 | if (isset($line['format_source']) && $line['format_source'] != '') { |
643 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
643 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
644 | 644 | } |
645 | 645 | if (isset($line['source_name']) && $line['source_name'] != '') { |
646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
647 | 647 | } |
648 | 648 | if (isset($line['emergency']) && $line['emergency'] != '') { |
649 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
649 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
650 | 650 | //$dataFound = true; |
651 | 651 | } |
652 | 652 | if (isset($line['ground']) && $line['ground'] != '') { |
653 | 653 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
654 | 654 | // Here we force archive of flight because after ground it's a new one (or should be) |
655 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
656 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
657 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
658 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
659 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
655 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
656 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
657 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
658 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
659 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
660 | 660 | } |
661 | 661 | if ($line['ground'] != 1) $line['ground'] = 0; |
662 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
662 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
663 | 663 | //$dataFound = true; |
664 | 664 | } |
665 | 665 | if (isset($line['squawk']) && $line['squawk'] != '') { |
666 | 666 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
667 | 667 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
668 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
668 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
669 | 669 | $highlight = ''; |
670 | 670 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
671 | 671 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -674,66 +674,66 @@ discard block |
||
674 | 674 | $timeelapsed = microtime(true); |
675 | 675 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
676 | 676 | $Spotter = new Spotter($this->db); |
677 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
677 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
678 | 678 | $Spotter->db = null; |
679 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
679 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
680 | 680 | } |
681 | 681 | //$putinarchive = true; |
682 | 682 | //$highlight = ''; |
683 | 683 | } |
684 | 684 | |
685 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
685 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
686 | 686 | //$dataFound = true; |
687 | 687 | } |
688 | 688 | |
689 | 689 | if (isset($line['altitude']) && $line['altitude'] != '') { |
690 | 690 | if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { |
691 | 691 | if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { |
692 | - $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2); |
|
692 | + $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2); |
|
693 | 693 | //if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n"; |
694 | 694 | $line['altitude'] = $line['altitude'] - $geoid; |
695 | 695 | } |
696 | 696 | } |
697 | 697 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
698 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
699 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
700 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
698 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
699 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
700 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
701 | 701 | //$dataFound = true; |
702 | 702 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
703 | 703 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
704 | 704 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
705 | 705 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
706 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
707 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
708 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
709 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
710 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
706 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
707 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
708 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
709 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
710 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
711 | 711 | } |
712 | 712 | } |
713 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
713 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude'])); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
717 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
717 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | if (isset($line['heading']) && $line['heading'] != '') { |
721 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
722 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
723 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
721 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
722 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
723 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
724 | 724 | //$dataFound = true; |
725 | 725 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
726 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
727 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
728 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
726 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
727 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
728 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
729 | 729 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
730 | 730 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
731 | 731 | // If not enough messages and ACARS set heading to 0 |
732 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
732 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
733 | 733 | } |
734 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
735 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
736 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
734 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
735 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
736 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
737 | 737 | |
738 | 738 | // print_r($this->all_flights[$id]); |
739 | 739 | //gets the callsign from the last hour |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
745 | 745 | $this->all_flights[$id]['lastupdate'] = time(); |
746 | 746 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
747 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
747 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
748 | 748 | //print_r($this->all_flights); |
749 | 749 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
750 | 750 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -755,61 +755,61 @@ discard block |
||
755 | 755 | $SpotterLive = new SpotterLive($this->db); |
756 | 756 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
757 | 757 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
758 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
758 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
759 | 759 | } elseif (isset($line['id'])) { |
760 | 760 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
761 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
761 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
762 | 762 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
763 | 763 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
764 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
764 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
765 | 765 | } else $recent_ident = ''; |
766 | - $SpotterLive->db=null; |
|
766 | + $SpotterLive->db = null; |
|
767 | 767 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
768 | 768 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
769 | 769 | } else $recent_ident = ''; |
770 | 770 | } else { |
771 | 771 | $recent_ident = ''; |
772 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
772 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
773 | 773 | } |
774 | 774 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
775 | - if($recent_ident == "") |
|
775 | + if ($recent_ident == "") |
|
776 | 776 | { |
777 | 777 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
778 | 778 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
779 | 779 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
780 | 780 | //adds the spotter data for the archive |
781 | 781 | $ignoreImport = false; |
782 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
782 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
783 | 783 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
784 | 784 | $ignoreImport = true; |
785 | 785 | } |
786 | 786 | } |
787 | 787 | if (count($globalAirportAccept) > 0) { |
788 | 788 | $ignoreImport = true; |
789 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
789 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
790 | 790 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
791 | 791 | $ignoreImport = false; |
792 | 792 | } |
793 | 793 | } |
794 | 794 | } |
795 | 795 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
796 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
797 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
796 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
797 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
798 | 798 | $ignoreImport = true; |
799 | 799 | } |
800 | 800 | } |
801 | 801 | } |
802 | 802 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
803 | 803 | $ignoreImport = true; |
804 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
805 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
804 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
805 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
806 | 806 | $ignoreImport = false; |
807 | 807 | } |
808 | 808 | } |
809 | 809 | } |
810 | 810 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
811 | 811 | $ignoreImport = true; |
812 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
812 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
813 | 813 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
814 | 814 | $ignoreImport = false; |
815 | 815 | } |
@@ -821,32 +821,32 @@ discard block |
||
821 | 821 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
822 | 822 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
823 | 823 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
824 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
824 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
825 | 825 | $timeelapsed = microtime(true); |
826 | 826 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
827 | 827 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
828 | 828 | $Spotter = new Spotter($this->db); |
829 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
829 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['source_type']); |
|
830 | 830 | $Spotter->db = null; |
831 | 831 | if ($globalDebug && isset($result)) echo $result."\n"; |
832 | 832 | } |
833 | 833 | } |
834 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
834 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
835 | 835 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
836 | 836 | |
837 | 837 | // Add source stat in DB |
838 | 838 | $Stats = new Stats($this->db); |
839 | 839 | if (!empty($this->stats)) { |
840 | 840 | if ($globalDebug) echo 'Add source stats : '; |
841 | - foreach($this->stats as $date => $data) { |
|
842 | - foreach($data as $source => $sourced) { |
|
841 | + foreach ($this->stats as $date => $data) { |
|
842 | + foreach ($data as $source => $sourced) { |
|
843 | 843 | //print_r($sourced); |
844 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
845 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
844 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
845 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
846 | 846 | if (isset($sourced['msg'])) { |
847 | 847 | if (time() - $sourced['msg']['date'] > 10) { |
848 | 848 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
849 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
849 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
850 | 850 | unset($this->stats[$date][$source]['msg']); |
851 | 851 | } |
852 | 852 | } |
@@ -884,14 +884,14 @@ discard block |
||
884 | 884 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
885 | 885 | $SpotterLive = new SpotterLive($this->db); |
886 | 886 | $SpotterLive->deleteLiveSpotterData(); |
887 | - $SpotterLive->db=null; |
|
887 | + $SpotterLive->db = null; |
|
888 | 888 | } |
889 | 889 | } |
890 | 890 | if ($globalDebug) echo " Done\n"; |
891 | 891 | $this->last_delete = time(); |
892 | 892 | } |
893 | 893 | } else { |
894 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
894 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
895 | 895 | $this->all_flights[$id]['id'] = $recent_ident; |
896 | 896 | $this->all_flights[$id]['addedSpotter'] = 1; |
897 | 897 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
900 | 900 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
901 | 901 | $Spotter = new Spotter($this->db); |
902 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
902 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
903 | 903 | $Spotter->db = null; |
904 | 904 | } |
905 | 905 | } |
@@ -925,37 +925,37 @@ discard block |
||
925 | 925 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
926 | 926 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
927 | 927 | |
928 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
928 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
929 | 929 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
930 | 930 | $ignoreImport = true; |
931 | 931 | } |
932 | 932 | } |
933 | 933 | if (count($globalAirportAccept) > 0) { |
934 | 934 | $ignoreImport = true; |
935 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
935 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
936 | 936 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
937 | 937 | $ignoreImport = false; |
938 | 938 | } |
939 | 939 | } |
940 | 940 | } |
941 | 941 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
942 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
943 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
942 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
943 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
944 | 944 | $ignoreImport = true; |
945 | 945 | } |
946 | 946 | } |
947 | 947 | } |
948 | 948 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
949 | 949 | $ignoreImport = true; |
950 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
951 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
950 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
951 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
952 | 952 | $ignoreImport = false; |
953 | 953 | } |
954 | 954 | } |
955 | 955 | } |
956 | 956 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
957 | 957 | $ignoreImport = true; |
958 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
958 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
959 | 959 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
960 | 960 | $ignoreImport = false; |
961 | 961 | } |
@@ -963,23 +963,23 @@ discard block |
||
963 | 963 | } |
964 | 964 | |
965 | 965 | if (!$ignoreImport) { |
966 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
967 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
966 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
967 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
968 | 968 | $timeelapsed = microtime(true); |
969 | 969 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
970 | 970 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
971 | 971 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
972 | 972 | $SpotterLive = new SpotterLive($this->db); |
973 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
973 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
974 | 974 | $SpotterLive->db = null; |
975 | 975 | if ($globalDebug) echo $result."\n"; |
976 | 976 | } |
977 | 977 | } |
978 | 978 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
979 | - $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
979 | + $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
980 | 980 | } |
981 | 981 | $this->all_flights[$id]['putinarchive'] = false; |
982 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
982 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
983 | 983 | |
984 | 984 | // Put statistics in $this->stats variable |
985 | 985 | //if ($line['format_source'] != 'aprs') { |
@@ -998,19 +998,19 @@ discard block |
||
998 | 998 | $latitude = $globalCenterLatitude; |
999 | 999 | $longitude = $globalCenterLongitude; |
1000 | 1000 | } |
1001 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
1001 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
1002 | 1002 | } else { |
1003 | 1003 | $latitude = $this->source_location[$source]['latitude']; |
1004 | 1004 | $longitude = $this->source_location[$source]['longitude']; |
1005 | 1005 | } |
1006 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1006 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1007 | 1007 | //$stats_heading = $stats_heading%22.5; |
1008 | 1008 | $stats_heading = round($stats_heading/22.5); |
1009 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1009 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1010 | 1010 | $current_date = date('Y-m-d'); |
1011 | 1011 | if ($stats_heading == 16) $stats_heading = 0; |
1012 | 1012 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1013 | - for ($i=0;$i<=15;$i++) { |
|
1013 | + for ($i = 0; $i <= 15; $i++) { |
|
1014 | 1014 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
1015 | 1015 | } |
1016 | 1016 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
1026 | 1026 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1027 | 1027 | end($this->stats[$current_date][$source]['hist']); |
1028 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1028 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
1029 | 1029 | } else $mini = 0; |
1030 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
1030 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
1031 | 1031 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
1032 | 1032 | } |
1033 | 1033 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | $this->all_flights[$id]['lastupdate'] = time(); |
1041 | 1041 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
1042 | 1042 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
1043 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
1043 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
1044 | 1044 | //$this->del(); |
1045 | 1045 | |
1046 | 1046 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @param String $arrival_airport_time arrival airport time |
37 | 37 | / @param String $source source of data |
38 | 38 | */ |
39 | - public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') { |
|
39 | + public function addSchedule($ident, $departure_airport_icao, $departure_airport_time, $arrival_airport_icao, $arrival_airport_time, $source = 'website') { |
|
40 | 40 | date_default_timezone_set('UTC'); |
41 | - $date = date("Y-m-d H:i:s",time()); |
|
41 | + $date = date("Y-m-d H:i:s", time()); |
|
42 | 42 | //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
43 | 43 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
44 | 44 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
@@ -46,69 +46,69 @@ discard block |
||
46 | 46 | try { |
47 | 47 | $sth = $this->db->prepare($query); |
48 | 48 | $sth->execute($query_values); |
49 | - } catch(PDOException $e) { |
|
49 | + } catch (PDOException $e) { |
|
50 | 50 | return "error : ".$e->getMessage(); |
51 | 51 | } |
52 | 52 | if ($sth->fetchColumn() > 0) { |
53 | 53 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
54 | 54 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
55 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
55 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao); |
|
56 | 56 | } elseif ($arrival_airport_time == '') { |
57 | 57 | $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"; |
58 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
|
58 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao); |
|
59 | 59 | } elseif ($departure_airport_time == '') { |
60 | 60 | $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"; |
61 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
61 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time); |
|
62 | 62 | } else { |
63 | 63 | //$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"; |
64 | 64 | $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"; |
65 | - $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); |
|
65 | + $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); |
|
66 | 66 | } |
67 | 67 | try { |
68 | 68 | $sth = $this->db->prepare($query); |
69 | 69 | $sth->execute($query_values); |
70 | - } catch(PDOException $e) { |
|
70 | + } catch (PDOException $e) { |
|
71 | 71 | return "error : ".$e->getMessage(); |
72 | 72 | } |
73 | 73 | if ($sth->fetchColumn() == 0) { |
74 | 74 | //$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'; |
75 | 75 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
76 | 76 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
77 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
77 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
78 | 78 | } elseif ($arrival_airport_time == '') { |
79 | 79 | $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'; |
80 | - $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); |
|
80 | + $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); |
|
81 | 81 | } elseif ($departure_airport_time == '') { |
82 | 82 | $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'; |
83 | - $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); |
|
83 | + $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); |
|
84 | 84 | } else { |
85 | 85 | $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'; |
86 | - $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); |
|
86 | + $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); |
|
87 | 87 | } |
88 | 88 | try { |
89 | 89 | $sth = $this->db->prepare($query); |
90 | 90 | $sth->execute($query_values); |
91 | - } catch(PDOException $e) { |
|
91 | + } catch (PDOException $e) { |
|
92 | 92 | return "error : ".$e->getMessage(); |
93 | 93 | } |
94 | 94 | } else { |
95 | 95 | //$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident'; |
96 | 96 | $query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident'; |
97 | - $query_values = array(':ident' => $ident,':date' => $date); |
|
97 | + $query_values = array(':ident' => $ident, ':date' => $date); |
|
98 | 98 | try { |
99 | 99 | $sth = $this->db->prepare($query); |
100 | 100 | $sth->execute($query_values); |
101 | - } catch(PDOException $e) { |
|
101 | + } catch (PDOException $e) { |
|
102 | 102 | return "error : ".$e->getMessage(); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | } else { |
106 | 106 | $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)'; |
107 | - $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); |
|
107 | + $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); |
|
108 | 108 | try { |
109 | 109 | $sth = $this->db->prepare($query); |
110 | 110 | $sth->execute($query_values); |
111 | - } catch(PDOException $e) { |
|
111 | + } catch (PDOException $e) { |
|
112 | 112 | return "error : ".$e->getMessage(); |
113 | 113 | } |
114 | 114 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getSchedule($ident) { |
123 | 123 | $Translation = new Translation($this->db); |
124 | - $operator = $Translation->checkTranslation($ident,false); |
|
124 | + $operator = $Translation->checkTranslation($ident, false); |
|
125 | 125 | if ($ident != $operator) { |
126 | 126 | $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"; |
127 | - $query_values = array(':ident' => $ident,'operator' => $operator); |
|
127 | + $query_values = array(':ident' => $ident, 'operator' => $operator); |
|
128 | 128 | } else { |
129 | 129 | $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"; |
130 | 130 | $query_values = array(':ident' => $ident); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | try { |
133 | 133 | $sth = $this->db->prepare($query); |
134 | 134 | $sth->execute($query_values); |
135 | - } catch(PDOException $e) { |
|
135 | + } catch (PDOException $e) { |
|
136 | 136 | return "error : ".$e->getMessage(); |
137 | 137 | } |
138 | 138 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | try { |
162 | 162 | $sth = $this->db->prepare($query); |
163 | 163 | $sth->execute($query_values); |
164 | - } catch(PDOException $e) { |
|
164 | + } catch (PDOException $e) { |
|
165 | 165 | return "error : ".$e->getMessage(); |
166 | 166 | } |
167 | 167 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -176,16 +176,16 @@ discard block |
||
176 | 176 | * @param String $carrier IATA code |
177 | 177 | * @return Flight departure and arrival airports and time |
178 | 178 | */ |
179 | - public function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') { |
|
179 | + public function getAirFrance($callsign, $date = 'NOW', $carrier = 'AF') { |
|
180 | 180 | $Common = new Common(); |
181 | 181 | $check_date = new Datetime($date); |
182 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
183 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
182 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
183 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
184 | 184 | $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'); |
185 | 185 | $json = $Common->getData($url); |
186 | 186 | var_dump($json); |
187 | 187 | $parsed_json = json_decode($json); |
188 | - if (property_exists($parsed_json,'errors') === false) { |
|
188 | + if (property_exists($parsed_json, 'errors') === false) { |
|
189 | 189 | //$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'}; |
190 | 190 | $originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'}; |
191 | 191 | //$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'}; |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | //$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'}; |
196 | 196 | $arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'}; |
197 | 197 | |
198 | - preg_match('/\((.*?)\)/',$originShort,$originiata); |
|
198 | + preg_match('/\((.*?)\)/', $originShort, $originiata); |
|
199 | 199 | $DepartureAirportIata = $originiata[1]; |
200 | - preg_match('/\((.*?)\)/',$destinationShort,$destinationiata); |
|
200 | + preg_match('/\((.*?)\)/', $destinationShort, $destinationiata); |
|
201 | 201 | $ArrivalAirportIata = $destinationiata[1]; |
202 | 202 | |
203 | 203 | /* |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $arrivalTime = gmdate('H:i',strtotime($arrivalTime)); |
207 | 207 | */ |
208 | 208 | |
209 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance'); |
|
209 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airfrance'); |
|
210 | 210 | } else return array(); |
211 | 211 | } |
212 | 212 | |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | $Common = new Common(); |
222 | 222 | date_default_timezone_set($globalTimezone); |
223 | 223 | $check_date = new Datetime($date); |
224 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
225 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
224 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
225 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
226 | 226 | $url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign; |
227 | 227 | $json = $Common->getData($url); |
228 | 228 | $parsed_json = json_decode($json); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'}; |
235 | 235 | $arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'}; |
236 | 236 | |
237 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet'); |
|
237 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_easyjet'); |
|
238 | 238 | } else return array(); |
239 | 239 | } |
240 | 240 | |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | */ |
246 | 246 | private function getRyanair($callsign) { |
247 | 247 | $Common = new Common(); |
248 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
249 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
248 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
249 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
250 | 250 | $url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/"; |
251 | 251 | $post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}'; |
252 | - $headers = array('Content-Type: application/json','Content-Length: ' . strlen($post)); |
|
253 | - $json = $Common->getData($url,'post',$post,$headers); |
|
252 | + $headers = array('Content-Type: application/json', 'Content-Length: '.strlen($post)); |
|
253 | + $json = $Common->getData($url, 'post', $post, $headers); |
|
254 | 254 | $parsed_json = json_decode($json); |
255 | 255 | if (isset($parsed_json->{'flightInfo'})) { |
256 | 256 | $flights = $parsed_json->{'flightInfo'}; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name |
260 | 260 | $departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'}; |
261 | 261 | $arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'}; |
262 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
262 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
263 | 263 | } else return array(); |
264 | 264 | } else return array(); |
265 | 265 | } |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | */ |
272 | 272 | private function getSwiss($callsign) { |
273 | 273 | $Common = new Common(); |
274 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
275 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
274 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
275 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
276 | 276 | $url = "http://www.world-of-swiss.com/fr/routenetwork.json"; |
277 | 277 | $json = $Common->getData($url); |
278 | 278 | $parsed_json = json_decode($json); |
@@ -286,12 +286,12 @@ discard block |
||
286 | 286 | if ($flight->{'no'} == "Vol LX ".$numvol) { |
287 | 287 | $DepartureAirportIata = $flight->{'from'}->{'code'}; //city |
288 | 288 | $ArrivalAirportIata = $flight->{'to'}->{'code'}; //city |
289 | - $departureTime = substr($flight->{'from'}->{'hour'},0,5); |
|
290 | - $arrivalTime = substr($flight->{'to'}->{'hour'},0,5); |
|
289 | + $departureTime = substr($flight->{'from'}->{'hour'},0, 5); |
|
290 | + $arrivalTime = substr($flight->{'to'}->{'hour'},0, 5); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) { |
294 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss'); |
|
294 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_swiss'); |
|
295 | 295 | } else return array(); |
296 | 296 | } else return array(); |
297 | 297 | } |
@@ -306,21 +306,21 @@ discard block |
||
306 | 306 | global $globalBritishAirwaysKey; |
307 | 307 | $Common = new Common(); |
308 | 308 | $check_date = new Datetime($date); |
309 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
310 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
309 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
310 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
311 | 311 | if ($globalBritishAirwaysKey == '') return array(); |
312 | 312 | $url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json"; |
313 | 313 | $headers = array('Client-Key: '.$globalBritishAirwaysKey); |
314 | - $json = $Common->getData($url,'get','',$headers); |
|
314 | + $json = $Common->getData($url, 'get', '', $headers); |
|
315 | 315 | if ($json == '') return array(); |
316 | 316 | $parsed_json = json_decode($json); |
317 | 317 | $flights = $parsed_json->{'FlightsResponse'}; |
318 | 318 | if (count($flights) > 0) { |
319 | 319 | $DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'}; |
320 | 320 | $ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'}; |
321 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
322 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
323 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways'); |
|
321 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
322 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
323 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_britishairways'); |
|
324 | 324 | } else return array(); |
325 | 325 | } |
326 | 326 | |
@@ -334,27 +334,27 @@ discard block |
||
334 | 334 | global $globalLufthansaKey; |
335 | 335 | $Common = new Common(); |
336 | 336 | $check_date = new Datetime($date); |
337 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
338 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
337 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
338 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
339 | 339 | if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array(); |
340 | 340 | $url = "https://api.lufthansa.com/v1/oauth/token"; |
341 | - $post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials'); |
|
342 | - $data = $Common->getData($url,'post',$post); |
|
341 | + $post = array('client_id' => $globalLufthansaKey['key'], 'client_secret' => $globalLufthansaKey['secret'], 'grant_type' => 'client_credentials'); |
|
342 | + $data = $Common->getData($url, 'post', $post); |
|
343 | 343 | $parsed_data = json_decode($data); |
344 | 344 | if (!isset($parsed_data->{'access_token'})) return array(); |
345 | 345 | $token = $parsed_data->{'access_token'}; |
346 | 346 | |
347 | 347 | $url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d'); |
348 | - $headers = array('Authorization: Bearer '.$token,'Accept: application/json'); |
|
349 | - $json = $Common->getData($url,'get','',$headers); |
|
348 | + $headers = array('Authorization: Bearer '.$token, 'Accept: application/json'); |
|
349 | + $json = $Common->getData($url, 'get', '', $headers); |
|
350 | 350 | if ($json == '') return array(); |
351 | 351 | $parsed_json = json_decode($json); |
352 | 352 | if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) { |
353 | 353 | $DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'}; |
354 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
354 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
355 | 355 | $ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'}; |
356 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
357 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa'); |
|
356 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
357 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_lufthansa'); |
|
358 | 358 | } else return array(); |
359 | 359 | } |
360 | 360 | |
@@ -368,23 +368,23 @@ discard block |
||
368 | 368 | global $globalTransaviaKey; |
369 | 369 | $Common = new Common(); |
370 | 370 | $check_date = new Datetime($date); |
371 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
372 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
371 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
372 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
373 | 373 | if ($globalTransaviaKey == '') return array(); |
374 | 374 | $url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
375 | 375 | //$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
376 | 376 | $headers = array('apikey: '.$globalTransaviaKey); |
377 | - $json = $Common->getData($url,'get','',$headers); |
|
377 | + $json = $Common->getData($url, 'get', '', $headers); |
|
378 | 378 | //echo 'result : '.$json; |
379 | 379 | if ($json == '') return array(); |
380 | 380 | $parsed_json = json_decode($json); |
381 | 381 | |
382 | 382 | if (isset($parsed_json->{'data'}[0])) { |
383 | 383 | $DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'}; |
384 | - $departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
384 | + $departureTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
385 | 385 | $ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'}; |
386 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
387 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia'); |
|
386 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
387 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_transavia'); |
|
388 | 388 | } else return array(); |
389 | 389 | } |
390 | 390 | |
@@ -395,14 +395,14 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function getTunisair($callsign) { |
397 | 397 | $Common = new Common(); |
398 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
399 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
398 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
399 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
400 | 400 | $url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp"; |
401 | 401 | $data = $Common->getData($url); |
402 | 402 | $table = $Common->table2array($data); |
403 | 403 | foreach ($table as $flight) { |
404 | - if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) { |
|
405 | - return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair'); |
|
404 | + if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d', $numvol)) { |
|
405 | + return array('DepartureAirportIATA' => $flight[2], 'DepartureTime' => str_replace('.', ':', $flight[5]), 'ArrivalAirportIATA' => $flight[3], 'ArrivalTime' => str_replace('.', ':', $flight[6]), 'Source' => 'website_tunisair'); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | return array(); |
@@ -413,21 +413,21 @@ discard block |
||
413 | 413 | * @param String $callsign The callsign |
414 | 414 | * @return Flight departure and arrival airports and time |
415 | 415 | */ |
416 | - public function getVueling($callsign,$date = 'NOW') { |
|
416 | + public function getVueling($callsign, $date = 'NOW') { |
|
417 | 417 | $Common = new Common(); |
418 | 418 | $check_date = new Datetime($date); |
419 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
420 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
421 | - $final_date = str_replace('/','%2F',$check_date->format('d/m/Y')); |
|
419 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
420 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
421 | + $final_date = str_replace('/', '%2F', $check_date->format('d/m/Y')); |
|
422 | 422 | $url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB"; |
423 | 423 | $data = $Common->getData($url); |
424 | - $data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data)); |
|
424 | + $data = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $data)); |
|
425 | 425 | if ($data != '') { |
426 | - preg_match('/flightOri=[A-Z]{3}/',$data,$result); |
|
427 | - $DepartureAirportIata = str_replace('flightOri=','',$result[0]); |
|
428 | - preg_match('/flightDest=[A-Z]{3}/',$data,$result); |
|
429 | - $ArrivalAirportIata = str_replace('flightDest=','',$result[0]); |
|
430 | - if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling'); |
|
426 | + preg_match('/flightOri=[A-Z]{3}/', $data, $result); |
|
427 | + $DepartureAirportIata = str_replace('flightOri=', '', $result[0]); |
|
428 | + preg_match('/flightDest=[A-Z]{3}/', $data, $result); |
|
429 | + $ArrivalAirportIata = str_replace('flightDest=', '', $result[0]); |
|
430 | + if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'Source' => 'website_vueling'); |
|
431 | 431 | else return array(); |
432 | 432 | } |
433 | 433 | return array(); |
@@ -441,27 +441,27 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function getIberia($callsign, $date = 'NOW') { |
443 | 443 | $Common = new Common(); |
444 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
444 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
445 | 445 | $check_date = new Datetime($date); |
446 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
446 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
447 | 447 | $url = "https://www.iberia.com/web/flightDetail.do"; |
448 | - $post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB'); |
|
449 | - $data = $Common->getData($url,'post',$post); |
|
448 | + $post = array('numvuelo' => $numvol, 'fecha' => $check_date->format('Ymd'), 'airlineID' => 'IB'); |
|
449 | + $data = $Common->getData($url, 'post', $post); |
|
450 | 450 | if ($data != '') { |
451 | 451 | $table = $Common->table2array($data); |
452 | 452 | //print_r($table); |
453 | 453 | if (count($table) > 0) { |
454 | 454 | $flight = $table; |
455 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
456 | - preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch); |
|
455 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
456 | + preg_match('/([A-Z]{3})/', $flight[5][0], $ArrivalAirportIataMatch); |
|
457 | 457 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
458 | 458 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
459 | - $departureTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[3][2]))),0,5); |
|
460 | - $arrivalTime = trim(str_replace(' lunes','',str_replace(' ','',$flight[5][1]))); |
|
459 | + $departureTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[3][2]))), 0, 5); |
|
460 | + $arrivalTime = trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][1]))); |
|
461 | 461 | if ($arrivalTime == 'Hora estimada de llegada') { |
462 | - $arrivalTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[5][2]))),0,5); |
|
463 | - } else $arrivalTime = substr($arrivalTime,0,5); |
|
464 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia'); |
|
462 | + $arrivalTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][2]))), 0, 5); |
|
463 | + } else $arrivalTime = substr($arrivalTime, 0, 5); |
|
464 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_iberia'); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | return array(); |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | * @return Flight departure and arrival airports and time |
475 | 475 | */ |
476 | 476 | |
477 | - private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') { |
|
477 | + private function getStarAlliance($callsign, $date = 'NOW', $carrier = '') { |
|
478 | 478 | $Common = new Common(); |
479 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
479 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
480 | 480 | $check_date = new Datetime($date); |
481 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
481 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
482 | 482 | $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'); |
483 | 483 | $data = $Common->getData($url); |
484 | 484 | if ($data != '') { |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | $flight = $table; |
488 | 488 | //print_r($table); |
489 | 489 | if (isset($flight[25]) && isset($flight[29])) { |
490 | - preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch); |
|
491 | - preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch); |
|
490 | + preg_match('/([A-Z]{3})/', $flight[25][1], $DepartureAirportIataMatch); |
|
491 | + preg_match('/([A-Z]{3})/', $flight[25][3], $ArrivalAirportIataMatch); |
|
492 | 492 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
493 | 493 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
494 | - $departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5); |
|
495 | - $arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5); |
|
496 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance'); |
|
494 | + $departureTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][0])), 0, 5); |
|
495 | + $arrivalTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][1])), 0, 5); |
|
496 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_staralliance'); |
|
497 | 497 | } else return array(); |
498 | 498 | } |
499 | 499 | |
@@ -511,10 +511,10 @@ discard block |
||
511 | 511 | */ |
512 | 512 | private function getAlitalia($callsign, $date = 'NOW') { |
513 | 513 | $Common = new Common(); |
514 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
514 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
515 | 515 | $check_date = new Datetime($date); |
516 | - $url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
517 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
516 | + $url = "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
517 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
518 | 518 | $data = $Common->getData($url); |
519 | 519 | if ($data != '') { |
520 | 520 | $table = $Common->text2array($data); |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | $ArrivalAirportIata = ''; |
523 | 523 | $departureTime = $table[4]; |
524 | 524 | $arrivalTime = $table[5]; |
525 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia'); |
|
525 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_alitalia'); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -534,21 +534,21 @@ discard block |
||
534 | 534 | */ |
535 | 535 | private function getBrussels($callsign, $date = 'NOW') { |
536 | 536 | $Common = new Common(); |
537 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
537 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
538 | 538 | $check_date = new Datetime($date); |
539 | - $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"; |
|
539 | + $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"; |
|
540 | 540 | //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"; |
541 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
541 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
542 | 542 | $data = $Common->getData($url); |
543 | 543 | if ($data != '') { |
544 | 544 | //echo $data; |
545 | - $parsed_json = json_decode($data,true); |
|
545 | + $parsed_json = json_decode($data, true); |
|
546 | 546 | if (isset($parsed_json[0]['FromAirportCode'])) { |
547 | 547 | $DepartureAirportIata = $parsed_json[0]['FromAirportCode']; |
548 | 548 | $ArrivalAirportIata = $parsed_json[0]['ToAirportCode']; |
549 | - $departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
550 | - $arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
551 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels'); |
|
549 | + $departureTime = date('H:i', strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
550 | + $arrivalTime = date('H:i', strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
551 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_brussels'); |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | } |
@@ -625,21 +625,21 @@ discard block |
||
625 | 625 | */ |
626 | 626 | private function getFlyTap($callsign) { |
627 | 627 | $Common = new Common(); |
628 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
629 | - $url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
628 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
629 | + $url = "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
630 | 630 | //$check_date = new Datetime($date); |
631 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
632 | - $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'); |
|
633 | - $data = $Common->getData($url,'post',$post); |
|
631 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
632 | + $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'); |
|
633 | + $data = $Common->getData($url, 'post', $post); |
|
634 | 634 | if ($data != '') { |
635 | 635 | $table = $Common->table2array($data); |
636 | - $departureTime = trim(substr($table[15][0],0,5)); |
|
637 | - $arrivalTime = trim(substr($table[35][0],0,5)); |
|
638 | - preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch); |
|
639 | - preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch); |
|
636 | + $departureTime = trim(substr($table[15][0], 0, 5)); |
|
637 | + $arrivalTime = trim(substr($table[35][0], 0, 5)); |
|
638 | + preg_match('/([A-Z]{3})/', $table[11][0], $DepartureAirportIataMatch); |
|
639 | + preg_match('/([A-Z]{3})/', $table[31][0], $ArrivalAirportIataMatch); |
|
640 | 640 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
641 | 641 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
642 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap'); |
|
642 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flytap'); |
|
643 | 643 | } |
644 | 644 | return array(); |
645 | 645 | } |
@@ -661,10 +661,10 @@ discard block |
||
661 | 661 | } |
662 | 662 | } |
663 | 663 | if ($airline_icao == '') return array(); |
664 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
665 | - $url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
664 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
665 | + $url = "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
666 | 666 | //$check_date = new Datetime($date); |
667 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
667 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
668 | 668 | $data = $Common->getData($url); |
669 | 669 | if ($data != '') { |
670 | 670 | $table = $Common->table2array($data); |
@@ -674,13 +674,13 @@ discard block |
||
674 | 674 | $darr = ''; |
675 | 675 | $ahour = ''; |
676 | 676 | $aarr = ''; |
677 | - $n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr); |
|
677 | + $n = sscanf($sched, '%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])', $dhour, $darr, $ahour, $aarr); |
|
678 | 678 | if ($n == 7) { |
679 | 679 | $departureTime = $dhour; |
680 | 680 | $arrivalTime = $ahour; |
681 | - $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
682 | - $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
683 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
681 | + $DepartureAirportIata = str_replace(array('(', ')'), '', $darr); |
|
682 | + $ArrivalAirportIata = str_replace(array('(', ')'), '', $aarr); |
|
683 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightmapper'); |
|
684 | 684 | } |
685 | 685 | } |
686 | 686 | } |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $url = 'http://'.$globalFlightAwareUsername.':'.$globalFlightAwarePassword.'@flightxml.flightaware.com/json/FlightXML3/FlightInfoStatus?ident='.$callsign; |
713 | 713 | $data = $Common->getData($url); |
714 | 714 | if ($data != '') { |
715 | - $result = json_decode($data,true); |
|
715 | + $result = json_decode($data, true); |
|
716 | 716 | $flight = $result['FlightInfoStatusResult']['flights'][0]; |
717 | 717 | if (isset($flight['origin'])) { |
718 | 718 | return array( |
@@ -725,18 +725,18 @@ discard block |
||
725 | 725 | } |
726 | 726 | } |
727 | 727 | |
728 | - $url= "http://flightaware.com/live/flight/".$callsign; |
|
728 | + $url = "http://flightaware.com/live/flight/".$callsign; |
|
729 | 729 | $data = $Common->getData($url); |
730 | 730 | if ($data != '') { |
731 | - preg_match(':<script>var trackpollBootstrap = (.*?);</script>:',$data,$result); |
|
732 | - $flights = json_decode($result[1],true); |
|
731 | + preg_match(':<script>var trackpollBootstrap = (.*?);</script>:', $data, $result); |
|
732 | + $flights = json_decode($result[1], true); |
|
733 | 733 | $flight = reset($flights['flights']); |
734 | 734 | if (isset($flight['activityLog']['flights'][0]['origin'])) { |
735 | 735 | return array( |
736 | 736 | 'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'], |
737 | - 'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']), |
|
737 | + 'DepartureTime' => date('H:i', $flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']), |
|
738 | 738 | 'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'], |
739 | - 'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']), |
|
739 | + 'ArrivalTime' => date('H:i', $flight['activityLog']['flights'][0]['landingTimes']['scheduled']), |
|
740 | 740 | 'Source' => 'website_flightaware'); |
741 | 741 | } |
742 | 742 | } |
@@ -750,20 +750,20 @@ discard block |
||
750 | 750 | */ |
751 | 751 | public function getCostToTravel($callsign) { |
752 | 752 | $Common = new Common(); |
753 | - $url= "http://www.costtotravel.com/flight-number/".$callsign; |
|
753 | + $url = "http://www.costtotravel.com/flight-number/".$callsign; |
|
754 | 754 | //$check_date = new Datetime($date); |
755 | 755 | //if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
756 | 756 | $data = $Common->getData($url); |
757 | 757 | if ($data != '') { |
758 | 758 | $table = $Common->table2array($data); |
759 | 759 | if (isset($table[11][1])) { |
760 | - if (is_numeric(substr($table[11][1],0,1))) $departureTime = substr($table[11][1],0,5); |
|
760 | + if (is_numeric(substr($table[11][1], 0, 1))) $departureTime = substr($table[11][1], 0, 5); |
|
761 | 761 | else $departureTime = ''; |
762 | - if (is_numeric(substr($table[17][1],0,1))) $arrivalTime = substr($table[17][1],0,5); |
|
762 | + if (is_numeric(substr($table[17][1], 0, 1))) $arrivalTime = substr($table[17][1], 0, 5); |
|
763 | 763 | else $arrivalTime = ''; |
764 | - $DepartureAirportIata = substr($table[13][1],0,3); |
|
765 | - $ArrivalAirportIata = substr($table[15][1],0,3); |
|
766 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel'); |
|
764 | + $DepartureAirportIata = substr($table[13][1], 0, 3); |
|
765 | + $ArrivalAirportIata = substr($table[15][1], 0, 3); |
|
766 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_costtotravel'); |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | return array(); |
@@ -775,14 +775,14 @@ discard block |
||
775 | 775 | * @param String $date date we want flight number info |
776 | 776 | * @return Flight departure and arrival airports and time |
777 | 777 | */ |
778 | - private function getAirCanada($callsign,$date = 'NOW') { |
|
778 | + private function getAirCanada($callsign, $date = 'NOW') { |
|
779 | 779 | $Common = new Common(); |
780 | 780 | if (class_exists("DomDocument") === FALSE) return array(); |
781 | 781 | date_default_timezone_set('UTC'); |
782 | 782 | $check_date = new Datetime($date); |
783 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
784 | - $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"; |
|
785 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
783 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
784 | + $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"; |
|
785 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
786 | 786 | $data = $Common->getData($url); |
787 | 787 | $dom = new DomDocument(); |
788 | 788 | $dom->loadXML($data); |
@@ -790,11 +790,11 @@ discard block |
||
790 | 790 | $departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0); |
791 | 791 | if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) { |
792 | 792 | $DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
793 | - $departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
793 | + $departureTime = date('H:i', strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
794 | 794 | $arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0); |
795 | 795 | $ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
796 | - $arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
797 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada'); |
|
796 | + $arrivalTime = date('H:i', strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
797 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_aircanada'); |
|
798 | 798 | } else return array(); |
799 | 799 | } |
800 | 800 | |
@@ -806,21 +806,21 @@ discard block |
||
806 | 806 | */ |
807 | 807 | private function getVietnamAirlines($callsign, $date = 'NOW') { |
808 | 808 | $Common = new Common(); |
809 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
809 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
810 | 810 | $check_date = new Datetime($date); |
811 | - $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."&"; |
|
812 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
811 | + $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."&"; |
|
812 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
813 | 813 | $data = $Common->getData($url); |
814 | 814 | if ($data != '') { |
815 | 815 | $table = $Common->table2array($data); |
816 | 816 | $flight = $table; |
817 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
818 | - preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch); |
|
817 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
818 | + preg_match('/([A-Z]{3})/', $flight[21][0], $ArrivalAirportIataMatch); |
|
819 | 819 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
820 | 820 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
821 | 821 | $departureTime = $flight[5][1]; |
822 | 822 | $arrivalTime = $flight[23][1]; |
823 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines'); |
|
823 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_vietnamairlines'); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
@@ -831,16 +831,16 @@ discard block |
||
831 | 831 | * @param String $carrier airline code |
832 | 832 | * @return Flight departure and arrival airports and time |
833 | 833 | */ |
834 | - private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') { |
|
834 | + private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') { |
|
835 | 835 | $Common = new Common(); |
836 | 836 | date_default_timezone_set('UTC'); |
837 | 837 | //AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair |
838 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
838 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
839 | 839 | $check_date = new Datetime($date); |
840 | - $url= "http://www.airberlin.com/en-US/site/aims.php"; |
|
841 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
842 | - $post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier); |
|
843 | - $data = $Common->getData($url,'post',$post); |
|
840 | + $url = "http://www.airberlin.com/en-US/site/aims.php"; |
|
841 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
842 | + $post = array('type' => 'departure', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => $carrier); |
|
843 | + $data = $Common->getData($url, 'post', $post); |
|
844 | 844 | //echo $data; |
845 | 845 | $DepartureAirportIata = ''; |
846 | 846 | $ArrivalAirportIata = ''; |
@@ -853,8 +853,8 @@ discard block |
||
853 | 853 | if (isset($flight[5][2])) $departureAirport = $flight[5][2]; |
854 | 854 | else $departureAirport = ''; |
855 | 855 | } else return array(); |
856 | - $post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB'); |
|
857 | - $data = $Common->getData($url,'post',$post); |
|
856 | + $post = array('type' => 'arrival', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => 'AB'); |
|
857 | + $data = $Common->getData($url, 'post', $post); |
|
858 | 858 | if ($data != '') { |
859 | 859 | $table = $Common->table2array($data); |
860 | 860 | $flight = $table; |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | } |
883 | 883 | } |
884 | 884 | if (isset($DepartureAirportIata)) { |
885 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin'); |
|
885 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airberlin'); |
|
886 | 886 | } else return array(); |
887 | 887 | } |
888 | 888 | |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | * @param String $date Date |
893 | 893 | * @return Array Schedules info |
894 | 894 | */ |
895 | - public function fetchSchedule($ident,$date = 'NOW') { |
|
895 | + public function fetchSchedule($ident, $date = 'NOW') { |
|
896 | 896 | global $globalSchedulesSources, $globalSchedulesFetch, $globalOffline, $globalFlightAwareUsername; |
897 | 897 | //$Common = new Common(); |
898 | 898 | if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) return array(); |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | // Brussels Airlines |
963 | 963 | case "BEL": |
964 | 964 | case "SN": |
965 | - return $this->getBrussels($ident,$date); |
|
965 | + return $this->getBrussels($ident, $date); |
|
966 | 966 | /* |
967 | 967 | // Copa Airlines |
968 | 968 | case "CMP": |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | case "DS": |
1062 | 1062 | case "EZY": |
1063 | 1063 | case "EZS": |
1064 | - return $this->getEasyJet($ident,$date); |
|
1064 | + return $this->getEasyJet($ident, $date); |
|
1065 | 1065 | // Ryanair |
1066 | 1066 | case "FR": |
1067 | 1067 | case "RYR": |
@@ -1113,19 +1113,19 @@ discard block |
||
1113 | 1113 | return $this->getIberia($ident); |
1114 | 1114 | // Vietnam Airlines |
1115 | 1115 | case "HVN": |
1116 | - return $this->getVietnamAirlines($ident,$date); |
|
1116 | + return $this->getVietnamAirlines($ident, $date); |
|
1117 | 1117 | // Air Berlin |
1118 | 1118 | case "AB": |
1119 | 1119 | case "BER": |
1120 | - return $this->getAirBerlin($ident,$date,'AB'); |
|
1120 | + return $this->getAirBerlin($ident, $date, 'AB'); |
|
1121 | 1121 | // NIKI |
1122 | 1122 | case "HG": |
1123 | 1123 | case "NLY": |
1124 | - return $this->getAirBerlin($ident,$date,'HG'); |
|
1124 | + return $this->getAirBerlin($ident, $date, 'HG'); |
|
1125 | 1125 | // BelAir |
1126 | 1126 | case "4T": |
1127 | 1127 | case "BHP": |
1128 | - return $this->getAirBerlin($ident,$date,'4T'); |
|
1128 | + return $this->getAirBerlin($ident, $date, '4T'); |
|
1129 | 1129 | default: |
1130 | 1130 | if (strlen($airline_icao) == 3) { |
1131 | 1131 | $Spotter = new Spotter($this->db); |
@@ -1134,9 +1134,9 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | // Randomly use a generic function to get hours |
1136 | 1136 | if (strlen($airline_icao) == 2) { |
1137 | - if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightaware'); |
|
1137 | + if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightaware'); |
|
1138 | 1138 | if (count($globalSchedulesSources) > 0) { |
1139 | - $rand = mt_rand(0,count($globalSchedulesSources)-1); |
|
1139 | + $rand = mt_rand(0, count($globalSchedulesSources) - 1); |
|
1140 | 1140 | $source = $globalSchedulesSources[$rand]; |
1141 | 1141 | if ($source == 'flightmapper') return $this->getFlightMapper($ident); |
1142 | 1142 | elseif ($source == 'costtotravel') return $this->getCostToTravel($ident); |