@@ -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 |
@@ -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); |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | $min = true; |
65 | 65 | $allhistory = false; |
66 | 66 | $filter['source'] = array(); |
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
69 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
72 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
77 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
78 | 78 | |
79 | 79 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
80 | 80 | $min = true; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $spotter_array = array(); |
84 | 84 | |
85 | 85 | if (isset($_GET['ident'])) { |
86 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
86 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
87 | 87 | if ($tracker) { |
88 | 88 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
89 | 89 | } elseif ($marine) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | $allhistory = true; |
99 | 99 | } elseif (isset($_GET['flightaware_id'])) { |
100 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
100 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
101 | 101 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
102 | 102 | if (empty($spotter_array)) { |
103 | 103 | $from_archive = true; |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | } |
106 | 106 | $allhistory = true; |
107 | 107 | } elseif (isset($_GET['famtrack_id'])) { |
108 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
108 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
109 | 109 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
110 | 110 | $allhistory = true; |
111 | 111 | } elseif (isset($_GET['fammarine_id'])) { |
112 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
112 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
113 | 113 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
114 | 114 | $allhistory = true; |
115 | 115 | /* |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | */ |
130 | 130 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
131 | 131 | $usecoord = true; |
132 | - $coord = explode(',',$_GET['coord']); |
|
133 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
132 | + $coord = explode(',', $_GET['coord']); |
|
133 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
134 | 134 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
135 | 135 | if ($tracker) { |
136 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
136 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
137 | 137 | } elseif ($marine) { |
138 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
138 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
139 | 139 | } else { |
140 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
140 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
141 | 141 | } |
142 | 142 | } else { |
143 | 143 | if ($tracker) { |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | $from_archive = true; |
153 | 153 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
154 | 154 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
155 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
156 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
157 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
158 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
159 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
160 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
155 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
156 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
157 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
158 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
159 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
160 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
161 | 161 | } elseif ($min) { |
162 | 162 | if ($tracker) { |
163 | 163 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | # $min = true; |
170 | 170 | } else { |
171 | 171 | if ($tracker) { |
172 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
172 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
173 | 173 | } elseif ($marine) { |
174 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
174 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
175 | 175 | } else { |
176 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
176 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | 180 | if ($usecoord) { |
181 | 181 | if (isset($_GET['archive'])) { |
182 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
182 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
183 | 183 | } else { |
184 | 184 | if ($tracker) { |
185 | 185 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | if ($flightcnt == '') $flightcnt = 0; |
193 | 193 | } else $flightcnt = 0; |
194 | 194 | |
195 | -$sqltime = round(microtime(true)-$begintime,2); |
|
195 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
196 | 196 | |
197 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
197 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
198 | 198 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
199 | 199 | |
200 | 200 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (!empty($spotter_array) && is_array($spotter_array)) |
214 | 214 | { |
215 | 215 | $output .= '"features": ['; |
216 | - foreach($spotter_array as $spotter_item) |
|
216 | + foreach ($spotter_array as $spotter_item) |
|
217 | 217 | { |
218 | 218 | $j++; |
219 | 219 | unset($idistance); |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | */ |
271 | 271 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
272 | 272 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
273 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
274 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
273 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
274 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
275 | 275 | //" |
276 | 276 | } else { |
277 | 277 | if ($compress) $output .= '"c": "NA",'; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
281 | 281 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
282 | 282 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
283 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
283 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
284 | 284 | } elseif (isset($spotter_item['aircraft_type'])) { |
285 | 285 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
286 | 286 | } elseif (!$min) { |
@@ -423,15 +423,15 @@ discard block |
||
423 | 423 | if (isset($archivespeed) || $usenextlatlon) { |
424 | 424 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
425 | 425 | if (isset($spotter_item['arrival_airport_latitude'])) { |
426 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
427 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
426 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
427 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
428 | 428 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
429 | 429 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
430 | 430 | } else { |
431 | 431 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
432 | 432 | if (isset($aairport[0]['latitude'])) { |
433 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
434 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
433 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
434 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
435 | 435 | $farr_lat = $aairport[0]['latitude']; |
436 | 436 | $farr_lon = $aairport[0]['longitude']; |
437 | 437 | } |
@@ -444,59 +444,59 @@ discard block |
||
444 | 444 | if ($currenttime != '') { |
445 | 445 | if (strtotime($spotter_item['date']) < $currenttime) { |
446 | 446 | if (isset($archivespeed)) { |
447 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
448 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
447 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
448 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
449 | 449 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
450 | 450 | else { |
451 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
452 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
451 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
452 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
453 | 453 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
454 | 454 | else { |
455 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
455 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
456 | 456 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
457 | 457 | } |
458 | 458 | } |
459 | 459 | } elseif ($usenextlatlon) { |
460 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
461 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
460 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
461 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
462 | 462 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
463 | 463 | else { |
464 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
465 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
464 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
465 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
466 | 466 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
467 | 467 | else { |
468 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
468 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
469 | 469 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
470 | 470 | } |
471 | 471 | } |
472 | 472 | } |
473 | 473 | } else { |
474 | 474 | if (isset($archivespeed)) { |
475 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
475 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
476 | 476 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
477 | 477 | } elseif ($usenextlatlon) { |
478 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
478 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
479 | 479 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
480 | 480 | } |
481 | 481 | } |
482 | 482 | } else { |
483 | 483 | if (isset($archivespeed)) { |
484 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
485 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
484 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
485 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
486 | 486 | if (!isset($idistance) || $fdistance < $idistance) { |
487 | 487 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
488 | 488 | } else { |
489 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
489 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
490 | 490 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
491 | 491 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
492 | 492 | } |
493 | 493 | } elseif ($usenextlatlon) { |
494 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
495 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
494 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
495 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
496 | 496 | if (!isset($idistance) || $fdistance < $idistance) { |
497 | 497 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
498 | 498 | } else { |
499 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
499 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
500 | 500 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
501 | 501 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
502 | 502 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | if (!$min) $output .= '"image": "'.$image.'",'; |
507 | 507 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
508 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
508 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
509 | 509 | } |
510 | 510 | if (isset($spotter_item['image_source_website'])) { |
511 | 511 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
528 | 528 | } |
529 | 529 | if (isset($spotter_item['acars'])) { |
530 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
530 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
531 | 531 | } |
532 | 532 | // type when not aircraft ? |
533 | 533 | if (isset($spotter_item['type'])) { |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | if ($currenttime != '') { |
548 | 548 | if (strtotime($spotter_item['date']) < $currenttime) { |
549 | 549 | if (!isset($archivespeed)) $archivespeed = 1; |
550 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
551 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
550 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
551 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
552 | 552 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
553 | 553 | else { |
554 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
555 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
554 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
555 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
556 | 556 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
557 | 557 | else { |
558 | 558 | $output .= $spotter_item['longitude'].', '; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | |
632 | 632 | } |
633 | 633 | */ |
634 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
634 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
635 | 635 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
636 | 636 | |
637 | 637 | if ( |
@@ -639,11 +639,11 @@ discard block |
||
639 | 639 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
640 | 640 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
641 | 641 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
642 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
642 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
643 | 643 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
644 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
644 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
645 | 645 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
646 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
646 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
647 | 647 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
648 | 648 | ) { |
649 | 649 | if ($tracker) { |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
673 | 673 | $MapMatching = new MapMatching(); |
674 | 674 | if (isset($spotter_item['date_iso_8601'])) { |
675 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601']))))); |
|
675 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601']))))); |
|
676 | 676 | } else { |
677 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date']))))); |
|
677 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date']))))); |
|
678 | 678 | } |
679 | 679 | $spotter_history_array = $MapMatching->match($spotter_history_array_mm); |
680 | 680 | } |
@@ -706,9 +706,9 @@ discard block |
||
706 | 706 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
707 | 707 | } |
708 | 708 | $output_history .= '['; |
709 | - $output_history .= $spotter_history['longitude'].', '; |
|
710 | - $output_history .= $spotter_history['latitude'].', '; |
|
711 | - $output_history .= $spotter_history['altitude']*30.48; |
|
709 | + $output_history .= $spotter_history['longitude'].', '; |
|
710 | + $output_history .= $spotter_history['latitude'].', '; |
|
711 | + $output_history .= $spotter_history['altitude']*30.48; |
|
712 | 712 | $output_history .= '],'; |
713 | 713 | /* |
714 | 714 | if ($from_archive === false) { |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | $d = true; |
732 | 732 | } |
733 | 733 | $output_history .= '['; |
734 | - $output_history .= $spotter_history['longitude'].', '; |
|
735 | - $output_history .= $spotter_history['latitude']; |
|
734 | + $output_history .= $spotter_history['longitude'].', '; |
|
735 | + $output_history .= $spotter_history['latitude']; |
|
736 | 736 | $output_history .= '],'; |
737 | 737 | /* |
738 | 738 | if ($from_archive === false) { |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | //echo $output_history; |
749 | 749 | if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) { |
750 | 750 | $output_historyd = '['; |
751 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
752 | - $output_historyd .= $spotter_item['latitude']; |
|
753 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
751 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
752 | + $output_historyd .= $spotter_item['latitude']; |
|
753 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
754 | 754 | $output_historyd .= '],'; |
755 | 755 | //$output_history = $output_historyd.$output_history; |
756 | 756 | $output_history = $output_history.$output_historyd; |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | $last = array_pop($spotter_history_array); |
759 | 759 | $latitude = $last['latitude']; |
760 | 760 | $longitude = $last['longitude']; |
761 | - $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output); |
|
761 | + $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | $output_history = substr($output_history, 0, -1); |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | } |
770 | 770 | } |
771 | 771 | |
772 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
772 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
773 | 773 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
774 | 774 | && (isset($spotter_item['departure_airport']) |
775 | 775 | && $spotter_item['departure_airport'] != 'NA' |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
805 | 805 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
806 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
806 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
807 | 807 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
808 | 808 | && (isset($spotter_item['arrival_airport']) |
809 | 809 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -830,11 +830,11 @@ discard block |
||
830 | 830 | } |
831 | 831 | } |
832 | 832 | if ($havedata) { |
833 | - $line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon); |
|
833 | + $line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon); |
|
834 | 834 | foreach ($line[0] as $coord) { |
835 | 835 | $output_dest .= '['.$coord[0].','.$coord[1].'],'; |
836 | 836 | } |
837 | - $output_dest = substr($output_dest, 0, -1); |
|
837 | + $output_dest = substr($output_dest, 0, -1); |
|
838 | 838 | } |
839 | 839 | $output_dest .= ']}},'; |
840 | 840 | if ($havedata) $output .= $output_dest; |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | $output = substr($output, 0, -1); |
845 | 845 | $output .= ']'; |
846 | 846 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
847 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
847 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
848 | 848 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
849 | 849 | $output .= '"fc": "'.$j.'"'; |
850 | 850 | } else { |