@@ -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,30 +127,30 @@ 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 | if (isset($globalVM) && $globalVM) { |
| 136 | 136 | ?> |
| 137 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineRaces($filter_name,$year,$month)); ?></span> <?php echo _("Races"); ?></span> |
|
| 138 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 139 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineCaptains($filter_name,$year,$month)); ?></span> <?php echo _("Captains"); ?></span> |
|
| 140 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 137 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineRaces($filter_name, $year, $month)); ?></span> <?php echo _("Races"); ?></span> |
|
| 138 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 139 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineCaptains($filter_name, $year, $month)); ?></span> <?php echo _("Captains"); ?></span> |
|
| 140 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 141 | 141 | <?php |
| 142 | 142 | } |
| 143 | 143 | } elseif ($type == 'tracker') { |
| 144 | 144 | ?> |
| 145 | - <span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
| 146 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 147 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
| 148 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 145 | + <span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name, $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
| 146 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 147 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
| 148 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 149 | 149 | <?php |
| 150 | 150 | } |
| 151 | 151 | ?> |
| 152 | 152 | </p> |
| 153 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 153 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 154 | 154 | <div class="specific-stats"> |
| 155 | 155 | <?php |
| 156 | 156 | if ($type == 'aircraft') { |
@@ -159,13 +159,13 @@ discard block |
||
| 159 | 159 | <div class="col-md-6"> |
| 160 | 160 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
| 161 | 161 | <?php |
| 162 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
| 162 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
| 163 | 163 | if (count($aircraft_array) == 0) { |
| 164 | 164 | print _("No data available"); |
| 165 | 165 | } else { |
| 166 | 166 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 167 | 167 | $aircraft_data = ''; |
| 168 | - foreach($aircraft_array as $aircraft_item) { |
|
| 168 | + foreach ($aircraft_array as $aircraft_item) { |
|
| 169 | 169 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
| 170 | 170 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
| 171 | 171 | } |
@@ -194,16 +194,16 @@ discard block |
||
| 194 | 194 | ?> |
| 195 | 195 | </div> |
| 196 | 196 | </div> |
| 197 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 197 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 198 | 198 | <?php |
| 199 | 199 | if ($airline_icao == '' || $airline_icao == 'all') { |
| 200 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
| 200 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
| 201 | 201 | if (count($airline_array) > 0) { |
| 202 | 202 | print '<div class="col-md-6">'; |
| 203 | 203 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
| 204 | 204 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
| 205 | 205 | $airline_data = ''; |
| 206 | - foreach($airline_array as $airline_item) { |
|
| 206 | + foreach ($airline_array as $airline_item) { |
|
| 207 | 207 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
| 208 | 208 | } |
| 209 | 209 | $airline_data = substr($airline_data, 0, -1); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | ?> |
| 230 | 230 | </div> |
| 231 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 231 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 232 | 232 | <?php |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -240,12 +240,12 @@ discard block |
||
| 240 | 240 | <div class="col-md-6"> |
| 241 | 241 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
| 242 | 242 | <?php |
| 243 | - $marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month); |
|
| 243 | + $marine_array = $Stats->countAllMarineTypes(true, $filter_name, $year, $month); |
|
| 244 | 244 | if (count($marine_array) == 0) print _("No data available"); |
| 245 | 245 | else { |
| 246 | 246 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 247 | 247 | $marine_data = ''; |
| 248 | - foreach($marine_array as $marine_item) { |
|
| 248 | + foreach ($marine_array as $marine_item) { |
|
| 249 | 249 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
| 250 | 250 | } |
| 251 | 251 | $marine_data = substr($marine_data, 0, -1); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | ?> |
| 275 | 275 | </div> |
| 276 | 276 | </div> |
| 277 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 277 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 278 | 278 | <!-- </div>--> |
| 279 | 279 | <?php |
| 280 | 280 | if (isset($globalVM) && $globalVM) { |
@@ -282,12 +282,12 @@ discard block |
||
| 282 | 282 | <div class="col-md-6"> |
| 283 | 283 | <h2><?php echo _("Top 10 Races Number of Participants"); ?></h2> |
| 284 | 284 | <?php |
| 285 | - $marine_array = $Marine->countAllCaptainsByRaces(true,$filter_name,$year,$month); |
|
| 285 | + $marine_array = $Marine->countAllCaptainsByRaces(true, $filter_name, $year, $month); |
|
| 286 | 286 | if (count($marine_array) == 0) print _("No data available"); |
| 287 | 287 | else { |
| 288 | 288 | print '<div id="chart991" class="chart" width="100%"></div><script>'; |
| 289 | 289 | $marine_data = ''; |
| 290 | - foreach($marine_array as $marine_item) { |
|
| 290 | + foreach ($marine_array as $marine_item) { |
|
| 291 | 291 | $marine_data .= '["'.$marine_item['marine_race_name'].'",'.$marine_item['marine_captain_count'].'],'; |
| 292 | 292 | } |
| 293 | 293 | $marine_data = substr($marine_data, 0, -1); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | ?> |
| 318 | 318 | </div> |
| 319 | 319 | </div> |
| 320 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 320 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 321 | 321 | </div> |
| 322 | 322 | <div class="row column"> |
| 323 | 323 | |
@@ -330,12 +330,12 @@ discard block |
||
| 330 | 330 | <div class="col-md-6"> |
| 331 | 331 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
| 332 | 332 | <?php |
| 333 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
| 333 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
| 334 | 334 | if (count($tracker_array) == 0) print _("No data available"); |
| 335 | 335 | else { |
| 336 | 336 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 337 | 337 | $tracker_data = ''; |
| 338 | - foreach($tracker_array as $tracker_item) { |
|
| 338 | + foreach ($tracker_array as $tracker_item) { |
|
| 339 | 339 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
| 340 | 340 | } |
| 341 | 341 | $tracker_data = substr($tracker_data, 0, -1); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | ?> |
| 366 | 366 | </div> |
| 367 | 367 | </div> |
| 368 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 368 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 369 | 369 | <!-- </div>--> |
| 370 | 370 | <?php |
| 371 | 371 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | else { |
| 381 | 381 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 382 | 382 | $owner_data = ''; |
| 383 | - foreach($owner_array as $owner_item) { |
|
| 383 | + foreach ($owner_array as $owner_item) { |
|
| 384 | 384 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
| 385 | 385 | } |
| 386 | 386 | $owner_data = substr($owner_data, 0, -1); |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | </div> |
| 401 | 401 | --> |
| 402 | 402 | </div> |
| 403 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 403 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 404 | 404 | <div class="col-md-6"> |
| 405 | 405 | <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2> |
| 406 | 406 | <?php |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | else { |
| 410 | 410 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 411 | 411 | $owner_data = ''; |
| 412 | - foreach($countries_array as $owner_item) { |
|
| 412 | + foreach ($countries_array as $owner_item) { |
|
| 413 | 413 | $owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],'; |
| 414 | 414 | } |
| 415 | 415 | $owner_data = substr($owner_data, 0, -1); |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | --> |
| 431 | 431 | </div> |
| 432 | 432 | |
| 433 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 433 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 434 | 434 | ² </div> |
| 435 | 435 | <div class="row column"> |
| 436 | 436 | <div class="col-md-6"> |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | else { |
| 442 | 442 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 443 | 443 | $launch_site_data = ''; |
| 444 | - foreach($launch_site_array as $launch_site_item) { |
|
| 444 | + foreach ($launch_site_array as $launch_site_item) { |
|
| 445 | 445 | $launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],'; |
| 446 | 446 | } |
| 447 | 447 | $launch_site_data = substr($launch_site_data, 0, -1); |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | ?> |
| 469 | 469 | <div class="row column"> |
| 470 | 470 | <?php |
| 471 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
| 471 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
| 472 | 472 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 473 | 473 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
| 474 | 474 | if (empty($flightover_array)) { |
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | ?> |
| 480 | 480 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 481 | 481 | <?php |
| 482 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
| 482 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
| 483 | 483 | if (count($pilot_array) == 0) print _("No data available"); |
| 484 | 484 | else { |
| 485 | 485 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 486 | 486 | $pilot_data = ''; |
| 487 | - foreach($pilot_array as $pilot_item) { |
|
| 487 | + foreach ($pilot_array as $pilot_item) { |
|
| 488 | 488 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
| 489 | 489 | } |
| 490 | 490 | $pilot_data = substr($pilot_data, 0, -1); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | ?> |
| 506 | 506 | </div> |
| 507 | 507 | |
| 508 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 508 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 509 | 509 | <?php |
| 510 | 510 | } |
| 511 | 511 | // else { |
@@ -514,12 +514,12 @@ discard block |
||
| 514 | 514 | <div class="col-md-6"> |
| 515 | 515 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 516 | 516 | <?php |
| 517 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
| 517 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
| 518 | 518 | if (count($owner_array) == 0) print _("No data available"); |
| 519 | 519 | else { |
| 520 | 520 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 521 | 521 | $owner_data = ''; |
| 522 | - foreach($owner_array as $owner_item) { |
|
| 522 | + foreach ($owner_array as $owner_item) { |
|
| 523 | 523 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
| 524 | 524 | } |
| 525 | 525 | $owner_data = substr($owner_data, 0, -1); |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | </div> |
| 539 | 539 | </div> |
| 540 | 540 | |
| 541 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 541 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 542 | 542 | <?php |
| 543 | 543 | } |
| 544 | 544 | if (!empty($flightover_array)) { |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 553 | 553 | print 'var series = ['; |
| 554 | 554 | $flightover_data = ''; |
| 555 | - foreach($flightover_array as $flightover_item) { |
|
| 555 | + foreach ($flightover_array as $flightover_item) { |
|
| 556 | 556 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
| 557 | 557 | } |
| 558 | 558 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -597,12 +597,12 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | ?> |
| 599 | 599 | </div> |
| 600 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 600 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 601 | 601 | </div> |
| 602 | 602 | <?php |
| 603 | 603 | } |
| 604 | 604 | if ($type == 'marine') { |
| 605 | - $flightover_array = $Stats->countAllMarineOverCountries(true,$filter_name,$year,$month); |
|
| 605 | + $flightover_array = $Stats->countAllMarineOverCountries(true, $filter_name, $year, $month); |
|
| 606 | 606 | ?> |
| 607 | 607 | <!-- <div class="row column">--> |
| 608 | 608 | <div class="col-md-6"> |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 614 | 614 | print 'var series = ['; |
| 615 | 615 | $flightover_data = ''; |
| 616 | - foreach($flightover_array as $flightover_item) { |
|
| 616 | + foreach ($flightover_array as $flightover_item) { |
|
| 617 | 617 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
| 618 | 618 | } |
| 619 | 619 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | <div class="more"> |
| 654 | 654 | <a href="<?php print $globalURL; ?>/marine/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 655 | 655 | </div> |
| 656 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 656 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 657 | 657 | </div> |
| 658 | 658 | </div> |
| 659 | 659 | |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 672 | 672 | print 'var series = ['; |
| 673 | 673 | $flightover_data = ''; |
| 674 | - foreach($flightover_array as $flightover_item) { |
|
| 674 | + foreach ($flightover_array as $flightover_item) { |
|
| 675 | 675 | $flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],'; |
| 676 | 676 | } |
| 677 | 677 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -721,14 +721,14 @@ discard block |
||
| 721 | 721 | <div class="row column"> |
| 722 | 722 | <div class="col-md-6"> |
| 723 | 723 | <?php |
| 724 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
| 724 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
| 725 | 725 | if (count($airport_airport_array) > 0) { |
| 726 | 726 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
| 727 | 727 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
| 728 | 728 | print "\n"; |
| 729 | 729 | print 'var series = ['; |
| 730 | 730 | $airport_data = ''; |
| 731 | - foreach($airport_airport_array as $airport_item) { |
|
| 731 | + foreach ($airport_airport_array as $airport_item) { |
|
| 732 | 732 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
| 733 | 733 | } |
| 734 | 734 | $airport_data = substr($airport_data, 0, -1); |
@@ -778,18 +778,18 @@ discard block |
||
| 778 | 778 | } |
| 779 | 779 | ?> |
| 780 | 780 | </div> |
| 781 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 781 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 782 | 782 | |
| 783 | 783 | <div class="col-md-6"> |
| 784 | 784 | <?php |
| 785 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
| 785 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
| 786 | 786 | if (count($airport_airport_array2) > 0) { |
| 787 | 787 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
| 788 | 788 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
| 789 | 789 | print "\n"; |
| 790 | 790 | print 'var series = ['; |
| 791 | 791 | $airport_data = ''; |
| 792 | - foreach($airport_airport_array2 as $airport_item) |
|
| 792 | + foreach ($airport_airport_array2 as $airport_item) |
|
| 793 | 793 | { |
| 794 | 794 | if (isset($airport_item['airport_arrival_longitude']) && isset($airport_item['airport_arrival_latitude'])) { |
| 795 | 795 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | ?> |
| 844 | 844 | </div> |
| 845 | 845 | </div> |
| 846 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 846 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 847 | 847 | <?php |
| 848 | 848 | } |
| 849 | 849 | if ($type == 'aircraft') { |
@@ -855,18 +855,18 @@ discard block |
||
| 855 | 855 | <div class="col-md-6"> |
| 856 | 856 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 857 | 857 | <?php |
| 858 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 858 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
| 859 | 859 | if (count($year_array) == 0) print _("No data available"); |
| 860 | 860 | else { |
| 861 | 861 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 862 | 862 | $year_data = ''; |
| 863 | 863 | $year_cnt = ''; |
| 864 | - foreach($year_array as $year_item) { |
|
| 864 | + foreach ($year_array as $year_item) { |
|
| 865 | 865 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
| 866 | 866 | $year_cnt .= $year_item['date_count'].','; |
| 867 | 867 | } |
| 868 | 868 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 869 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 869 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 870 | 870 | print 'c3.generate({ |
| 871 | 871 | bindto: "#chart8", |
| 872 | 872 | data: { x: "x", |
@@ -879,22 +879,22 @@ discard block |
||
| 879 | 879 | <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> |
| 880 | 880 | </div> |
| 881 | 881 | </div> |
| 882 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 882 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 883 | 883 | <div class="col-md-6"> |
| 884 | 884 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 885 | 885 | <?php |
| 886 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 886 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
| 887 | 887 | if (count($month_array) == 0) print _("No data available"); |
| 888 | 888 | else { |
| 889 | 889 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 890 | 890 | $month_data = ''; |
| 891 | 891 | $month_cnt = ''; |
| 892 | - foreach($month_array as $month_item) { |
|
| 892 | + foreach ($month_array as $month_item) { |
|
| 893 | 893 | $month_data .= '"'.$month_item['date_name'].'",'; |
| 894 | 894 | $month_cnt .= $month_item['date_count'].','; |
| 895 | 895 | } |
| 896 | 896 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
| 897 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
| 897 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
| 898 | 898 | print 'c3.generate({ |
| 899 | 899 | bindto: "#chart9", |
| 900 | 900 | data: { x: "x", |
@@ -907,23 +907,23 @@ discard block |
||
| 907 | 907 | <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> |
| 908 | 908 | </div> |
| 909 | 909 | </div> |
| 910 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 910 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 911 | 911 | |
| 912 | 912 | <div class="col-md-6"> |
| 913 | 913 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 914 | 914 | <?php |
| 915 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 915 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
| 916 | 916 | if (empty($date_array)) print _("No data available"); |
| 917 | 917 | else { |
| 918 | 918 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 919 | 919 | $date_data = ''; |
| 920 | 920 | $date_cnt = ''; |
| 921 | - foreach($date_array as $date_item) { |
|
| 921 | + foreach ($date_array as $date_item) { |
|
| 922 | 922 | $date_data .= '"'.$date_item['date_name'].'",'; |
| 923 | 923 | $date_cnt .= $date_item['date_count'].','; |
| 924 | 924 | } |
| 925 | 925 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
| 926 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
| 926 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
| 927 | 927 | print 'c3.generate({ |
| 928 | 928 | bindto: "#chart5", |
| 929 | 929 | data: { x: "x", |
@@ -936,22 +936,22 @@ discard block |
||
| 936 | 936 | <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> |
| 937 | 937 | </div> |
| 938 | 938 | </div> |
| 939 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 939 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 940 | 940 | <div class="col-md-6"> |
| 941 | 941 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 942 | 942 | <?php |
| 943 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 943 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
| 944 | 944 | if (empty($hour_array)) print _("No data available"); |
| 945 | 945 | else { |
| 946 | 946 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 947 | 947 | $hour_data = ''; |
| 948 | 948 | $hour_cnt = ''; |
| 949 | - foreach($hour_array as $hour_item) { |
|
| 949 | + foreach ($hour_array as $hour_item) { |
|
| 950 | 950 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
| 951 | 951 | $hour_cnt .= $hour_item['hour_count'].','; |
| 952 | 952 | } |
| 953 | 953 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
| 954 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
| 954 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
| 955 | 955 | print 'c3.generate({ |
| 956 | 956 | bindto: "#chart6", |
| 957 | 957 | data: { |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | <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> |
| 965 | 965 | </div> |
| 966 | 966 | </div> |
| 967 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 967 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 968 | 968 | </div> |
| 969 | 969 | <?php |
| 970 | 970 | } |
@@ -980,18 +980,18 @@ discard block |
||
| 980 | 980 | <div class="col-md-6"> |
| 981 | 981 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 982 | 982 | <?php |
| 983 | - $year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name); |
|
| 983 | + $year_array = $Stats->countAllMarineMonthsLastYear(true, $filter_name); |
|
| 984 | 984 | if (count($year_array) == 0) print _("No data available"); |
| 985 | 985 | else { |
| 986 | 986 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 987 | 987 | $year_data = ''; |
| 988 | 988 | $year_cnt = ''; |
| 989 | - foreach($year_array as $year_item) { |
|
| 989 | + foreach ($year_array as $year_item) { |
|
| 990 | 990 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
| 991 | 991 | $year_cnt .= $year_item['date_count'].','; |
| 992 | 992 | } |
| 993 | 993 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 994 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
| 994 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
| 995 | 995 | print 'c3.generate({ |
| 996 | 996 | bindto: "#chart8", |
| 997 | 997 | data: { x: "x", |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | </div> |
| 1006 | 1006 | </div> |
| 1007 | 1007 | |
| 1008 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1008 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1009 | 1009 | <div class="col-md-6"> |
| 1010 | 1010 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 1011 | 1011 | <?php |
@@ -1015,12 +1015,12 @@ discard block |
||
| 1015 | 1015 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 1016 | 1016 | $month_data = ''; |
| 1017 | 1017 | $month_cnt = ''; |
| 1018 | - foreach($month_array as $month_item) { |
|
| 1018 | + foreach ($month_array as $month_item) { |
|
| 1019 | 1019 | $month_data .= '"'.$month_item['date_name'].'",'; |
| 1020 | 1020 | $month_cnt .= $month_item['date_count'].','; |
| 1021 | 1021 | } |
| 1022 | 1022 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
| 1023 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
| 1023 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
| 1024 | 1024 | print 'c3.generate({ |
| 1025 | 1025 | bindto: "#chart9", |
| 1026 | 1026 | data: { x: "x", |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1034 | 1034 | </div> |
| 1035 | 1035 | </div> |
| 1036 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1036 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1037 | 1037 | |
| 1038 | 1038 | <div class="col-md-6"> |
| 1039 | 1039 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1044,12 +1044,12 @@ discard block |
||
| 1044 | 1044 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 1045 | 1045 | $date_data = ''; |
| 1046 | 1046 | $date_cnt = ''; |
| 1047 | - foreach($date_array as $date_item) { |
|
| 1047 | + foreach ($date_array as $date_item) { |
|
| 1048 | 1048 | $date_data .= '"'.$date_item['date_name'].'",'; |
| 1049 | 1049 | $date_cnt .= $date_item['date_count'].','; |
| 1050 | 1050 | } |
| 1051 | 1051 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
| 1052 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
| 1052 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
| 1053 | 1053 | print 'c3.generate({ |
| 1054 | 1054 | bindto: "#chart5", |
| 1055 | 1055 | data: { x: "x", |
@@ -1062,22 +1062,22 @@ discard block |
||
| 1062 | 1062 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1063 | 1063 | </div> |
| 1064 | 1064 | </div> |
| 1065 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1065 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1066 | 1066 | <div class="col-md-6"> |
| 1067 | 1067 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 1068 | 1068 | <?php |
| 1069 | - $hour_array = $Stats->countAllMarineHours('hour',true,$filter_name); |
|
| 1069 | + $hour_array = $Stats->countAllMarineHours('hour', true, $filter_name); |
|
| 1070 | 1070 | if (empty($hour_array)) print _("No data available"); |
| 1071 | 1071 | else { |
| 1072 | 1072 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 1073 | 1073 | $hour_data = ''; |
| 1074 | 1074 | $hour_cnt = ''; |
| 1075 | - foreach($hour_array as $hour_item) { |
|
| 1075 | + foreach ($hour_array as $hour_item) { |
|
| 1076 | 1076 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
| 1077 | 1077 | $hour_cnt .= $hour_item['hour_count'].','; |
| 1078 | 1078 | } |
| 1079 | 1079 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
| 1080 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
| 1080 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
| 1081 | 1081 | print 'c3.generate({ |
| 1082 | 1082 | bindto: "#chart6", |
| 1083 | 1083 | data: { |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1091 | 1091 | </div> |
| 1092 | 1092 | </div> |
| 1093 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1093 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1094 | 1094 | </div> |
| 1095 | 1095 | <?php |
| 1096 | 1096 | } |
@@ -1112,12 +1112,12 @@ discard block |
||
| 1112 | 1112 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 1113 | 1113 | $year_data = ''; |
| 1114 | 1114 | $year_cnt = ''; |
| 1115 | - foreach($year_array as $year_item) { |
|
| 1115 | + foreach ($year_array as $year_item) { |
|
| 1116 | 1116 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
| 1117 | 1117 | $year_cnt .= $year_item['date_count'].','; |
| 1118 | 1118 | } |
| 1119 | 1119 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 1120 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
| 1120 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
| 1121 | 1121 | print 'c3.generate({ |
| 1122 | 1122 | bindto: "#chart8", |
| 1123 | 1123 | data: { x: "x", |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | </div> |
| 1132 | 1132 | </div> |
| 1133 | 1133 | |
| 1134 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1134 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1135 | 1135 | <div class="col-md-6"> |
| 1136 | 1136 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 1137 | 1137 | <?php |
@@ -1141,12 +1141,12 @@ discard block |
||
| 1141 | 1141 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 1142 | 1142 | $month_data = ''; |
| 1143 | 1143 | $month_cnt = ''; |
| 1144 | - foreach($month_array as $month_item) { |
|
| 1144 | + foreach ($month_array as $month_item) { |
|
| 1145 | 1145 | $month_data .= '"'.$month_item['date_name'].'",'; |
| 1146 | 1146 | $month_cnt .= $month_item['date_count'].','; |
| 1147 | 1147 | } |
| 1148 | 1148 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
| 1149 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
| 1149 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
| 1150 | 1150 | print 'c3.generate({ |
| 1151 | 1151 | bindto: "#chart9", |
| 1152 | 1152 | data: { x: "x", |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1160 | 1160 | </div> |
| 1161 | 1161 | </div> |
| 1162 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1162 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1163 | 1163 | |
| 1164 | 1164 | <div class="col-md-6"> |
| 1165 | 1165 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1170,12 +1170,12 @@ discard block |
||
| 1170 | 1170 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 1171 | 1171 | $date_data = ''; |
| 1172 | 1172 | $date_cnt = ''; |
| 1173 | - foreach($date_array as $date_item) { |
|
| 1173 | + foreach ($date_array as $date_item) { |
|
| 1174 | 1174 | $date_data .= '"'.$date_item['date_name'].'",'; |
| 1175 | 1175 | $date_cnt .= $date_item['date_count'].','; |
| 1176 | 1176 | } |
| 1177 | 1177 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
| 1178 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
| 1178 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
| 1179 | 1179 | print 'c3.generate({ |
| 1180 | 1180 | bindto: "#chart5", |
| 1181 | 1181 | data: { x: "x", |
@@ -1188,22 +1188,22 @@ discard block |
||
| 1188 | 1188 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1189 | 1189 | </div> |
| 1190 | 1190 | </div> |
| 1191 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1191 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1192 | 1192 | <div class="col-md-6"> |
| 1193 | 1193 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 1194 | 1194 | <?php |
| 1195 | - $hour_array = $Stats->countAllTrackerHours('hour',true); |
|
| 1195 | + $hour_array = $Stats->countAllTrackerHours('hour', true); |
|
| 1196 | 1196 | if (empty($hour_array)) print _("No data available"); |
| 1197 | 1197 | else { |
| 1198 | 1198 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 1199 | 1199 | $hour_data = ''; |
| 1200 | 1200 | $hour_cnt = ''; |
| 1201 | - foreach($hour_array as $hour_item) { |
|
| 1201 | + foreach ($hour_array as $hour_item) { |
|
| 1202 | 1202 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
| 1203 | 1203 | $hour_cnt .= $hour_item['hour_count'].','; |
| 1204 | 1204 | } |
| 1205 | 1205 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
| 1206 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
| 1206 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
| 1207 | 1207 | print 'c3.generate({ |
| 1208 | 1208 | bindto: "#chart6", |
| 1209 | 1209 | data: { |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1217 | 1217 | </div> |
| 1218 | 1218 | </div> |
| 1219 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1219 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1220 | 1220 | </div> |
| 1221 | 1221 | <?php |
| 1222 | 1222 | } |
@@ -1238,12 +1238,12 @@ discard block |
||
| 1238 | 1238 | print '<div id="chart21" class="chart" width="100%"></div><script>'; |
| 1239 | 1239 | $year_data = ''; |
| 1240 | 1240 | $year_cnt = ''; |
| 1241 | - foreach($year_array as $year_item) { |
|
| 1241 | + foreach ($year_array as $year_item) { |
|
| 1242 | 1242 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
| 1243 | 1243 | $year_cnt .= $year_item['date_count'].','; |
| 1244 | 1244 | } |
| 1245 | 1245 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 1246 | - $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]"; |
|
| 1246 | + $year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]"; |
|
| 1247 | 1247 | print 'c3.generate({ |
| 1248 | 1248 | bindto: "#chart21", |
| 1249 | 1249 | data: { x: "x", |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | --> |
| 1260 | 1260 | </div> |
| 1261 | 1261 | |
| 1262 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1262 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1263 | 1263 | <div class="col-md-6"> |
| 1264 | 1264 | <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2> |
| 1265 | 1265 | <?php |
@@ -1269,12 +1269,12 @@ discard block |
||
| 1269 | 1269 | print '<div id="chart22" class="chart" width="100%"></div><script>'; |
| 1270 | 1270 | $year_data = ''; |
| 1271 | 1271 | $year_cnt = ''; |
| 1272 | - foreach($year_array as $year_item) { |
|
| 1272 | + foreach ($year_array as $year_item) { |
|
| 1273 | 1273 | $year_data .= '"'.$year_item['year_name'].'-01-01'.'",'; |
| 1274 | 1274 | $year_cnt .= $year_item['date_count'].','; |
| 1275 | 1275 | } |
| 1276 | 1276 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 1277 | - $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]"; |
|
| 1277 | + $year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]"; |
|
| 1278 | 1278 | print 'c3.generate({ |
| 1279 | 1279 | bindto: "#chart22", |
| 1280 | 1280 | data: { x: "x", |
@@ -1290,7 +1290,7 @@ discard block |
||
| 1290 | 1290 | --> |
| 1291 | 1291 | </div> |
| 1292 | 1292 | |
| 1293 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1293 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1294 | 1294 | </div> |
| 1295 | 1295 | <?php |
| 1296 | 1296 | } |
@@ -1312,12 +1312,12 @@ discard block |
||
| 1312 | 1312 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
| 1313 | 1313 | $year_data = ''; |
| 1314 | 1314 | $year_cnt = ''; |
| 1315 | - foreach($year_array as $year_item) { |
|
| 1315 | + foreach ($year_array as $year_item) { |
|
| 1316 | 1316 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
| 1317 | 1317 | $year_cnt .= $year_item['count'].','; |
| 1318 | 1318 | } |
| 1319 | 1319 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 1320 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 1320 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 1321 | 1321 | print 'c3.generate({ |
| 1322 | 1322 | bindto: "#chart32", |
| 1323 | 1323 | data: { x: "x", |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1331 | 1331 | </div> |
| 1332 | 1332 | </div> |
| 1333 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1333 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1334 | 1334 | |
| 1335 | 1335 | <div class="row column"> |
| 1336 | 1336 | <div class="col-md-6"> |
@@ -1342,12 +1342,12 @@ discard block |
||
| 1342 | 1342 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
| 1343 | 1343 | $year_data = ''; |
| 1344 | 1344 | $year_cnt = ''; |
| 1345 | - foreach($year_array as $year_item) { |
|
| 1345 | + foreach ($year_array as $year_item) { |
|
| 1346 | 1346 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
| 1347 | 1347 | $year_cnt .= $year_item['count'].','; |
| 1348 | 1348 | } |
| 1349 | 1349 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 1350 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 1350 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 1351 | 1351 | print 'c3.generate({ |
| 1352 | 1352 | bindto: "#chart33", |
| 1353 | 1353 | data: { x: "x", |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1361 | 1361 | </div> |
| 1362 | 1362 | </div> |
| 1363 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1363 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1364 | 1364 | <br/> |
| 1365 | 1365 | <?php |
| 1366 | 1366 | } |
@@ -1374,19 +1374,19 @@ discard block |
||
| 1374 | 1374 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
| 1375 | 1375 | if ($year == '' && $month == '') { |
| 1376 | 1376 | if ($type == 'aircraft') { |
| 1377 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
| 1377 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
| 1378 | 1378 | } elseif ($type == 'marine') { |
| 1379 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
| 1379 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
| 1380 | 1380 | } elseif ($type == 'tracker') { |
| 1381 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
| 1381 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | } else { |
| 1384 | 1384 | if ($type == 'aircraft') { |
| 1385 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
| 1385 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
| 1386 | 1386 | } elseif ($type == 'marine') { |
| 1387 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
| 1387 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
| 1388 | 1388 | } elseif ($type == 'tracker') { |
| 1389 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
| 1389 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
| 1390 | 1390 | } |
| 1391 | 1391 | } |
| 1392 | 1392 | if (!empty($polar)) { |
@@ -1395,7 +1395,7 @@ discard block |
||
| 1395 | 1395 | unset($polar_data); |
| 1396 | 1396 | $Spotter = new Spotter(); |
| 1397 | 1397 | $data = json_decode($eachpolar['source_data']); |
| 1398 | - foreach($data as $value => $key) { |
|
| 1398 | + foreach ($data as $value => $key) { |
|
| 1399 | 1399 | $direction = $Spotter->parseDirection(($value*22.5)); |
| 1400 | 1400 | $distance = $key; |
| 1401 | 1401 | $unit = 'km'; |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | ?> |
| 1416 | 1416 | <div class="col-md-6"> |
| 1417 | 1417 | <h4><?php print $eachpolar['source_name']; ?></h4> |
| 1418 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
| 1418 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
| 1419 | 1419 | <script> |
| 1420 | 1420 | (function() { |
| 1421 | 1421 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | color: color, |
| 1440 | 1440 | unit: '<?php echo $unit; ?>' |
| 1441 | 1441 | }; |
| 1442 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
| 1442 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
| 1443 | 1443 | })(); |
| 1444 | 1444 | </script> |
| 1445 | 1445 | </div> |
@@ -1454,19 +1454,19 @@ discard block |
||
| 1454 | 1454 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
| 1455 | 1455 | if ($year == '' && $month == '') { |
| 1456 | 1456 | if ($type == 'aircraft') { |
| 1457 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
| 1457 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
| 1458 | 1458 | } elseif ($type == 'marine') { |
| 1459 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
| 1459 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
| 1460 | 1460 | } elseif ($type == 'tracker') { |
| 1461 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
| 1461 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
| 1462 | 1462 | } |
| 1463 | 1463 | } else { |
| 1464 | 1464 | if ($type == 'aircraft') { |
| 1465 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
| 1465 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
| 1466 | 1466 | } elseif ($type == 'marine') { |
| 1467 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
| 1467 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
| 1468 | 1468 | } elseif ($type == 'tracker') { |
| 1469 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
| 1469 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
| 1470 | 1470 | } |
| 1471 | 1471 | } |
| 1472 | 1472 | if (!empty($msg)) { |
@@ -1474,13 +1474,13 @@ discard block |
||
| 1474 | 1474 | foreach ($msg as $eachmsg) { |
| 1475 | 1475 | //$eachmsg = $msg[0]; |
| 1476 | 1476 | $data = $eachmsg['source_data']; |
| 1477 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 1477 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
| 1478 | 1478 | else $max = 500; |
| 1479 | 1479 | ?> |
| 1480 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
| 1480 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
| 1481 | 1481 | <script> |
| 1482 | 1482 | var g = new JustGage({ |
| 1483 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
| 1483 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
| 1484 | 1484 | value: <?php echo $data; ?>, |
| 1485 | 1485 | min: 0, |
| 1486 | 1486 | max: <?php print $max; ?>, |
@@ -1502,19 +1502,19 @@ discard block |
||
| 1502 | 1502 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
| 1503 | 1503 | if ($year == '' && $month == '') { |
| 1504 | 1504 | if ($type == 'aircraft') { |
| 1505 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
| 1505 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
| 1506 | 1506 | } elseif ($type == 'marine') { |
| 1507 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
| 1507 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
| 1508 | 1508 | } elseif ($type == 'tracker') { |
| 1509 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
| 1509 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
| 1510 | 1510 | } |
| 1511 | 1511 | } else { |
| 1512 | 1512 | if ($type == 'aircraft') { |
| 1513 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
| 1513 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
| 1514 | 1514 | } elseif ($type == 'marine') { |
| 1515 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
| 1515 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
| 1516 | 1516 | } elseif ($type == 'tracker') { |
| 1517 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
| 1517 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
| 1518 | 1518 | } |
| 1519 | 1519 | } |
| 1520 | 1520 | foreach ($hist as $hists) { |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | $source = $hists['source_name']; |
| 1525 | 1525 | $hist_array = json_decode($hists['source_data']); |
| 1526 | 1526 | $unit = 'km'; |
| 1527 | - foreach($hist_array as $distance => $nb) { |
|
| 1527 | + foreach ($hist_array as $distance => $nb) { |
|
| 1528 | 1528 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 1529 | 1529 | $distance = round($distance*0.539957); |
| 1530 | 1530 | $unit = 'nm'; |
@@ -1544,18 +1544,18 @@ discard block |
||
| 1544 | 1544 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
| 1545 | 1545 | ?> |
| 1546 | 1546 | <div class="col-md-6"> |
| 1547 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
| 1547 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
| 1548 | 1548 | <?php |
| 1549 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
| 1549 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
| 1550 | 1550 | print 'c3.generate({ |
| 1551 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
| 1551 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
| 1552 | 1552 | data: { x: "x", |
| 1553 | 1553 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
| 1554 | 1554 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
| 1555 | 1555 | print '</script>'; |
| 1556 | 1556 | ?> |
| 1557 | 1557 | </div> |
| 1558 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1558 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1559 | 1559 | <?php |
| 1560 | 1560 | } |
| 1561 | 1561 | ?> |
@@ -22,11 +22,15 @@ discard block |
||
| 22 | 22 | require_once('require/class.Spotter.php'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 25 | +if (!isset($filter_name)) { |
|
| 26 | + $filter_name = ''; |
|
| 27 | +} |
|
| 26 | 28 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 27 | 29 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
| 28 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 29 | -} |
|
| 30 | + if (isset($globalFilter['airline'])) { |
|
| 31 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 32 | + } |
|
| 33 | + } |
|
| 30 | 34 | if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') { |
| 31 | 35 | $Spotter = new Spotter(); |
| 32 | 36 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -61,7 +65,12 @@ discard block |
||
| 61 | 65 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
| 62 | 66 | <div class="column"> |
| 63 | 67 | <div class="info"> |
| 64 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
| 68 | + <h1><?php if (isset($airline_name)) { |
|
| 69 | + echo _("Statistics for ").$airline_name; |
|
| 70 | +} else { |
|
| 71 | + echo _("Statistics"); |
|
| 72 | +} |
|
| 73 | +?></h1> |
|
| 65 | 74 | <?php |
| 66 | 75 | if ($type == 'aircraft') { |
| 67 | 76 | $last_update = $Stats->getLastStatsUpdate(); |
@@ -73,7 +82,9 @@ discard block |
||
| 73 | 82 | if (isset($last_update[0]['value'])) { |
| 74 | 83 | date_default_timezone_set('UTC'); |
| 75 | 84 | $lastupdate = strtotime($last_update[0]['value']); |
| 76 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
| 85 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
| 86 | + date_default_timezone_set($globalTimezone); |
|
| 87 | + } |
|
| 77 | 88 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
| 78 | 89 | } |
| 79 | 90 | |
@@ -166,8 +177,11 @@ discard block |
||
| 166 | 177 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 167 | 178 | $aircraft_data = ''; |
| 168 | 179 | foreach($aircraft_array as $aircraft_item) { |
| 169 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 170 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 180 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
| 181 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 182 | + } else { |
|
| 183 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 184 | + } |
|
| 171 | 185 | } |
| 172 | 186 | $aircraft_data = substr($aircraft_data, 0, -1); |
| 173 | 187 | print 'var series = ['.$aircraft_data.'];'; |
@@ -184,11 +198,17 @@ discard block |
||
| 184 | 198 | <?php |
| 185 | 199 | if ($year != '' && $month != '') { |
| 186 | 200 | ?> |
| 187 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 201 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 202 | + echo '/'.$airline_icao; |
|
| 203 | +} |
|
| 204 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 188 | 205 | <?php |
| 189 | 206 | } else { |
| 190 | 207 | ?> |
| 191 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?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> |
|
| 208 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 209 | + echo '/'.$airline_icao; |
|
| 210 | +} |
|
| 211 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 192 | 212 | <?php |
| 193 | 213 | } |
| 194 | 214 | ?> |
@@ -217,11 +237,15 @@ discard block |
||
| 217 | 237 | print '</script>'; |
| 218 | 238 | if ($year != '' && $month != '') { |
| 219 | 239 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
| 220 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 240 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 241 | + echo '/'.$airline_icao; |
|
| 242 | + } |
|
| 221 | 243 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 222 | 244 | } else { |
| 223 | 245 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
| 224 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 246 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 247 | + echo '/'.$airline_icao; |
|
| 248 | + } |
|
| 225 | 249 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 226 | 250 | } |
| 227 | 251 | print '</div>'; |
@@ -241,8 +265,9 @@ discard block |
||
| 241 | 265 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
| 242 | 266 | <?php |
| 243 | 267 | $marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month); |
| 244 | - if (count($marine_array) == 0) print _("No data available"); |
|
| 245 | - else { |
|
| 268 | + if (count($marine_array) == 0) { |
|
| 269 | + print _("No data available"); |
|
| 270 | + } else { |
|
| 246 | 271 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 247 | 272 | $marine_data = ''; |
| 248 | 273 | foreach($marine_array as $marine_item) { |
@@ -283,8 +308,9 @@ discard block |
||
| 283 | 308 | <h2><?php echo _("Top 10 Races Number of Participants"); ?></h2> |
| 284 | 309 | <?php |
| 285 | 310 | $marine_array = $Marine->countAllCaptainsByRaces(true,$filter_name,$year,$month); |
| 286 | - if (count($marine_array) == 0) print _("No data available"); |
|
| 287 | - else { |
|
| 311 | + if (count($marine_array) == 0) { |
|
| 312 | + print _("No data available"); |
|
| 313 | + } else { |
|
| 288 | 314 | print '<div id="chart991" class="chart" width="100%"></div><script>'; |
| 289 | 315 | $marine_data = ''; |
| 290 | 316 | foreach($marine_array as $marine_item) { |
@@ -331,8 +357,9 @@ discard block |
||
| 331 | 357 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
| 332 | 358 | <?php |
| 333 | 359 | $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
| 334 | - if (count($tracker_array) == 0) print _("No data available"); |
|
| 335 | - else { |
|
| 360 | + if (count($tracker_array) == 0) { |
|
| 361 | + print _("No data available"); |
|
| 362 | + } else { |
|
| 336 | 363 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 337 | 364 | $tracker_data = ''; |
| 338 | 365 | foreach($tracker_array as $tracker_item) { |
@@ -376,8 +403,9 @@ discard block |
||
| 376 | 403 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 377 | 404 | <?php |
| 378 | 405 | $owner_array = $Satellite->countAllOwners(true); |
| 379 | - if (count($owner_array) == 0) print _("No data available"); |
|
| 380 | - else { |
|
| 406 | + if (count($owner_array) == 0) { |
|
| 407 | + print _("No data available"); |
|
| 408 | + } else { |
|
| 381 | 409 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 382 | 410 | $owner_data = ''; |
| 383 | 411 | foreach($owner_array as $owner_item) { |
@@ -396,7 +424,10 @@ discard block |
||
| 396 | 424 | ?> |
| 397 | 425 | <!-- |
| 398 | 426 | <div class="more"> |
| 399 | - <a href="<?php print $globalURL; ?>/statistics/owner<?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> |
|
| 427 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 428 | + echo '/'.$airline_icao; |
|
| 429 | +} |
|
| 430 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 400 | 431 | </div> |
| 401 | 432 | --> |
| 402 | 433 | </div> |
@@ -405,8 +436,9 @@ discard block |
||
| 405 | 436 | <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2> |
| 406 | 437 | <?php |
| 407 | 438 | $countries_array = $Satellite->countAllCountriesOwners(true); |
| 408 | - if (count($countries_array) == 0) print _("No data available"); |
|
| 409 | - else { |
|
| 439 | + if (count($countries_array) == 0) { |
|
| 440 | + print _("No data available"); |
|
| 441 | + } else { |
|
| 410 | 442 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 411 | 443 | $owner_data = ''; |
| 412 | 444 | foreach($countries_array as $owner_item) { |
@@ -425,7 +457,10 @@ discard block |
||
| 425 | 457 | ?> |
| 426 | 458 | <!-- |
| 427 | 459 | <div class="more"> |
| 428 | - <a href="<?php print $globalURL; ?>/statistics/owner<?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> |
|
| 460 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 461 | + echo '/'.$airline_icao; |
|
| 462 | +} |
|
| 463 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 429 | 464 | </div> |
| 430 | 465 | --> |
| 431 | 466 | </div> |
@@ -437,8 +472,9 @@ discard block |
||
| 437 | 472 | <h2><?php echo _("Top 10 Most Common Launch Sites"); ?></h2> |
| 438 | 473 | <?php |
| 439 | 474 | $launch_site_array = $Satellite->countAllLaunchSite(true); |
| 440 | - if (count($launch_site_array) == 0) print _("No data available"); |
|
| 441 | - else { |
|
| 475 | + if (count($launch_site_array) == 0) { |
|
| 476 | + print _("No data available"); |
|
| 477 | + } else { |
|
| 442 | 478 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 443 | 479 | $launch_site_data = ''; |
| 444 | 480 | foreach($launch_site_array as $launch_site_item) { |
@@ -457,7 +493,10 @@ discard block |
||
| 457 | 493 | ?> |
| 458 | 494 | <!-- |
| 459 | 495 | <div class="more"> |
| 460 | - <a href="<?php print $globalURL; ?>/statistics/owner<?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> |
|
| 496 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 497 | + echo '/'.$airline_icao; |
|
| 498 | +} |
|
| 499 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 461 | 500 | </div> |
| 462 | 501 | --> |
| 463 | 502 | </div> |
@@ -480,8 +519,9 @@ discard block |
||
| 480 | 519 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 481 | 520 | <?php |
| 482 | 521 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
| 483 | - if (count($pilot_array) == 0) print _("No data available"); |
|
| 484 | - else { |
|
| 522 | + if (count($pilot_array) == 0) { |
|
| 523 | + print _("No data available"); |
|
| 524 | + } else { |
|
| 485 | 525 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 486 | 526 | $pilot_data = ''; |
| 487 | 527 | foreach($pilot_array as $pilot_item) { |
@@ -499,7 +539,9 @@ discard block |
||
| 499 | 539 | } |
| 500 | 540 | print '<div class="more">'; |
| 501 | 541 | print '<a href="'.$globalURL.'/statistics/pilot'; |
| 502 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 542 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 543 | + echo '/'.$airline_icao; |
|
| 544 | + } |
|
| 503 | 545 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
| 504 | 546 | print '</div>'; |
| 505 | 547 | ?> |
@@ -515,8 +557,9 @@ discard block |
||
| 515 | 557 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 516 | 558 | <?php |
| 517 | 559 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
| 518 | - if (count($owner_array) == 0) print _("No data available"); |
|
| 519 | - else { |
|
| 560 | + if (count($owner_array) == 0) { |
|
| 561 | + print _("No data available"); |
|
| 562 | + } else { |
|
| 520 | 563 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 521 | 564 | $owner_data = ''; |
| 522 | 565 | foreach($owner_array as $owner_item) { |
@@ -534,7 +577,10 @@ discard block |
||
| 534 | 577 | } |
| 535 | 578 | ?> |
| 536 | 579 | <div class="more"> |
| 537 | - <a href="<?php print $globalURL; ?>/statistics/owner<?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> |
|
| 580 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 581 | + echo '/'.$airline_icao; |
|
| 582 | +} |
|
| 583 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 538 | 584 | </div> |
| 539 | 585 | </div> |
| 540 | 586 | |
@@ -547,8 +593,9 @@ discard block |
||
| 547 | 593 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
| 548 | 594 | <?php |
| 549 | 595 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
| 550 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 551 | - else { |
|
| 596 | + if (count($flightover_array) == 0) { |
|
| 597 | + print _("No data available"); |
|
| 598 | + } else { |
|
| 552 | 599 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 553 | 600 | print 'var series = ['; |
| 554 | 601 | $flightover_data = ''; |
@@ -590,7 +637,10 @@ discard block |
||
| 590 | 637 | } |
| 591 | 638 | ?> |
| 592 | 639 | <div class="more"> |
| 593 | - <a href="<?php print $globalURL; ?>/statistics/country<?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> |
|
| 640 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 641 | + echo '/'.$airline_icao; |
|
| 642 | +} |
|
| 643 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 594 | 644 | </div> |
| 595 | 645 | </div> |
| 596 | 646 | <?php |
@@ -608,8 +658,9 @@ discard block |
||
| 608 | 658 | <div class="col-md-6"> |
| 609 | 659 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
| 610 | 660 | <?php |
| 611 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 612 | - else { |
|
| 661 | + if (count($flightover_array) == 0) { |
|
| 662 | + print _("No data available"); |
|
| 663 | + } else { |
|
| 613 | 664 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 614 | 665 | print 'var series = ['; |
| 615 | 666 | $flightover_data = ''; |
@@ -666,8 +717,9 @@ discard block |
||
| 666 | 717 | <div class="col-md-6"> |
| 667 | 718 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
| 668 | 719 | <?php |
| 669 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 670 | - else { |
|
| 720 | + if (count($flightover_array) == 0) { |
|
| 721 | + print _("No data available"); |
|
| 722 | + } else { |
|
| 671 | 723 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 672 | 724 | print 'var series = ['; |
| 673 | 725 | $flightover_data = ''; |
@@ -773,7 +825,9 @@ discard block |
||
| 773 | 825 | });"; |
| 774 | 826 | print '</script>'; |
| 775 | 827 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
| 776 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 828 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 829 | + echo '/'.$airline_icao; |
|
| 830 | + } |
|
| 777 | 831 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 778 | 832 | } |
| 779 | 833 | ?> |
@@ -837,7 +891,9 @@ discard block |
||
| 837 | 891 | });"; |
| 838 | 892 | print '</script>'; |
| 839 | 893 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
| 840 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 894 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 895 | + echo '/'.$airline_icao; |
|
| 896 | + } |
|
| 841 | 897 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 842 | 898 | } |
| 843 | 899 | ?> |
@@ -856,8 +912,9 @@ discard block |
||
| 856 | 912 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 857 | 913 | <?php |
| 858 | 914 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
| 859 | - if (count($year_array) == 0) print _("No data available"); |
|
| 860 | - else { |
|
| 915 | + if (count($year_array) == 0) { |
|
| 916 | + print _("No data available"); |
|
| 917 | + } else { |
|
| 861 | 918 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 862 | 919 | $year_data = ''; |
| 863 | 920 | $year_cnt = ''; |
@@ -876,7 +933,10 @@ discard block |
||
| 876 | 933 | } |
| 877 | 934 | ?> |
| 878 | 935 | <div class="more"> |
| 879 | - <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> |
|
| 936 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 937 | + echo '/'.$airline_icao; |
|
| 938 | +} |
|
| 939 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 880 | 940 | </div> |
| 881 | 941 | </div> |
| 882 | 942 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -884,8 +944,9 @@ discard block |
||
| 884 | 944 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 885 | 945 | <?php |
| 886 | 946 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
| 887 | - if (count($month_array) == 0) print _("No data available"); |
|
| 888 | - else { |
|
| 947 | + if (count($month_array) == 0) { |
|
| 948 | + print _("No data available"); |
|
| 949 | + } else { |
|
| 889 | 950 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 890 | 951 | $month_data = ''; |
| 891 | 952 | $month_cnt = ''; |
@@ -904,7 +965,10 @@ discard block |
||
| 904 | 965 | } |
| 905 | 966 | ?> |
| 906 | 967 | <div class="more"> |
| 907 | - <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> |
|
| 968 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 969 | + echo '/'.$airline_icao; |
|
| 970 | +} |
|
| 971 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 908 | 972 | </div> |
| 909 | 973 | </div> |
| 910 | 974 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -913,8 +977,9 @@ discard block |
||
| 913 | 977 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 914 | 978 | <?php |
| 915 | 979 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
| 916 | - if (empty($date_array)) print _("No data available"); |
|
| 917 | - else { |
|
| 980 | + if (empty($date_array)) { |
|
| 981 | + print _("No data available"); |
|
| 982 | + } else { |
|
| 918 | 983 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 919 | 984 | $date_data = ''; |
| 920 | 985 | $date_cnt = ''; |
@@ -933,7 +998,10 @@ discard block |
||
| 933 | 998 | } |
| 934 | 999 | ?> |
| 935 | 1000 | <div class="more"> |
| 936 | - <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> |
|
| 1001 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 1002 | + echo '/'.$airline_icao; |
|
| 1003 | +} |
|
| 1004 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 937 | 1005 | </div> |
| 938 | 1006 | </div> |
| 939 | 1007 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -941,8 +1009,9 @@ discard block |
||
| 941 | 1009 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 942 | 1010 | <?php |
| 943 | 1011 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
| 944 | - if (empty($hour_array)) print _("No data available"); |
|
| 945 | - else { |
|
| 1012 | + if (empty($hour_array)) { |
|
| 1013 | + print _("No data available"); |
|
| 1014 | + } else { |
|
| 946 | 1015 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 947 | 1016 | $hour_data = ''; |
| 948 | 1017 | $hour_cnt = ''; |
@@ -961,7 +1030,10 @@ discard block |
||
| 961 | 1030 | } |
| 962 | 1031 | ?> |
| 963 | 1032 | <div class="more"> |
| 964 | - <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> |
|
| 1033 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 1034 | + echo '/'.$airline_icao; |
|
| 1035 | +} |
|
| 1036 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 965 | 1037 | </div> |
| 966 | 1038 | </div> |
| 967 | 1039 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -981,8 +1053,9 @@ discard block |
||
| 981 | 1053 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 982 | 1054 | <?php |
| 983 | 1055 | $year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name); |
| 984 | - if (count($year_array) == 0) print _("No data available"); |
|
| 985 | - else { |
|
| 1056 | + if (count($year_array) == 0) { |
|
| 1057 | + print _("No data available"); |
|
| 1058 | + } else { |
|
| 986 | 1059 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 987 | 1060 | $year_data = ''; |
| 988 | 1061 | $year_cnt = ''; |
@@ -1010,8 +1083,9 @@ discard block |
||
| 1010 | 1083 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 1011 | 1084 | <?php |
| 1012 | 1085 | $month_array = $Stats->countAllMarineDatesLastMonth($filter_name); |
| 1013 | - if (count($month_array) == 0) print _("No data available"); |
|
| 1014 | - else { |
|
| 1086 | + if (count($month_array) == 0) { |
|
| 1087 | + print _("No data available"); |
|
| 1088 | + } else { |
|
| 1015 | 1089 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 1016 | 1090 | $month_data = ''; |
| 1017 | 1091 | $month_cnt = ''; |
@@ -1039,8 +1113,9 @@ discard block |
||
| 1039 | 1113 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 1040 | 1114 | <?php |
| 1041 | 1115 | $date_array = $Stats->countAllMarineDatesLast7Days($filter_name); |
| 1042 | - if (empty($date_array)) print _("No data available"); |
|
| 1043 | - else { |
|
| 1116 | + if (empty($date_array)) { |
|
| 1117 | + print _("No data available"); |
|
| 1118 | + } else { |
|
| 1044 | 1119 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 1045 | 1120 | $date_data = ''; |
| 1046 | 1121 | $date_cnt = ''; |
@@ -1067,8 +1142,9 @@ discard block |
||
| 1067 | 1142 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 1068 | 1143 | <?php |
| 1069 | 1144 | $hour_array = $Stats->countAllMarineHours('hour',true,$filter_name); |
| 1070 | - if (empty($hour_array)) print _("No data available"); |
|
| 1071 | - else { |
|
| 1145 | + if (empty($hour_array)) { |
|
| 1146 | + print _("No data available"); |
|
| 1147 | + } else { |
|
| 1072 | 1148 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 1073 | 1149 | $hour_data = ''; |
| 1074 | 1150 | $hour_cnt = ''; |
@@ -1107,8 +1183,9 @@ discard block |
||
| 1107 | 1183 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 1108 | 1184 | <?php |
| 1109 | 1185 | $year_array = $Stats->countAllTrackerMonthsLastYear(true); |
| 1110 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1111 | - else { |
|
| 1186 | + if (count($year_array) == 0) { |
|
| 1187 | + print _("No data available"); |
|
| 1188 | + } else { |
|
| 1112 | 1189 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 1113 | 1190 | $year_data = ''; |
| 1114 | 1191 | $year_cnt = ''; |
@@ -1136,8 +1213,9 @@ discard block |
||
| 1136 | 1213 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 1137 | 1214 | <?php |
| 1138 | 1215 | $month_array = $Stats->countAllTrackerDatesLastMonth(); |
| 1139 | - if (count($month_array) == 0) print _("No data available"); |
|
| 1140 | - else { |
|
| 1216 | + if (count($month_array) == 0) { |
|
| 1217 | + print _("No data available"); |
|
| 1218 | + } else { |
|
| 1141 | 1219 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 1142 | 1220 | $month_data = ''; |
| 1143 | 1221 | $month_cnt = ''; |
@@ -1165,8 +1243,9 @@ discard block |
||
| 1165 | 1243 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 1166 | 1244 | <?php |
| 1167 | 1245 | $date_array = $Stats->countAllTrackerDatesLast7Days(); |
| 1168 | - if (empty($date_array)) print _("No data available"); |
|
| 1169 | - else { |
|
| 1246 | + if (empty($date_array)) { |
|
| 1247 | + print _("No data available"); |
|
| 1248 | + } else { |
|
| 1170 | 1249 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 1171 | 1250 | $date_data = ''; |
| 1172 | 1251 | $date_cnt = ''; |
@@ -1193,8 +1272,9 @@ discard block |
||
| 1193 | 1272 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 1194 | 1273 | <?php |
| 1195 | 1274 | $hour_array = $Stats->countAllTrackerHours('hour',true); |
| 1196 | - if (empty($hour_array)) print _("No data available"); |
|
| 1197 | - else { |
|
| 1275 | + if (empty($hour_array)) { |
|
| 1276 | + print _("No data available"); |
|
| 1277 | + } else { |
|
| 1198 | 1278 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 1199 | 1279 | $hour_data = ''; |
| 1200 | 1280 | $hour_cnt = ''; |
@@ -1233,8 +1313,9 @@ discard block |
||
| 1233 | 1313 | <h2><?php echo _("Busiest Launch Months of the last 12 Months"); ?></h2> |
| 1234 | 1314 | <?php |
| 1235 | 1315 | $year_array = $Satellite->countAllMonthsLastYear(); |
| 1236 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1237 | - else { |
|
| 1316 | + if (count($year_array) == 0) { |
|
| 1317 | + print _("No data available"); |
|
| 1318 | + } else { |
|
| 1238 | 1319 | print '<div id="chart21" class="chart" width="100%"></div><script>'; |
| 1239 | 1320 | $year_data = ''; |
| 1240 | 1321 | $year_cnt = ''; |
@@ -1264,8 +1345,9 @@ discard block |
||
| 1264 | 1345 | <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2> |
| 1265 | 1346 | <?php |
| 1266 | 1347 | $year_array = $Satellite->countAllYears(); |
| 1267 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1268 | - else { |
|
| 1348 | + if (count($year_array) == 0) { |
|
| 1349 | + print _("No data available"); |
|
| 1350 | + } else { |
|
| 1269 | 1351 | print '<div id="chart22" class="chart" width="100%"></div><script>'; |
| 1270 | 1352 | $year_data = ''; |
| 1271 | 1353 | $year_cnt = ''; |
@@ -1307,8 +1389,9 @@ discard block |
||
| 1307 | 1389 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
| 1308 | 1390 | <?php |
| 1309 | 1391 | $year_array = $Stats->countFatalitiesByYear(); |
| 1310 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1311 | - else { |
|
| 1392 | + if (count($year_array) == 0) { |
|
| 1393 | + print _("No data available"); |
|
| 1394 | + } else { |
|
| 1312 | 1395 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
| 1313 | 1396 | $year_data = ''; |
| 1314 | 1397 | $year_cnt = ''; |
@@ -1337,8 +1420,9 @@ discard block |
||
| 1337 | 1420 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
| 1338 | 1421 | <?php |
| 1339 | 1422 | $year_array = $Stats->countFatalitiesLast12Months(); |
| 1340 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1341 | - else { |
|
| 1423 | + if (count($year_array) == 0) { |
|
| 1424 | + print _("No data available"); |
|
| 1425 | + } else { |
|
| 1342 | 1426 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
| 1343 | 1427 | $year_data = ''; |
| 1344 | 1428 | $year_cnt = ''; |
@@ -1409,8 +1493,11 @@ discard block |
||
| 1409 | 1493 | $distance = $distance; |
| 1410 | 1494 | $unit = 'km'; |
| 1411 | 1495 | } |
| 1412 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1413 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1496 | + if (!isset($polar_data)) { |
|
| 1497 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1498 | + } else { |
|
| 1499 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1500 | + } |
|
| 1414 | 1501 | } |
| 1415 | 1502 | ?> |
| 1416 | 1503 | <div class="col-md-6"> |
@@ -1474,9 +1561,12 @@ discard block |
||
| 1474 | 1561 | foreach ($msg as $eachmsg) { |
| 1475 | 1562 | //$eachmsg = $msg[0]; |
| 1476 | 1563 | $data = $eachmsg['source_data']; |
| 1477 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 1478 | - else $max = 500; |
|
| 1479 | -?> |
|
| 1564 | + if ($data > 500) { |
|
| 1565 | + $max = (round(($data+100)/100))*100; |
|
| 1566 | + } else { |
|
| 1567 | + $max = 500; |
|
| 1568 | + } |
|
| 1569 | + ?> |
|
| 1480 | 1570 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
| 1481 | 1571 | <script> |
| 1482 | 1572 | var g = new JustGage({ |
@@ -14,13 +14,17 @@ discard block |
||
| 14 | 14 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
| 15 | 15 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
| 16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
| 17 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 17 | +if (isset($globalTracker) && $globalTracker) { |
|
| 18 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 19 | +} |
|
| 18 | 20 | if (isset($globalMarine) && $globalMarine) { |
| 19 | 21 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 20 | 22 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 21 | 23 | } |
| 22 | 24 | |
| 23 | -if (!isset($globalDebug)) $globalDebug = FALSE; |
|
| 25 | +if (!isset($globalDebug)) { |
|
| 26 | + $globalDebug = FALSE; |
|
| 27 | +} |
|
| 24 | 28 | |
| 25 | 29 | // Check if schema is at latest version |
| 26 | 30 | $Connection = new Connection(); |
@@ -59,66 +63,107 @@ discard block |
||
| 59 | 63 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 60 | 64 | if (isset($options['s'])) { |
| 61 | 65 | $globalSources = array(); |
| 62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 63 | - else $globalSources[] = array('host' => $options['s']); |
|
| 64 | -} elseif (isset($options['source'])) { |
|
| 66 | + if (isset($options['format'])) { |
|
| 67 | + $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 68 | + } else { |
|
| 69 | + $globalSources[] = array('host' => $options['s']); |
|
| 70 | + } |
|
| 71 | + } elseif (isset($options['source'])) { |
|
| 65 | 72 | $globalSources = array(); |
| 66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 67 | - else $globalSources[] = array('host' => $options['source']); |
|
| 68 | -} |
|
| 73 | + if (isset($options['format'])) { |
|
| 74 | + $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 75 | + } else { |
|
| 76 | + $globalSources[] = array('host' => $options['source']); |
|
| 77 | + } |
|
| 78 | + } |
|
| 69 | 79 | if (isset($options['aprsserverhost'])) { |
| 70 | 80 | $globalServerAPRS = TRUE; |
| 71 | 81 | $globalServerAPRShost = $options['aprsserverhost']; |
| 72 | 82 | } |
| 73 | -if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport']; |
|
| 74 | -if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 75 | -if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 76 | -if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; |
|
| 83 | +if (isset($options['aprsserverport'])) { |
|
| 84 | + $globalServerAPRSport = $options['aprsserverport']; |
|
| 85 | +} |
|
| 86 | +if (isset($options['aprsserverssid'])) { |
|
| 87 | + $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 88 | +} |
|
| 89 | +if (isset($options['aprsserverpass'])) { |
|
| 90 | + $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 91 | +} |
|
| 92 | +if (isset($options['noaprsserver'])) { |
|
| 93 | + $globalServerAPRS = FALSE; |
|
| 94 | +} |
|
| 77 | 95 | if (isset($options['enable-aircraft'])) { |
| 78 | - if ($globalDebug) echo 'Enable Aircraft mode'."\n"; |
|
| 96 | + if ($globalDebug) { |
|
| 97 | + echo 'Enable Aircraft mode'."\n"; |
|
| 98 | + } |
|
| 79 | 99 | $globalAircraft = TRUE; |
| 80 | 100 | } |
| 81 | 101 | if (isset($options['disable-aircraft'])) { |
| 82 | - if ($globalDebug) echo 'Disable Aircraft mode'."\n"; |
|
| 102 | + if ($globalDebug) { |
|
| 103 | + echo 'Disable Aircraft mode'."\n"; |
|
| 104 | + } |
|
| 83 | 105 | $globalAircraft = FALSE; |
| 84 | 106 | } |
| 85 | 107 | if (isset($options['enable-tracker'])) { |
| 86 | - if ($globalDebug) echo 'Enable Tracker mode'."\n"; |
|
| 108 | + if ($globalDebug) { |
|
| 109 | + echo 'Enable Tracker mode'."\n"; |
|
| 110 | + } |
|
| 87 | 111 | $globalTracker = TRUE; |
| 88 | 112 | } |
| 89 | 113 | if (isset($options['disable-tracker'])) { |
| 90 | - if ($globalDebug) echo 'Disable Tracker mode'."\n"; |
|
| 114 | + if ($globalDebug) { |
|
| 115 | + echo 'Disable Tracker mode'."\n"; |
|
| 116 | + } |
|
| 91 | 117 | $globalTracker = FALSE; |
| 92 | 118 | } |
| 93 | 119 | if (isset($options['enable-marine'])) { |
| 94 | - if ($globalDebug) echo 'Enable Marine mode'."\n"; |
|
| 120 | + if ($globalDebug) { |
|
| 121 | + echo 'Enable Marine mode'."\n"; |
|
| 122 | + } |
|
| 95 | 123 | $globalMarine = TRUE; |
| 96 | 124 | } |
| 97 | 125 | if (isset($options['disable-marine'])) { |
| 98 | - if ($globalDebug) echo 'Disable Marine mode'."\n"; |
|
| 126 | + if ($globalDebug) { |
|
| 127 | + echo 'Disable Marine mode'."\n"; |
|
| 128 | + } |
|
| 99 | 129 | $globalMarine = FALSE; |
| 100 | 130 | } |
| 101 | -if (isset($options['nodaemon'])) $globalDaemon = FALSE; |
|
| 102 | -if (isset($options['server'])) $globalServer = TRUE; |
|
| 103 | -if (isset($options['idsource'])) $id_source = $options['idsource']; |
|
| 104 | -else $id_source = 1; |
|
| 131 | +if (isset($options['nodaemon'])) { |
|
| 132 | + $globalDaemon = FALSE; |
|
| 133 | +} |
|
| 134 | +if (isset($options['server'])) { |
|
| 135 | + $globalServer = TRUE; |
|
| 136 | +} |
|
| 137 | +if (isset($options['idsource'])) { |
|
| 138 | + $id_source = $options['idsource']; |
|
| 139 | +} else { |
|
| 140 | + $id_source = 1; |
|
| 141 | +} |
|
| 105 | 142 | if (isset($globalServer) && $globalServer) { |
| 106 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 143 | + if ($globalDebug) { |
|
| 144 | + echo "Using Server Mode\n"; |
|
| 145 | + } |
|
| 107 | 146 | $SI=new SpotterServer(); |
| 108 | 147 | /* |
| 109 | 148 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 110 | 149 | $SI = new adsb2aprs(); |
| 111 | 150 | $SI->connect(); |
| 112 | 151 | */ |
| 113 | -} else $SI=new SpotterImport($Connection->db); |
|
| 152 | +} else { |
|
| 153 | + $SI=new SpotterImport($Connection->db); |
|
| 154 | +} |
|
| 114 | 155 | |
| 115 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 156 | +if (isset($globalTracker) && $globalTracker) { |
|
| 157 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 158 | +} |
|
| 116 | 159 | if (isset($globalMarine) && $globalMarine) { |
| 117 | 160 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 118 | 161 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 119 | 162 | } |
| 120 | 163 | |
| 121 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
|
| 164 | +if (isset($globalTracker) && $globalTracker) { |
|
| 165 | + $TI = new TrackerImport($Connection->db); |
|
| 166 | +} |
|
| 122 | 167 | if (isset($globalMarine) && $globalMarine) { |
| 123 | 168 | $AIS = new AIS(); |
| 124 | 169 | $MI = new MarineImport($Connection->db); |
@@ -143,7 +188,9 @@ discard block |
||
| 143 | 188 | } |
| 144 | 189 | |
| 145 | 190 | // let's try and connect |
| 146 | -if ($globalDebug) echo "Connecting...\n"; |
|
| 191 | +if ($globalDebug) { |
|
| 192 | + echo "Connecting...\n"; |
|
| 193 | +} |
|
| 147 | 194 | $use_aprs = false; |
| 148 | 195 | $aprs_full = false; |
| 149 | 196 | $reset = 0; |
@@ -152,7 +199,9 @@ discard block |
||
| 152 | 199 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
| 153 | 200 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
| 154 | 201 | $reset++; |
| 155 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 202 | + if ($globalDebug) { |
|
| 203 | + echo 'Connect to all...'."\n"; |
|
| 204 | + } |
|
| 156 | 205 | foreach ($hosts as $id => $value) { |
| 157 | 206 | $host = $value['host']; |
| 158 | 207 | $globalSources[$id]['last_exec'] = 0; |
@@ -162,32 +211,44 @@ discard block |
||
| 162 | 211 | //$formats[$id] = 'deltadbtxt'; |
| 163 | 212 | $globalSources[$id]['format'] = 'deltadbtxt'; |
| 164 | 213 | //$last_exec['deltadbtxt'] = 0; |
| 165 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 214 | + if ($globalDebug) { |
|
| 215 | + echo "Connect to deltadb source (".$host.")...\n"; |
|
| 216 | + } |
|
| 166 | 217 | } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
| 167 | 218 | //$formats[$id] = 'vatsimtxt'; |
| 168 | 219 | $globalSources[$id]['format'] = 'vatsimtxt'; |
| 169 | 220 | //$last_exec['vatsimtxt'] = 0; |
| 170 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 221 | + if ($globalDebug) { |
|
| 222 | + echo "Connect to vatsim source (".$host.")...\n"; |
|
| 223 | + } |
|
| 171 | 224 | } else if (preg_match('/aircraftlist.json$/i',$host)) { |
| 172 | 225 | //$formats[$id] = 'aircraftlistjson'; |
| 173 | 226 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
| 174 | 227 | //$last_exec['aircraftlistjson'] = 0; |
| 175 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 228 | + if ($globalDebug) { |
|
| 229 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 230 | + } |
|
| 176 | 231 | } else if (preg_match('/aircraft.json$/i',$host)) { |
| 177 | 232 | //$formats[$id] = 'aircraftjson'; |
| 178 | 233 | $globalSources[$id]['format'] = 'aircraftjson'; |
| 179 | 234 | //$last_exec['aircraftlistjson'] = 0; |
| 180 | - if ($globalDebug) echo "Connect to aircraft.json source (".$host.")...\n"; |
|
| 235 | + if ($globalDebug) { |
|
| 236 | + echo "Connect to aircraft.json source (".$host.")...\n"; |
|
| 237 | + } |
|
| 181 | 238 | } else if (preg_match('/aircraft$/i',$host)) { |
| 182 | 239 | //$formats[$id] = 'planefinderclient'; |
| 183 | 240 | $globalSources[$id]['format'] = 'planefinderclient'; |
| 184 | 241 | //$last_exec['aircraftlistjson'] = 0; |
| 185 | - if ($globalDebug) echo "Connect to planefinderclient source (".$host.")...\n"; |
|
| 242 | + if ($globalDebug) { |
|
| 243 | + echo "Connect to planefinderclient source (".$host.")...\n"; |
|
| 244 | + } |
|
| 186 | 245 | } else if (preg_match('/opensky/i',$host)) { |
| 187 | 246 | //$formats[$id] = 'aircraftlistjson'; |
| 188 | 247 | $globalSources[$id]['format'] = 'opensky'; |
| 189 | 248 | //$last_exec['aircraftlistjson'] = 0; |
| 190 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 249 | + if ($globalDebug) { |
|
| 250 | + echo "Connect to opensky source (".$host.")...\n"; |
|
| 251 | + } |
|
| 191 | 252 | /* |
| 192 | 253 | // Disabled for now, site change source format |
| 193 | 254 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -204,7 +265,9 @@ discard block |
||
| 204 | 265 | //$formats[$id] = 'planeupdatefaa'; |
| 205 | 266 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 206 | 267 | //$last_exec['planeupdatefaa'] = 0; |
| 207 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 268 | + if ($globalDebug) { |
|
| 269 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 270 | + } |
|
| 208 | 271 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 209 | 272 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 210 | 273 | exit(0); |
@@ -213,37 +276,53 @@ discard block |
||
| 213 | 276 | //$formats[$id] = 'phpvmacars'; |
| 214 | 277 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 215 | 278 | //$last_exec['phpvmacars'] = 0; |
| 216 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 279 | + if ($globalDebug) { |
|
| 280 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 281 | + } |
|
| 217 | 282 | } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
| 218 | 283 | //$formats[$id] = 'phpvmacars'; |
| 219 | 284 | $globalSources[$id]['format'] = 'vaos'; |
| 220 | 285 | //$last_exec['phpvmacars'] = 0; |
| 221 | - if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
|
| 286 | + if ($globalDebug) { |
|
| 287 | + echo "Connect to vaos source (".$host.")...\n"; |
|
| 288 | + } |
|
| 222 | 289 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
| 223 | 290 | //$formats[$id] = 'phpvmacars'; |
| 224 | 291 | $globalSources[$id]['format'] = 'vam'; |
| 225 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 292 | + if ($globalDebug) { |
|
| 293 | + echo "Connect to Vam source (".$host.")...\n"; |
|
| 294 | + } |
|
| 226 | 295 | } else if (preg_match('/whazzup/i',$host)) { |
| 227 | 296 | //$formats[$id] = 'whazzup'; |
| 228 | 297 | $globalSources[$id]['format'] = 'whazzup'; |
| 229 | 298 | //$last_exec['whazzup'] = 0; |
| 230 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 299 | + if ($globalDebug) { |
|
| 300 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
| 301 | + } |
|
| 231 | 302 | } else if (preg_match('/blitzortung/i',$host)) { |
| 232 | 303 | $globalSources[$id]['format'] = 'blitzortung'; |
| 233 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 304 | + if ($globalDebug) { |
|
| 305 | + echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 306 | + } |
|
| 234 | 307 | } else if (preg_match('/airwhere/i',$host)) { |
| 235 | 308 | $globalSources[$id]['format'] = 'airwhere'; |
| 236 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 309 | + if ($globalDebug) { |
|
| 310 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
| 311 | + } |
|
| 237 | 312 | } else if (preg_match('/recentpireps/i',$host)) { |
| 238 | 313 | //$formats[$id] = 'pirepsjson'; |
| 239 | 314 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 240 | 315 | //$last_exec['pirepsjson'] = 0; |
| 241 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 316 | + if ($globalDebug) { |
|
| 317 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 318 | + } |
|
| 242 | 319 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
| 243 | 320 | //$formats[$id] = 'fr24json'; |
| 244 | 321 | $globalSources[$id]['format'] = 'fr24json'; |
| 245 | 322 | //$last_exec['fr24json'] = 0; |
| 246 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 323 | + if ($globalDebug) { |
|
| 324 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
| 325 | + } |
|
| 247 | 326 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 248 | 327 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 249 | 328 | exit(0); |
@@ -252,7 +331,9 @@ discard block |
||
| 252 | 331 | //$formats[$id] = 'fr24json'; |
| 253 | 332 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 254 | 333 | //$last_exec['fr24json'] = 0; |
| 255 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 334 | + if ($globalDebug) { |
|
| 335 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 336 | + } |
|
| 256 | 337 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 257 | 338 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 258 | 339 | exit(0); |
@@ -261,17 +342,26 @@ discard block |
||
| 261 | 342 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
| 262 | 343 | //$formats[$id] = 'tsv'; |
| 263 | 344 | $globalSources[$id]['format'] = 'tsv'; |
| 264 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 345 | + if ($globalDebug) { |
|
| 346 | + echo "Connect to tsv source (".$host.")...\n"; |
|
| 347 | + } |
|
| 265 | 348 | } |
| 266 | 349 | } elseif (filter_var($host,FILTER_VALIDATE_URL) || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway')) { |
| 267 | 350 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
| 268 | 351 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
| 269 | 352 | if ($idf !== false) { |
| 270 | 353 | $httpfeeds[$id] = $idf; |
| 271 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 272 | - } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 273 | - } elseif ($globalDebug && isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') echo "Connect to ".$globalSources[$id]['format']." source (sailaway)...\n"; |
|
| 274 | - elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 354 | + if ($globalDebug) { |
|
| 355 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 356 | + } |
|
| 357 | + } elseif ($globalDebug) { |
|
| 358 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 359 | + } |
|
| 360 | + } elseif ($globalDebug && isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') { |
|
| 361 | + echo "Connect to ".$globalSources[$id]['format']." source (sailaway)...\n"; |
|
| 362 | + } elseif ($globalDebug) { |
|
| 363 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 364 | + } |
|
| 275 | 365 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
| 276 | 366 | $hostport = explode(':',$host); |
| 277 | 367 | if (isset($hostport[1])) { |
@@ -311,19 +401,27 @@ discard block |
||
| 311 | 401 | //$formats[$id] = 'beast'; |
| 312 | 402 | $globalSources[$id]['format'] = 'beast'; |
| 313 | 403 | //} else $formats[$id] = 'sbs'; |
| 314 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 404 | + } else { |
|
| 405 | + $globalSources[$id]['format'] = 'sbs'; |
|
| 406 | + } |
|
| 315 | 407 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
| 316 | 408 | } |
| 317 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 409 | + if ($globalDebug) { |
|
| 410 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 411 | + } |
|
| 318 | 412 | } else { |
| 319 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 413 | + if ($globalDebug) { |
|
| 414 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 415 | + } |
|
| 320 | 416 | sleep(10); |
| 321 | 417 | connect_all($hosts); |
| 322 | 418 | } |
| 323 | 419 | } |
| 324 | 420 | } |
| 325 | 421 | } |
| 326 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
| 422 | +if (!isset($globalMinFetch)) { |
|
| 423 | + $globalMinFetch = 15; |
|
| 424 | +} |
|
| 327 | 425 | |
| 328 | 426 | // Initialize all |
| 329 | 427 | $status = array(); |
@@ -332,13 +430,19 @@ discard block |
||
| 332 | 430 | $formats = array(); |
| 333 | 431 | $last_exec = array(); |
| 334 | 432 | $time = time(); |
| 335 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
| 336 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
| 337 | -else $timeout = 20; |
|
| 433 | +if (isset($globalSourcesTimeout)) { |
|
| 434 | + $timeout = $globalSourcesTimeOut; |
|
| 435 | +} else if (isset($globalSBS1TimeOut)) { |
|
| 436 | + $timeout = $globalSBS1TimeOut; |
|
| 437 | +} else { |
|
| 438 | + $timeout = 20; |
|
| 439 | +} |
|
| 338 | 440 | $errno = ''; |
| 339 | 441 | $errstr=''; |
| 340 | 442 | |
| 341 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 443 | +if (!isset($globalDaemon)) { |
|
| 444 | + $globalDaemon = TRUE; |
|
| 445 | +} |
|
| 342 | 446 | /* Initiate connections to all the hosts simultaneously */ |
| 343 | 447 | //connect_all($hosts); |
| 344 | 448 | //connect_all($globalSources); |
@@ -367,7 +471,9 @@ discard block |
||
| 367 | 471 | if (isset($source['format']) && $source['format'] == 'aprs') { |
| 368 | 472 | $aprs_connect = 0; |
| 369 | 473 | $use_aprs = true; |
| 370 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
| 474 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
| 475 | + $aprs_full = true; |
|
| 476 | + } |
|
| 371 | 477 | break; |
| 372 | 478 | } |
| 373 | 479 | } |
@@ -378,25 +484,46 @@ discard block |
||
| 378 | 484 | $aprs_connect = 0; |
| 379 | 485 | $aprs_keep = 120; |
| 380 | 486 | $aprs_last_tx = time(); |
| 381 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
| 382 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 383 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
| 384 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 385 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
| 386 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 387 | - if ($aprs_full) $aprs_filter = ''; |
|
| 388 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
| 389 | - else $aprs_pass = '-1'; |
|
| 487 | + if (isset($globalAPRSversion)) { |
|
| 488 | + $aprs_version = $globalAPRSversion; |
|
| 489 | + } else { |
|
| 490 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 491 | + } |
|
| 492 | + if (isset($globalAPRSssid)) { |
|
| 493 | + $aprs_ssid = $globalAPRSssid; |
|
| 494 | + } else { |
|
| 495 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 496 | + } |
|
| 497 | + if (isset($globalAPRSfilter)) { |
|
| 498 | + $aprs_filter = $globalAPRSfilter; |
|
| 499 | + } else { |
|
| 500 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 501 | + } |
|
| 502 | + if ($aprs_full) { |
|
| 503 | + $aprs_filter = ''; |
|
| 504 | + } |
|
| 505 | + if (isset($globalAPRSpass)) { |
|
| 506 | + $aprs_pass = $globalAPRSpass; |
|
| 507 | + } else { |
|
| 508 | + $aprs_pass = '-1'; |
|
| 509 | + } |
|
| 390 | 510 | |
| 391 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 392 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 393 | -} |
|
| 511 | + if ($aprs_filter != '') { |
|
| 512 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 513 | + } else { |
|
| 514 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 515 | + } |
|
| 516 | + } |
|
| 394 | 517 | |
| 395 | 518 | // connected - lets do some work |
| 396 | 519 | //if ($globalDebug) echo "Connected!\n"; |
| 397 | 520 | sleep(1); |
| 398 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
| 399 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
| 521 | +if ($globalDebug) { |
|
| 522 | + echo "SCAN MODE \n\n"; |
|
| 523 | +} |
|
| 524 | +if (!isset($globalCronEnd)) { |
|
| 525 | + $globalCronEnd = 60; |
|
| 526 | +} |
|
| 400 | 527 | $endtime = time()+$globalCronEnd; |
| 401 | 528 | $i = 1; |
| 402 | 529 | $tt = array(); |
@@ -410,22 +537,32 @@ discard block |
||
| 410 | 537 | |
| 411 | 538 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 412 | 539 | while ($i > 0) { |
| 413 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 540 | + if (function_exists('pcntl_fork')) { |
|
| 541 | + pcntl_signal_dispatch(); |
|
| 542 | + } |
|
| 414 | 543 | |
| 415 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 544 | + if (!$globalDaemon) { |
|
| 545 | + $i = $endtime-time(); |
|
| 546 | + } |
|
| 416 | 547 | // Delete old ATC |
| 417 | 548 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 418 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
| 549 | + if ($globalDebug) { |
|
| 550 | + echo 'Delete old ATC...'."\n"; |
|
| 551 | + } |
|
| 419 | 552 | $ATC->deleteOldATC(); |
| 420 | 553 | } |
| 421 | 554 | |
| 422 | 555 | if (count($last_exec) == count($globalSources)) { |
| 423 | 556 | $max = $globalMinFetch; |
| 424 | 557 | foreach ($last_exec as $last) { |
| 425 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 558 | + if ((time() - $last['last']) < $max) { |
|
| 559 | + $max = time() - $last['last']; |
|
| 560 | + } |
|
| 426 | 561 | } |
| 427 | 562 | if ($max < $globalMinFetch) { |
| 428 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 563 | + if ($globalDebug) { |
|
| 564 | + echo 'Sleeping...'."\n"; |
|
| 565 | + } |
|
| 429 | 566 | sleep($globalMinFetch-$max+2); |
| 430 | 567 | } |
| 431 | 568 | } |
@@ -435,7 +572,9 @@ discard block |
||
| 435 | 572 | foreach ($globalSources as $id => $value) { |
| 436 | 573 | date_default_timezone_set('UTC'); |
| 437 | 574 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
| 438 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
|
| 575 | + if (!isset($last_exec[$id]['last'])) { |
|
| 576 | + $last_exec[$id]['last'] = 0; |
|
| 577 | + } |
|
| 439 | 578 | if ($value['format'] === 'deltadbtxt' && |
| 440 | 579 | ( |
| 441 | 580 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
@@ -444,7 +583,9 @@ discard block |
||
| 444 | 583 | ) { |
| 445 | 584 | //$buffer = $Common->getData($hosts[$id]); |
| 446 | 585 | $buffer = $Common->getData($value['host']); |
| 447 | - if ($buffer != '') $reset = 0; |
|
| 586 | + if ($buffer != '') { |
|
| 587 | + $reset = 0; |
|
| 588 | + } |
|
| 448 | 589 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 449 | 590 | $buffer = explode('\n',$buffer); |
| 450 | 591 | foreach ($buffer as $line) { |
@@ -453,20 +594,41 @@ discard block |
||
| 453 | 594 | $data = array(); |
| 454 | 595 | $data['hex'] = $line[1]; // hex |
| 455 | 596 | $data['ident'] = $line[2]; // ident |
| 456 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 457 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 458 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 459 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 460 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 597 | + if (isset($line[3])) { |
|
| 598 | + $data['altitude'] = $line[3]; |
|
| 599 | + } |
|
| 600 | + // altitude |
|
| 601 | + if (isset($line[4])) { |
|
| 602 | + $data['speed'] = $line[4]; |
|
| 603 | + } |
|
| 604 | + // speed |
|
| 605 | + if (isset($line[5])) { |
|
| 606 | + $data['heading'] = $line[5]; |
|
| 607 | + } |
|
| 608 | + // heading |
|
| 609 | + if (isset($line[6])) { |
|
| 610 | + $data['latitude'] = $line[6]; |
|
| 611 | + } |
|
| 612 | + // lat |
|
| 613 | + if (isset($line[7])) { |
|
| 614 | + $data['longitude'] = $line[7]; |
|
| 615 | + } |
|
| 616 | + // long |
|
| 461 | 617 | $data['verticalrate'] = ''; // vertical rate |
| 462 | 618 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
| 463 | 619 | $data['emergency'] = ''; // emergency |
| 464 | 620 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 465 | 621 | $data['format_source'] = 'deltadbtxt'; |
| 466 | 622 | $data['id_source'] = $id_source; |
| 467 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 468 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 469 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 623 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 624 | + $data['source_name'] = $value['name']; |
|
| 625 | + } |
|
| 626 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 627 | + $data['noarchive'] = true; |
|
| 628 | + } |
|
| 629 | + if (isset($value['sourcestats'])) { |
|
| 630 | + $data['sourcestats'] = $value['sourcestats']; |
|
| 631 | + } |
|
| 470 | 632 | $SI->add($data); |
| 471 | 633 | unset($data); |
| 472 | 634 | } |
@@ -481,7 +643,9 @@ discard block |
||
| 481 | 643 | date_default_timezone_set('CET'); |
| 482 | 644 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
| 483 | 645 | date_default_timezone_set('UTC'); |
| 484 | - if ($buffer != '') $reset = 0; |
|
| 646 | + if ($buffer != '') { |
|
| 647 | + $reset = 0; |
|
| 648 | + } |
|
| 485 | 649 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 486 | 650 | $buffer = explode('\n',$buffer); |
| 487 | 651 | foreach ($buffer as $line) { |
@@ -490,18 +654,42 @@ discard block |
||
| 490 | 654 | $add = false; |
| 491 | 655 | $ais_data = $AIS->parse_line(trim($line)); |
| 492 | 656 | $data = array(); |
| 493 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 494 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 495 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 496 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 497 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 498 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 499 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 500 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 501 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 502 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 503 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 504 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 657 | + if (isset($ais_data['ident'])) { |
|
| 658 | + $data['ident'] = $ais_data['ident']; |
|
| 659 | + } |
|
| 660 | + if (isset($ais_data['mmsi'])) { |
|
| 661 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 662 | + } |
|
| 663 | + if (isset($ais_data['speed'])) { |
|
| 664 | + $data['speed'] = $ais_data['speed']; |
|
| 665 | + } |
|
| 666 | + if (isset($ais_data['heading'])) { |
|
| 667 | + $data['heading'] = $ais_data['heading']; |
|
| 668 | + } |
|
| 669 | + if (isset($ais_data['latitude'])) { |
|
| 670 | + $data['latitude'] = $ais_data['latitude']; |
|
| 671 | + } |
|
| 672 | + if (isset($ais_data['longitude'])) { |
|
| 673 | + $data['longitude'] = $ais_data['longitude']; |
|
| 674 | + } |
|
| 675 | + if (isset($ais_data['status'])) { |
|
| 676 | + $data['status'] = $ais_data['status']; |
|
| 677 | + } |
|
| 678 | + if (isset($ais_data['statusid'])) { |
|
| 679 | + $data['status_id'] = $ais_data['statusid']; |
|
| 680 | + } |
|
| 681 | + if (isset($ais_data['type'])) { |
|
| 682 | + $data['type'] = $ais_data['type']; |
|
| 683 | + } |
|
| 684 | + if (isset($ais_data['typeid'])) { |
|
| 685 | + $data['type_id'] = $ais_data['typeid']; |
|
| 686 | + } |
|
| 687 | + if (isset($ais_data['imo'])) { |
|
| 688 | + $data['imo'] = $ais_data['imo']; |
|
| 689 | + } |
|
| 690 | + if (isset($ais_data['callsign'])) { |
|
| 691 | + $data['callsign'] = $ais_data['callsign']; |
|
| 692 | + } |
|
| 505 | 693 | if (isset($ais_data['timestamp'])) { |
| 506 | 694 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 507 | 695 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -515,8 +703,12 @@ discard block |
||
| 515 | 703 | $data['format_source'] = 'aisnmeatxt'; |
| 516 | 704 | $data['id_source'] = $id_source; |
| 517 | 705 | //print_r($data); |
| 518 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 519 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 706 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 707 | + $data['noarchive'] = true; |
|
| 708 | + } |
|
| 709 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 710 | + $MI->add($data); |
|
| 711 | + } |
|
| 520 | 712 | unset($data); |
| 521 | 713 | } |
| 522 | 714 | } |
@@ -539,20 +731,48 @@ discard block |
||
| 539 | 731 | if ($line != '') { |
| 540 | 732 | $ais_data = $AIS->parse_line(trim($line)); |
| 541 | 733 | $data = array(); |
| 542 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 543 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 544 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 545 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 546 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 547 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 548 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 549 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 550 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 551 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 552 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 553 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 554 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 555 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 734 | + if (isset($ais_data['ident'])) { |
|
| 735 | + $data['ident'] = $ais_data['ident']; |
|
| 736 | + } |
|
| 737 | + if (isset($ais_data['mmsi'])) { |
|
| 738 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 739 | + } |
|
| 740 | + if (isset($ais_data['speed'])) { |
|
| 741 | + $data['speed'] = $ais_data['speed']; |
|
| 742 | + } |
|
| 743 | + if (isset($ais_data['heading'])) { |
|
| 744 | + $data['heading'] = $ais_data['heading']; |
|
| 745 | + } |
|
| 746 | + if (isset($ais_data['latitude'])) { |
|
| 747 | + $data['latitude'] = $ais_data['latitude']; |
|
| 748 | + } |
|
| 749 | + if (isset($ais_data['longitude'])) { |
|
| 750 | + $data['longitude'] = $ais_data['longitude']; |
|
| 751 | + } |
|
| 752 | + if (isset($ais_data['status'])) { |
|
| 753 | + $data['status'] = $ais_data['status']; |
|
| 754 | + } |
|
| 755 | + if (isset($ais_data['statusid'])) { |
|
| 756 | + $data['status_id'] = $ais_data['statusid']; |
|
| 757 | + } |
|
| 758 | + if (isset($ais_data['type'])) { |
|
| 759 | + $data['type'] = $ais_data['type']; |
|
| 760 | + } |
|
| 761 | + if (isset($ais_data['typeid'])) { |
|
| 762 | + $data['type_id'] = $ais_data['typeid']; |
|
| 763 | + } |
|
| 764 | + if (isset($ais_data['imo'])) { |
|
| 765 | + $data['imo'] = $ais_data['imo']; |
|
| 766 | + } |
|
| 767 | + if (isset($ais_data['callsign'])) { |
|
| 768 | + $data['callsign'] = $ais_data['callsign']; |
|
| 769 | + } |
|
| 770 | + if (isset($ais_data['destination'])) { |
|
| 771 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 772 | + } |
|
| 773 | + if (isset($ais_data['eta_ts'])) { |
|
| 774 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 775 | + } |
|
| 556 | 776 | if (isset($ais_data['timestamp'])) { |
| 557 | 777 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 558 | 778 | } else { |
@@ -560,18 +780,27 @@ discard block |
||
| 560 | 780 | } |
| 561 | 781 | $data['format_source'] = 'aisnmeahttp'; |
| 562 | 782 | $data['id_source'] = $id_source; |
| 563 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 564 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 783 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 784 | + $data['noarchive'] = true; |
|
| 785 | + } |
|
| 786 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 787 | + $MI->add($data); |
|
| 788 | + } |
|
| 565 | 789 | unset($data); |
| 566 | 790 | } |
| 567 | 791 | } |
| 568 | 792 | } |
| 569 | 793 | } else { |
| 570 | 794 | $format = $value['format']; |
| 571 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 572 | - else $tt[$format] = 0; |
|
| 795 | + if (isset($tt[$format])) { |
|
| 796 | + $tt[$format]++; |
|
| 797 | + } else { |
|
| 798 | + $tt[$format] = 0; |
|
| 799 | + } |
|
| 573 | 800 | if ($tt[$format] > 30) { |
| 574 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
| 801 | + if ($globalDebug) { |
|
| 802 | + echo 'Reconnect...'."\n"; |
|
| 803 | + } |
|
| 575 | 804 | sleep(2); |
| 576 | 805 | //$sourceeen[] = $value; |
| 577 | 806 | //connect_all($sourceeen); |
@@ -607,12 +836,18 @@ discard block |
||
| 607 | 836 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
| 608 | 837 | //$data['type_id'] = $line['TYPE']; |
| 609 | 838 | $data['imo'] = $line['IMO']; |
| 610 | - if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
|
| 611 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 839 | + if ($line['DEST'] != '') { |
|
| 840 | + $data['arrival_code'] = $line['DEST']; |
|
| 841 | + } |
|
| 842 | + if ($line['ARV'] != '') { |
|
| 843 | + $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 844 | + } |
|
| 612 | 845 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
| 613 | 846 | $data['format_source'] = 'myshiptracking'; |
| 614 | 847 | $data['id_source'] = $id_source; |
| 615 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 848 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 849 | + $data['noarchive'] = true; |
|
| 850 | + } |
|
| 616 | 851 | $MI->add($data); |
| 617 | 852 | unset($data); |
| 618 | 853 | } |
@@ -637,7 +872,9 @@ discard block |
||
| 637 | 872 | $data['callsign'] = $line['callsign']; |
| 638 | 873 | $data['mmsi'] = substr($line['mmsi'],-9); |
| 639 | 874 | $data['speed'] = $line['sog']; |
| 640 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 875 | + if ($line['heading'] != '511') { |
|
| 876 | + $data['heading'] = $line['heading']; |
|
| 877 | + } |
|
| 641 | 878 | $data['latitude'] = $line['latitude']; |
| 642 | 879 | $data['longitude'] = $line['longitude']; |
| 643 | 880 | $data['type_id'] = $line['shiptype']; |
@@ -645,7 +882,9 @@ discard block |
||
| 645 | 882 | $data['datetime'] = $line['time']; |
| 646 | 883 | $data['format_source'] = 'boatbeaconapp'; |
| 647 | 884 | $data['id_source'] = $id_source; |
| 648 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 885 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 886 | + $data['noarchive'] = true; |
|
| 887 | + } |
|
| 649 | 888 | $MI->add($data); |
| 650 | 889 | unset($data); |
| 651 | 890 | } |
@@ -667,22 +906,44 @@ discard block |
||
| 667 | 906 | foreach ($all_data['features'] as $line) { |
| 668 | 907 | print_r($line); |
| 669 | 908 | $data = array(); |
| 670 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
| 671 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
| 672 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 673 | - if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
|
| 674 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
| 675 | - if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
|
| 909 | + if (isset($line['properties']['name'])) { |
|
| 910 | + $data['ident'] = $line['properties']['name']; |
|
| 911 | + } |
|
| 912 | + if (isset($line['properties']['callsign'])) { |
|
| 913 | + $data['callsign'] = $line['properties']['callsign']; |
|
| 914 | + } |
|
| 915 | + if (isset($line['properties']['mmsi'])) { |
|
| 916 | + $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 917 | + } |
|
| 918 | + if (isset($line['properties']['imo'])) { |
|
| 919 | + $data['imo'] = $line['properties']['imo']; |
|
| 920 | + } |
|
| 921 | + if (isset($line['properties']['speed'])) { |
|
| 922 | + $data['speed'] = $line['properties']['speed']; |
|
| 923 | + } |
|
| 924 | + if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) { |
|
| 925 | + $data['heading'] = $line['properties']['heading']; |
|
| 926 | + } |
|
| 676 | 927 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
| 677 | 928 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
| 678 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
| 679 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
| 680 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
| 929 | + if (isset($line['properties']['vesselType'])) { |
|
| 930 | + $data['type'] = $line['properties']['vesselType']; |
|
| 931 | + } |
|
| 932 | + if (isset($line['properties']['destination'])) { |
|
| 933 | + $data['arrival_code'] = $line['properties']['destination']; |
|
| 934 | + } |
|
| 935 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
| 936 | + $data['arrival_date'] = $line['properties']['eta']; |
|
| 937 | + } |
|
| 681 | 938 | $data['format_source'] = 'boatnerd'; |
| 682 | 939 | $data['id_source'] = $id_source; |
| 683 | 940 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 684 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 685 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
| 941 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 942 | + $data['noarchive'] = true; |
|
| 943 | + } |
|
| 944 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
| 945 | + $MI->add($data); |
|
| 946 | + } |
|
| 686 | 947 | unset($data); |
| 687 | 948 | } |
| 688 | 949 | } |
@@ -695,11 +956,17 @@ discard block |
||
| 695 | 956 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 696 | 957 | ) |
| 697 | 958 | ) { |
| 698 | - if ($globalDebug) echo 'download...'; |
|
| 959 | + if ($globalDebug) { |
|
| 960 | + echo 'download...'; |
|
| 961 | + } |
|
| 699 | 962 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
| 700 | - if ($globalDebug) echo 'done !'."\n"; |
|
| 963 | + if ($globalDebug) { |
|
| 964 | + echo 'done !'."\n"; |
|
| 965 | + } |
|
| 701 | 966 | // FIXME: Need more work |
| 702 | - if ($buffer != '') $reset = 0; |
|
| 967 | + if ($buffer != '') { |
|
| 968 | + $reset = 0; |
|
| 969 | + } |
|
| 703 | 970 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 704 | 971 | $buffer = explode('\n',$buffer); |
| 705 | 972 | foreach ($buffer as $line) { |
@@ -725,7 +992,9 @@ discard block |
||
| 725 | 992 | //$data['etaTime'] = substr($line,135,5); |
| 726 | 993 | $data['format_source'] = 'shipplotter'; |
| 727 | 994 | $data['id_source'] = $id_source; |
| 728 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 995 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 996 | + $data['noarchive'] = true; |
|
| 997 | + } |
|
| 729 | 998 | //print_r($data); |
| 730 | 999 | //echo 'Add...'."\n"; |
| 731 | 1000 | $MI->add($data); |
@@ -748,11 +1017,17 @@ discard block |
||
| 748 | 1017 | } |
| 749 | 1018 | } |
| 750 | 1019 | |
| 751 | - if ($globalDebug) echo '! Download... '; |
|
| 1020 | + if ($globalDebug) { |
|
| 1021 | + echo '! Download... '; |
|
| 1022 | + } |
|
| 752 | 1023 | for ($i =0; $i <= 1; $i++) { |
| 753 | - if ($globalDebug) echo 'Racetype: '.$i.' '; |
|
| 1024 | + if ($globalDebug) { |
|
| 1025 | + echo 'Racetype: '.$i.' '; |
|
| 1026 | + } |
|
| 754 | 1027 | $buffer = $Common->getData('https://sailaway.world/cgi-bin/sailaway/GetMissions.pl?race=1&tutorial=0&hist=1&racetype='.$i); |
| 755 | - if ($globalDebug) echo 'done'."\n"; |
|
| 1028 | + if ($globalDebug) { |
|
| 1029 | + echo 'done'."\n"; |
|
| 1030 | + } |
|
| 756 | 1031 | if ($buffer != '') { |
| 757 | 1032 | $all_data = json_decode($buffer,true); |
| 758 | 1033 | if (isset($all_data['missions'])) { |
@@ -760,8 +1035,11 @@ discard block |
||
| 760 | 1035 | $mission_user = $mission['usrname']; |
| 761 | 1036 | $mission_name = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($mission['mistitle'])); |
| 762 | 1037 | if (!isset($globalFilter['sailway']['race']) || (isset($globalFilter['sailway']['race']) && in_array($mission['misnr'],$globalFilter['sailway']['race']))) { |
| 763 | - if (isset($sailaway_authcookie) && $sailaway_authcookie != '') $racebuffer = $Common->getData('https://sailaway.world/cgi-bin/sailaway/GetMission.pl?misnr='.$mission['misnr'],'get','','',$sailaway_authcookie); |
|
| 764 | - else $racebuffer = ''; |
|
| 1038 | + if (isset($sailaway_authcookie) && $sailaway_authcookie != '') { |
|
| 1039 | + $racebuffer = $Common->getData('https://sailaway.world/cgi-bin/sailaway/GetMission.pl?misnr='.$mission['misnr'],'get','','',$sailaway_authcookie); |
|
| 1040 | + } else { |
|
| 1041 | + $racebuffer = ''; |
|
| 1042 | + } |
|
| 765 | 1043 | $bufferm = $Common->getData('https://sailaway.world/cgi-bin/sailaway/GetLeaderboard.pl?misnr='.$mission['misnr']); |
| 766 | 1044 | } else { |
| 767 | 1045 | $bufferm = ''; |
@@ -825,7 +1103,9 @@ discard block |
||
| 825 | 1103 | $data['captain_id'] = $sail['usrnr']; |
| 826 | 1104 | $data['captain_name'] = $sail['usrname']; |
| 827 | 1105 | $data['race_id'] = $sail['misnr']; |
| 828 | - if ($sail['rank'] != 'DNF') $data['race_rank'] = $sail['rank']; |
|
| 1106 | + if ($sail['rank'] != 'DNF') { |
|
| 1107 | + $data['race_rank'] = $sail['rank']; |
|
| 1108 | + } |
|
| 829 | 1109 | $data['race_time'] = $sail['racetime']; |
| 830 | 1110 | if ($mission_user != '') { |
| 831 | 1111 | $data['race_name'] = $mission_name.' ('.$mission_user.')'; |
@@ -835,7 +1115,9 @@ discard block |
||
| 835 | 1115 | //$data['callsign'] = trim(substr($line,100,7); |
| 836 | 1116 | $data['format_source'] = 'sailaway'; |
| 837 | 1117 | $data['id_source'] = $id_source; |
| 838 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1118 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1119 | + $data['noarchive'] = true; |
|
| 1120 | + } |
|
| 839 | 1121 | //print_r($data); |
| 840 | 1122 | //if ($data['race_id'] == '48') print_r($data); |
| 841 | 1123 | //echo 'Add...'."\n"; |
@@ -877,16 +1159,28 @@ discard block |
||
| 877 | 1159 | $line = explode(':', $line); |
| 878 | 1160 | if (count($line) > 30 && $line[0] != 'callsign') { |
| 879 | 1161 | $data = array(); |
| 880 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 881 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 1162 | + if (isset($line[37]) && $line[37] != '') { |
|
| 1163 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 1164 | + } else { |
|
| 1165 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 1166 | + } |
|
| 882 | 1167 | $data['pilot_id'] = $line[1]; |
| 883 | 1168 | $data['pilot_name'] = $line[2]; |
| 884 | 1169 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
| 885 | 1170 | $data['ident'] = $line[0]; // ident |
| 886 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
| 1171 | + if ($line[7] != '' && $line[7] != 0) { |
|
| 1172 | + $data['altitude'] = $line[7]; |
|
| 1173 | + } |
|
| 1174 | + // altitude |
|
| 887 | 1175 | $data['speed'] = $line[8]; // speed |
| 888 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
| 889 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
| 1176 | + if (isset($line[45])) { |
|
| 1177 | + $data['heading'] = $line[45]; |
|
| 1178 | + } |
|
| 1179 | + // heading |
|
| 1180 | + elseif (isset($line[38])) { |
|
| 1181 | + $data['heading'] = $line[38]; |
|
| 1182 | + } |
|
| 1183 | + // heading |
|
| 890 | 1184 | $data['latitude'] = $line[5]; // lat |
| 891 | 1185 | $data['longitude'] = $line[6]; // long |
| 892 | 1186 | $data['verticalrate'] = ''; // vertical rate |
@@ -902,7 +1196,9 @@ discard block |
||
| 902 | 1196 | $data['frequency'] = $line[4]; |
| 903 | 1197 | $data['type'] = $line[18]; |
| 904 | 1198 | $data['range'] = $line[19]; |
| 905 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
| 1199 | + if (isset($line[35])) { |
|
| 1200 | + $data['info'] = $line[35]; |
|
| 1201 | + } |
|
| 906 | 1202 | $data['id_source'] = $id_source; |
| 907 | 1203 | //$data['arrival_airport_time'] = ; |
| 908 | 1204 | if ($line[9] != '') { |
@@ -916,27 +1212,47 @@ discard block |
||
| 916 | 1212 | elseif ($value === 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 917 | 1213 | */ |
| 918 | 1214 | $data['format_source'] = $value['format']; |
| 919 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 920 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 921 | - if ($line[3] === 'PILOT') $SI->add($data); |
|
| 922 | - elseif ($line[3] === 'ATC') { |
|
| 1215 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1216 | + $data['noarchive'] = true; |
|
| 1217 | + } |
|
| 1218 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1219 | + $data['source_name'] = $value['name']; |
|
| 1220 | + } |
|
| 1221 | + if ($line[3] === 'PILOT') { |
|
| 1222 | + $SI->add($data); |
|
| 1223 | + } elseif ($line[3] === 'ATC') { |
|
| 923 | 1224 | //print_r($data); |
| 924 | 1225 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 925 | 1226 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 926 | 1227 | $typec = substr($data['ident'],-3); |
| 927 | - if ($typec === 'APP') $data['type'] = 'Approach'; |
|
| 928 | - elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
|
| 929 | - elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
|
| 930 | - elseif ($typec === 'GND') $data['type'] = 'Ground'; |
|
| 931 | - elseif ($typec === 'DEL') $data['type'] = 'Delivery'; |
|
| 932 | - elseif ($typec === 'DEP') $data['type'] = 'Departure'; |
|
| 933 | - elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 934 | - elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 935 | - elseif ($data['type'] === '') $data['type'] = 'Observer'; |
|
| 936 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
| 1228 | + if ($typec === 'APP') { |
|
| 1229 | + $data['type'] = 'Approach'; |
|
| 1230 | + } elseif ($typec === 'TWR') { |
|
| 1231 | + $data['type'] = 'Tower'; |
|
| 1232 | + } elseif ($typec === 'OBS') { |
|
| 1233 | + $data['type'] = 'Observer'; |
|
| 1234 | + } elseif ($typec === 'GND') { |
|
| 1235 | + $data['type'] = 'Ground'; |
|
| 1236 | + } elseif ($typec === 'DEL') { |
|
| 1237 | + $data['type'] = 'Delivery'; |
|
| 1238 | + } elseif ($typec === 'DEP') { |
|
| 1239 | + $data['type'] = 'Departure'; |
|
| 1240 | + } elseif ($typec === 'FSS') { |
|
| 1241 | + $data['type'] = 'Flight Service Station'; |
|
| 1242 | + } elseif ($typec === 'CTR') { |
|
| 1243 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1244 | + } elseif ($data['type'] === '') { |
|
| 1245 | + $data['type'] = 'Observer'; |
|
| 1246 | + } |
|
| 1247 | + if (!isset($data['source_name'])) { |
|
| 1248 | + $data['source_name'] = ''; |
|
| 1249 | + } |
|
| 937 | 1250 | if (isset($ATC)) { |
| 938 | - 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']); |
|
| 939 | - 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']); |
|
| 1251 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
| 1252 | + 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']); |
|
| 1253 | + } else { |
|
| 1254 | + 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']); |
|
| 1255 | + } |
|
| 940 | 1256 | } |
| 941 | 1257 | } |
| 942 | 1258 | unset($data); |
@@ -963,14 +1279,20 @@ discard block |
||
| 963 | 1279 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
| 964 | 1280 | $data['latitude'] = (float)$line['pktLatitude']; |
| 965 | 1281 | $data['longitude'] = (float)$line['pktLongitude']; |
| 966 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 967 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 1282 | + if ((float)$line['pktTrack'] != 0) { |
|
| 1283 | + $data['heading'] = (float)$line['pktTrack']; |
|
| 1284 | + } |
|
| 1285 | + if ((int)$line['pktSpeed'] != 0) { |
|
| 1286 | + $data['speed'] = (int)$line['pktSpeed']; |
|
| 1287 | + } |
|
| 968 | 1288 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
| 969 | 1289 | $data['altitude_relative'] = 'AMSL'; |
| 970 | 1290 | $data['pilot_id'] = (int)$line['pktPilotID']; |
| 971 | 1291 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 972 | 1292 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
| 973 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
| 1293 | + if (isset($pilot_data[4])) { |
|
| 1294 | + $data['pilot_name'] = $pilot_data[4]; |
|
| 1295 | + } |
|
| 974 | 1296 | $data['format_source'] = $value['format']; |
| 975 | 1297 | $SI->add($data); |
| 976 | 1298 | unset($data); |
@@ -1018,25 +1340,59 @@ discard block |
||
| 1018 | 1340 | foreach ($all_data['acList'] as $line) { |
| 1019 | 1341 | $data = array(); |
| 1020 | 1342 | $data['hex'] = $line['Icao']; // hex |
| 1021 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1022 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1023 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1024 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1025 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1026 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1343 | + if (isset($line['Call'])) { |
|
| 1344 | + $data['ident'] = $line['Call']; |
|
| 1345 | + } |
|
| 1346 | + // ident |
|
| 1347 | + if (isset($line['Alt'])) { |
|
| 1348 | + $data['altitude'] = $line['Alt']; |
|
| 1349 | + } |
|
| 1350 | + // altitude |
|
| 1351 | + if (isset($line['Spd'])) { |
|
| 1352 | + $data['speed'] = $line['Spd']; |
|
| 1353 | + } |
|
| 1354 | + // speed |
|
| 1355 | + if (isset($line['Trak'])) { |
|
| 1356 | + $data['heading'] = $line['Trak']; |
|
| 1357 | + } |
|
| 1358 | + // heading |
|
| 1359 | + if (isset($line['Lat'])) { |
|
| 1360 | + $data['latitude'] = $line['Lat']; |
|
| 1361 | + } |
|
| 1362 | + // lat |
|
| 1363 | + if (isset($line['Long'])) { |
|
| 1364 | + $data['longitude'] = $line['Long']; |
|
| 1365 | + } |
|
| 1366 | + // long |
|
| 1027 | 1367 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1028 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1368 | + if (isset($line['Sqk'])) { |
|
| 1369 | + $data['squawk'] = $line['Sqk']; |
|
| 1370 | + } |
|
| 1371 | + // squawk |
|
| 1029 | 1372 | $data['emergency'] = ''; // emergency |
| 1030 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 1031 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1032 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1373 | + if (isset($line['Reg'])) { |
|
| 1374 | + $data['registration'] = $line['Reg']; |
|
| 1375 | + } |
|
| 1376 | + if (isset($line['PosTime'])) { |
|
| 1377 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1378 | + } else { |
|
| 1379 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1380 | + } |
|
| 1033 | 1381 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1034 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1382 | + if (isset($line['Type'])) { |
|
| 1383 | + $data['aircraft_icao'] = $line['Type']; |
|
| 1384 | + } |
|
| 1035 | 1385 | $data['format_source'] = 'aircraftlistjson'; |
| 1036 | 1386 | $data['id_source'] = $id_source; |
| 1037 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1038 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1039 | - if (isset($data['latitude'])) $SI->add($data); |
|
| 1387 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1388 | + $data['source_name'] = $value['name']; |
|
| 1389 | + } |
|
| 1390 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1391 | + $data['noarchive'] = true; |
|
| 1392 | + } |
|
| 1393 | + if (isset($data['latitude'])) { |
|
| 1394 | + $SI->add($data); |
|
| 1395 | + } |
|
| 1040 | 1396 | unset($data); |
| 1041 | 1397 | } |
| 1042 | 1398 | } elseif (is_array($all_data)) { |
@@ -1053,17 +1409,26 @@ discard block |
||
| 1053 | 1409 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 1054 | 1410 | $data['squawk'] = $line['squawk']; // squawk |
| 1055 | 1411 | $data['emergency'] = ''; // emergency |
| 1056 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1057 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1412 | + if (isset($line['PosTime'])) { |
|
| 1413 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1414 | + } else { |
|
| 1415 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1416 | + } |
|
| 1058 | 1417 | $data['format_source'] = 'aircraftlistjson'; |
| 1059 | 1418 | $data['id_source'] = $id_source; |
| 1060 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1061 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1419 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1420 | + $data['noarchive'] = true; |
|
| 1421 | + } |
|
| 1422 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1423 | + $data['source_name'] = $value['name']; |
|
| 1424 | + } |
|
| 1062 | 1425 | $SI->add($data); |
| 1063 | 1426 | unset($data); |
| 1064 | 1427 | } |
| 1065 | 1428 | } |
| 1066 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 1429 | + } elseif ($globalDebug) { |
|
| 1430 | + echo 'No data'."\n"; |
|
| 1431 | + } |
|
| 1067 | 1432 | //$last_exec['aircraftlistjson'] = time(); |
| 1068 | 1433 | $last_exec[$id]['last'] = time(); |
| 1069 | 1434 | //} elseif ($value === 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
@@ -1099,8 +1464,12 @@ discard block |
||
| 1099 | 1464 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
| 1100 | 1465 | $data['format_source'] = 'planeupdatefaa'; |
| 1101 | 1466 | $data['id_source'] = $id_source; |
| 1102 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1103 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1467 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1468 | + $data['noarchive'] = true; |
|
| 1469 | + } |
|
| 1470 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1471 | + $data['source_name'] = $value['name']; |
|
| 1472 | + } |
|
| 1104 | 1473 | $SI->add($data); |
| 1105 | 1474 | unset($data); |
| 1106 | 1475 | } |
@@ -1134,7 +1503,9 @@ discard block |
||
| 1134 | 1503 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
| 1135 | 1504 | $data['format_source'] = 'opensky'; |
| 1136 | 1505 | $data['id_source'] = $id_source; |
| 1137 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1506 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1507 | + $data['noarchive'] = true; |
|
| 1508 | + } |
|
| 1138 | 1509 | $SI->add($data); |
| 1139 | 1510 | unset($data); |
| 1140 | 1511 | } |
@@ -1154,15 +1525,42 @@ discard block |
||
| 1154 | 1525 | foreach ($all_data['aircraft'] as $key => $line) { |
| 1155 | 1526 | $data = array(); |
| 1156 | 1527 | // add support for ground vehicule with ~ in front of hex |
| 1157 | - if (isset($line['hex'])) $data['hex'] = $line['hex']; // hex |
|
| 1158 | - if (isset($line['flight'])) $data['ident'] = trim($line['flight']); // ident |
|
| 1159 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1160 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1161 | - if (isset($line['track'])) $data['heading'] = $line['track']; // heading |
|
| 1162 | - if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1163 | - if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1164 | - if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1165 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1528 | + if (isset($line['hex'])) { |
|
| 1529 | + $data['hex'] = $line['hex']; |
|
| 1530 | + } |
|
| 1531 | + // hex |
|
| 1532 | + if (isset($line['flight'])) { |
|
| 1533 | + $data['ident'] = trim($line['flight']); |
|
| 1534 | + } |
|
| 1535 | + // ident |
|
| 1536 | + if (isset($line['altitude'])) { |
|
| 1537 | + $data['altitude'] = $line['altitude']; |
|
| 1538 | + } |
|
| 1539 | + // altitude |
|
| 1540 | + if (isset($line['speed'])) { |
|
| 1541 | + $data['speed'] = $line['speed']; |
|
| 1542 | + } |
|
| 1543 | + // speed |
|
| 1544 | + if (isset($line['track'])) { |
|
| 1545 | + $data['heading'] = $line['track']; |
|
| 1546 | + } |
|
| 1547 | + // heading |
|
| 1548 | + if (isset($line['lat'])) { |
|
| 1549 | + $data['latitude'] = $line['lat']; |
|
| 1550 | + } |
|
| 1551 | + // lat |
|
| 1552 | + if (isset($line['lon'])) { |
|
| 1553 | + $data['longitude'] = $line['lon']; |
|
| 1554 | + } |
|
| 1555 | + // long |
|
| 1556 | + if (isset($line['vert_rate'])) { |
|
| 1557 | + $data['verticalrate'] = $line['vert_rate']; |
|
| 1558 | + } |
|
| 1559 | + // verticale rate |
|
| 1560 | + if (isset($line['squawk'])) { |
|
| 1561 | + $data['squawk'] = $line['squawk']; |
|
| 1562 | + } |
|
| 1563 | + // squawk |
|
| 1166 | 1564 | //$data['emergency'] = ''; // emergency |
| 1167 | 1565 | //$data['registration'] = $line[2]; |
| 1168 | 1566 | //$data['aircraft_icao'] = $line[0]; |
@@ -1170,10 +1568,17 @@ discard block |
||
| 1170 | 1568 | $data['format_source'] = 'aircraftjson'; |
| 1171 | 1569 | $data['id_source'] = $id_source; |
| 1172 | 1570 | if (isset($value['name']) && $value['name'] != '') { |
| 1173 | - if (isset($line['mlat']) && !empty($line['mlat'])) $data['source_name'] = $value['name'].'_MLAT'; |
|
| 1174 | - else $data['source_name'] = $value['name']; |
|
| 1175 | - } elseif (isset($line['mlat']) && !empty($line['mlat'])) $data['source_name'] = 'MLAT'; |
|
| 1176 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1571 | + if (isset($line['mlat']) && !empty($line['mlat'])) { |
|
| 1572 | + $data['source_name'] = $value['name'].'_MLAT'; |
|
| 1573 | + } else { |
|
| 1574 | + $data['source_name'] = $value['name']; |
|
| 1575 | + } |
|
| 1576 | + } elseif (isset($line['mlat']) && !empty($line['mlat'])) { |
|
| 1577 | + $data['source_name'] = 'MLAT'; |
|
| 1578 | + } |
|
| 1579 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1580 | + $data['noarchive'] = true; |
|
| 1581 | + } |
|
| 1177 | 1582 | $SI->add($data); |
| 1178 | 1583 | unset($data); |
| 1179 | 1584 | } |
@@ -1193,22 +1598,54 @@ discard block |
||
| 1193 | 1598 | foreach ($all_data['aircraft'] as $key => $line) { |
| 1194 | 1599 | $data = array(); |
| 1195 | 1600 | $data['hex'] = $key; // hex |
| 1196 | - if (isset($line['callsign'])) $data['ident'] = trim($line['callsign']); // ident |
|
| 1197 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1198 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1199 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1200 | - if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1201 | - if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1202 | - if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1203 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1601 | + if (isset($line['callsign'])) { |
|
| 1602 | + $data['ident'] = trim($line['callsign']); |
|
| 1603 | + } |
|
| 1604 | + // ident |
|
| 1605 | + if (isset($line['altitude'])) { |
|
| 1606 | + $data['altitude'] = $line['altitude']; |
|
| 1607 | + } |
|
| 1608 | + // altitude |
|
| 1609 | + if (isset($line['speed'])) { |
|
| 1610 | + $data['speed'] = $line['speed']; |
|
| 1611 | + } |
|
| 1612 | + // speed |
|
| 1613 | + if (isset($line['heading'])) { |
|
| 1614 | + $data['heading'] = $line['heading']; |
|
| 1615 | + } |
|
| 1616 | + // heading |
|
| 1617 | + if (isset($line['lat'])) { |
|
| 1618 | + $data['latitude'] = $line['lat']; |
|
| 1619 | + } |
|
| 1620 | + // lat |
|
| 1621 | + if (isset($line['lon'])) { |
|
| 1622 | + $data['longitude'] = $line['lon']; |
|
| 1623 | + } |
|
| 1624 | + // long |
|
| 1625 | + if (isset($line['vert_rate'])) { |
|
| 1626 | + $data['verticalrate'] = $line['vert_rate']; |
|
| 1627 | + } |
|
| 1628 | + // verticale rate |
|
| 1629 | + if (isset($line['squawk'])) { |
|
| 1630 | + $data['squawk'] = $line['squawk']; |
|
| 1631 | + } |
|
| 1632 | + // squawk |
|
| 1204 | 1633 | //$data['emergency'] = ''; // emergency |
| 1205 | - if (isset($line['reg'])) $data['registration'] = $line['reg']; |
|
| 1206 | - if (isset($line['type'])) $data['aircraft_icao'] = $line['type']; |
|
| 1634 | + if (isset($line['reg'])) { |
|
| 1635 | + $data['registration'] = $line['reg']; |
|
| 1636 | + } |
|
| 1637 | + if (isset($line['type'])) { |
|
| 1638 | + $data['aircraft_icao'] = $line['type']; |
|
| 1639 | + } |
|
| 1207 | 1640 | $data['datetime'] = date('Y-m-d H:i:s',$line['pos_update_time']); |
| 1208 | 1641 | $data['format_source'] = 'planefinderclient'; |
| 1209 | 1642 | $data['id_source'] = $id_source; |
| 1210 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1211 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1643 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1644 | + $data['source_name'] = $value['name']; |
|
| 1645 | + } |
|
| 1646 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1647 | + $data['noarchive'] = true; |
|
| 1648 | + } |
|
| 1212 | 1649 | $SI->add($data); |
| 1213 | 1650 | unset($data); |
| 1214 | 1651 | } |
@@ -1224,7 +1661,9 @@ discard block |
||
| 1224 | 1661 | //$buffer = $Common->getData($hosts[$id]); |
| 1225 | 1662 | $buffer = $Common->getData($value['host']); |
| 1226 | 1663 | $all_data = json_decode($buffer,true); |
| 1227 | - if (!empty($all_data)) $reset = 0; |
|
| 1664 | + if (!empty($all_data)) { |
|
| 1665 | + $reset = 0; |
|
| 1666 | + } |
|
| 1228 | 1667 | foreach ($all_data as $key => $line) { |
| 1229 | 1668 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 1230 | 1669 | $data = array(); |
@@ -1245,8 +1684,12 @@ discard block |
||
| 1245 | 1684 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
| 1246 | 1685 | $data['format_source'] = 'fr24json'; |
| 1247 | 1686 | $data['id_source'] = $id_source; |
| 1248 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1249 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1687 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1688 | + $data['noarchive'] = true; |
|
| 1689 | + } |
|
| 1690 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1691 | + $data['source_name'] = $value['name']; |
|
| 1692 | + } |
|
| 1250 | 1693 | $SI->add($data); |
| 1251 | 1694 | unset($data); |
| 1252 | 1695 | } |
@@ -1275,24 +1718,42 @@ discard block |
||
| 1275 | 1718 | if (isset($line['inf'])) { |
| 1276 | 1719 | $data = array(); |
| 1277 | 1720 | $data['hex'] = $line['inf']['ia']; |
| 1278 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
| 1721 | + if (isset($line['inf']['cs'])) { |
|
| 1722 | + $data['ident'] = $line['inf']['cs']; |
|
| 1723 | + } |
|
| 1724 | + //$line[13] |
|
| 1279 | 1725 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
| 1280 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 1281 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 1726 | + if (isset($line['inf']['gs'])) { |
|
| 1727 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
| 1728 | + } |
|
| 1729 | + // speed |
|
| 1730 | + if (isset($line['inf']['tr'])) { |
|
| 1731 | + $data['heading'] = $line['inf']['tr']; |
|
| 1732 | + } |
|
| 1733 | + // heading |
|
| 1282 | 1734 | $data['latitude'] = $line['pt'][0]; // lat |
| 1283 | 1735 | $data['longitude'] = $line['pt'][1]; // long |
| 1284 | 1736 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
| 1285 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1737 | + if (isset($line['inf']['sq'])) { |
|
| 1738 | + $data['squawk'] = $line['inf']['sq']; |
|
| 1739 | + } |
|
| 1740 | + // squawk |
|
| 1286 | 1741 | //$data['aircraft_icao'] = $line[8]; |
| 1287 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1742 | + if (isset($line['inf']['rc'])) { |
|
| 1743 | + $data['registration'] = $line['inf']['rc']; |
|
| 1744 | + } |
|
| 1288 | 1745 | //$data['departure_airport_iata'] = $line[11]; |
| 1289 | 1746 | //$data['arrival_airport_iata'] = $line[12]; |
| 1290 | 1747 | //$data['emergency'] = ''; // emergency |
| 1291 | 1748 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 1292 | 1749 | $data['format_source'] = 'radarvirtueljson'; |
| 1293 | 1750 | $data['id_source'] = $id_source; |
| 1294 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1295 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1751 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1752 | + $data['noarchive'] = true; |
|
| 1753 | + } |
|
| 1754 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1755 | + $data['source_name'] = $value['name']; |
|
| 1756 | + } |
|
| 1296 | 1757 | $SI->add($data); |
| 1297 | 1758 | unset($data); |
| 1298 | 1759 | } |
@@ -1318,30 +1779,65 @@ discard block |
||
| 1318 | 1779 | $data['id'] = $line['id']; |
| 1319 | 1780 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
| 1320 | 1781 | $data['ident'] = $line['callsign']; // ident |
| 1321 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 1322 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 1323 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 1324 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 1325 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1326 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1782 | + if (isset($line['pilotid'])) { |
|
| 1783 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1784 | + } |
|
| 1785 | + // pilot id |
|
| 1786 | + if (isset($line['name'])) { |
|
| 1787 | + $data['pilot_name'] = $line['name']; |
|
| 1788 | + } |
|
| 1789 | + // pilot name |
|
| 1790 | + if (isset($line['alt'])) { |
|
| 1791 | + $data['altitude'] = $line['alt']; |
|
| 1792 | + } |
|
| 1793 | + // altitude |
|
| 1794 | + if (isset($line['gs'])) { |
|
| 1795 | + $data['speed'] = $line['gs']; |
|
| 1796 | + } |
|
| 1797 | + // speed |
|
| 1798 | + if (isset($line['heading'])) { |
|
| 1799 | + $data['heading'] = $line['heading']; |
|
| 1800 | + } |
|
| 1801 | + // heading |
|
| 1802 | + if (isset($line['route'])) { |
|
| 1803 | + $data['waypoints'] = $line['route']; |
|
| 1804 | + } |
|
| 1805 | + // route |
|
| 1327 | 1806 | $data['latitude'] = $line['lat']; // lat |
| 1328 | 1807 | $data['longitude'] = $line['lon']; // long |
| 1329 | 1808 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
| 1330 | 1809 | //$data['squawk'] = $line['squawk']; // squawk |
| 1331 | 1810 | //$data['emergency'] = ''; // emergency |
| 1332 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 1333 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 1334 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1811 | + if (isset($line['depicao'])) { |
|
| 1812 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 1813 | + } |
|
| 1814 | + if (isset($line['deptime'])) { |
|
| 1815 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 1816 | + } |
|
| 1817 | + if (isset($line['arricao'])) { |
|
| 1818 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1819 | + } |
|
| 1335 | 1820 | //$data['arrival_airport_time'] = $line['arrtime']; |
| 1336 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 1337 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 1338 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 1339 | - else $data['info'] = ''; |
|
| 1821 | + if (isset($line['aircraft'])) { |
|
| 1822 | + $data['aircraft_icao'] = $line['aircraft']; |
|
| 1823 | + } |
|
| 1824 | + if (isset($line['transponder'])) { |
|
| 1825 | + $data['squawk'] = $line['transponder']; |
|
| 1826 | + } |
|
| 1827 | + if (isset($line['atis'])) { |
|
| 1828 | + $data['info'] = $line['atis']; |
|
| 1829 | + } else { |
|
| 1830 | + $data['info'] = ''; |
|
| 1831 | + } |
|
| 1340 | 1832 | $data['format_source'] = 'pireps'; |
| 1341 | 1833 | $data['id_source'] = $id_source; |
| 1342 | 1834 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1343 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1344 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1835 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1836 | + $data['noarchive'] = true; |
|
| 1837 | + } |
|
| 1838 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1839 | + $data['source_name'] = $value['name']; |
|
| 1840 | + } |
|
| 1345 | 1841 | if ($line['icon'] === 'plane') { |
| 1346 | 1842 | $SI->add($data); |
| 1347 | 1843 | // print_r($data); |
@@ -1350,16 +1846,28 @@ discard block |
||
| 1350 | 1846 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 1351 | 1847 | $typec = substr($data['ident'],-3); |
| 1352 | 1848 | $data['type'] = ''; |
| 1353 | - if ($typec === 'APP') $data['type'] = 'Approach'; |
|
| 1354 | - elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
|
| 1355 | - elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
|
| 1356 | - elseif ($typec === 'GND') $data['type'] = 'Ground'; |
|
| 1357 | - elseif ($typec === 'DEL') $data['type'] = 'Delivery'; |
|
| 1358 | - elseif ($typec === 'DEP') $data['type'] = 'Departure'; |
|
| 1359 | - elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 1360 | - elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 1361 | - else $data['type'] = 'Observer'; |
|
| 1362 | - 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']); |
|
| 1849 | + if ($typec === 'APP') { |
|
| 1850 | + $data['type'] = 'Approach'; |
|
| 1851 | + } elseif ($typec === 'TWR') { |
|
| 1852 | + $data['type'] = 'Tower'; |
|
| 1853 | + } elseif ($typec === 'OBS') { |
|
| 1854 | + $data['type'] = 'Observer'; |
|
| 1855 | + } elseif ($typec === 'GND') { |
|
| 1856 | + $data['type'] = 'Ground'; |
|
| 1857 | + } elseif ($typec === 'DEL') { |
|
| 1858 | + $data['type'] = 'Delivery'; |
|
| 1859 | + } elseif ($typec === 'DEP') { |
|
| 1860 | + $data['type'] = 'Departure'; |
|
| 1861 | + } elseif ($typec === 'FSS') { |
|
| 1862 | + $data['type'] = 'Flight Service Station'; |
|
| 1863 | + } elseif ($typec === 'CTR') { |
|
| 1864 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1865 | + } else { |
|
| 1866 | + $data['type'] = 'Observer'; |
|
| 1867 | + } |
|
| 1868 | + if (isset($ATC)) { |
|
| 1869 | + 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']); |
|
| 1870 | + } |
|
| 1363 | 1871 | } |
| 1364 | 1872 | unset($data); |
| 1365 | 1873 | } |
@@ -1374,7 +1882,9 @@ discard block |
||
| 1374 | 1882 | ) |
| 1375 | 1883 | ) { |
| 1376 | 1884 | //$buffer = $Common->getData($hosts[$id]); |
| 1377 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1885 | + if ($globalDebug) { |
|
| 1886 | + echo 'Get Data...'."\n"; |
|
| 1887 | + } |
|
| 1378 | 1888 | $buffer = $Common->getData($value['host']); |
| 1379 | 1889 | $all_data = json_decode($buffer,true); |
| 1380 | 1890 | if ($buffer != '' && is_array($all_data)) { |
@@ -1382,10 +1892,16 @@ discard block |
||
| 1382 | 1892 | foreach ($all_data as $line) { |
| 1383 | 1893 | $data = array(); |
| 1384 | 1894 | //$data['id'] = $line['id']; // id not usable |
| 1385 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1895 | + if (isset($line['pilotid'])) { |
|
| 1896 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1897 | + } |
|
| 1386 | 1898 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1387 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 1388 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 1899 | + if (isset($line['pilotname'])) { |
|
| 1900 | + $data['pilot_name'] = $line['pilotname']; |
|
| 1901 | + } |
|
| 1902 | + if (isset($line['pilotid'])) { |
|
| 1903 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1904 | + } |
|
| 1389 | 1905 | $data['ident'] = $line['flightnum']; // ident |
| 1390 | 1906 | $data['altitude'] = $line['alt']; // altitude |
| 1391 | 1907 | $data['speed'] = $line['gs']; // speed |
@@ -1401,7 +1917,9 @@ discard block |
||
| 1401 | 1917 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
| 1402 | 1918 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1403 | 1919 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1404 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1920 | + } else { |
|
| 1921 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1922 | + } |
|
| 1405 | 1923 | $data['departure_airport_icao'] = $line['depicao']; |
| 1406 | 1924 | $data['departure_airport_time'] = $line['deptime']; |
| 1407 | 1925 | $data['arrival_airport_icao'] = $line['arricao']; |
@@ -1409,29 +1927,47 @@ discard block |
||
| 1409 | 1927 | if (isset($line['registration'])) { |
| 1410 | 1928 | $data['registration'] = $line['registration']; |
| 1411 | 1929 | //if (isset($line['aircraft'])) $data['id'] = $line['aircraft']; |
| 1412 | - } else $data['registration'] = $line['aircraft']; |
|
| 1413 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1414 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1930 | + } else { |
|
| 1931 | + $data['registration'] = $line['aircraft']; |
|
| 1932 | + } |
|
| 1933 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1934 | + $data['noarchive'] = true; |
|
| 1935 | + } |
|
| 1936 | + if (isset($line['route'])) { |
|
| 1937 | + $data['waypoints'] = $line['route']; |
|
| 1938 | + } |
|
| 1939 | + // route |
|
| 1415 | 1940 | if (isset($line['aircraftname'])) { |
| 1416 | 1941 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1417 | 1942 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 1418 | 1943 | $aircraft_data = explode('-',$line['aircraftname']); |
| 1419 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1420 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1421 | - else { |
|
| 1944 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
| 1945 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1946 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
| 1947 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1948 | + } else { |
|
| 1422 | 1949 | $aircraft_data = explode(' ',$line['aircraftname']); |
| 1423 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1424 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1950 | + if (isset($aircraft_data[1])) { |
|
| 1951 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1952 | + } else { |
|
| 1953 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1954 | + } |
|
| 1425 | 1955 | } |
| 1426 | 1956 | } |
| 1427 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1957 | + if (isset($line['route'])) { |
|
| 1958 | + $data['waypoints'] = $line['route']; |
|
| 1959 | + } |
|
| 1428 | 1960 | $data['id_source'] = $id_source; |
| 1429 | 1961 | $data['format_source'] = 'phpvmacars'; |
| 1430 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1962 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1963 | + $data['source_name'] = $value['name']; |
|
| 1964 | + } |
|
| 1431 | 1965 | $SI->add($data); |
| 1432 | 1966 | unset($data); |
| 1433 | 1967 | } |
| 1434 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1968 | + if ($globalDebug) { |
|
| 1969 | + echo 'No more data...'."\n"; |
|
| 1970 | + } |
|
| 1435 | 1971 | unset($buffer); |
| 1436 | 1972 | unset($all_data); |
| 1437 | 1973 | } |
@@ -1444,7 +1980,9 @@ discard block |
||
| 1444 | 1980 | ) |
| 1445 | 1981 | ) { |
| 1446 | 1982 | //$buffer = $Common->getData($hosts[$id]); |
| 1447 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1983 | + if ($globalDebug) { |
|
| 1984 | + echo 'Get Data...'."\n"; |
|
| 1985 | + } |
|
| 1448 | 1986 | $buffer = $Common->getData($value['host']); |
| 1449 | 1987 | $all_data = json_decode($buffer,true); |
| 1450 | 1988 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
@@ -1455,10 +1993,16 @@ discard block |
||
| 1455 | 1993 | //$data['id'] = $line['id']; // id not usable |
| 1456 | 1994 | $data['id'] = $line['id']; |
| 1457 | 1995 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1458 | - if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
|
| 1459 | - if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
|
| 1996 | + if (isset($line['user']['username'])) { |
|
| 1997 | + $data['pilot_name'] = $line['user']['username']; |
|
| 1998 | + } |
|
| 1999 | + if (isset($line['user_id'])) { |
|
| 2000 | + $data['pilot_id'] = $line['user_id']; |
|
| 2001 | + } |
|
| 1460 | 2002 | $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
| 1461 | - if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 2003 | + if (is_numeric($data['ident'])) { |
|
| 2004 | + $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 2005 | + } |
|
| 1462 | 2006 | $data['altitude'] = $line['altitude']; // altitude |
| 1463 | 2007 | $data['speed'] = $line['groundspeed']; // speed |
| 1464 | 2008 | $data['heading'] = $line['heading']; // heading |
@@ -1471,7 +2015,9 @@ discard block |
||
| 1471 | 2015 | $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
| 1472 | 2016 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1473 | 2017 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1474 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2018 | + } else { |
|
| 2019 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2020 | + } |
|
| 1475 | 2021 | |
| 1476 | 2022 | $data['departure_airport_icao'] = $line['bid']['depapt']['icao']; |
| 1477 | 2023 | $data['departure_airport_time'] = $line['bid']['deptime']; |
@@ -1479,17 +2025,26 @@ discard block |
||
| 1479 | 2025 | $data['arrival_airport_time'] = $line['bid']['arrtime']; |
| 1480 | 2026 | $data['registration'] = $line['bid']['aircraft']['registration']; |
| 1481 | 2027 | |
| 1482 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1483 | - if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route |
|
| 2028 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 2029 | + $data['noarchive'] = true; |
|
| 2030 | + } |
|
| 2031 | + if (isset($line['bid']['route']) && $line['bid']['route'] != '') { |
|
| 2032 | + $data['waypoints'] = $line['bid']['route']; |
|
| 2033 | + } |
|
| 2034 | + // route |
|
| 1484 | 2035 | $data['aircraft_icao'] = $line['bid']['aircraft']['icao']; |
| 1485 | 2036 | |
| 1486 | 2037 | $data['id_source'] = $id_source; |
| 1487 | 2038 | $data['format_source'] = 'vaos'; |
| 1488 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 2039 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2040 | + $data['source_name'] = $value['name']; |
|
| 2041 | + } |
|
| 1489 | 2042 | $SI->add($data); |
| 1490 | 2043 | unset($data); |
| 1491 | 2044 | } |
| 1492 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 2045 | + if ($globalDebug) { |
|
| 2046 | + echo 'No more data...'."\n"; |
|
| 2047 | + } |
|
| 1493 | 2048 | unset($buffer); |
| 1494 | 2049 | unset($all_data); |
| 1495 | 2050 | } |
@@ -1502,7 +2057,9 @@ discard block |
||
| 1502 | 2057 | ) |
| 1503 | 2058 | ) { |
| 1504 | 2059 | //$buffer = $Common->getData($hosts[$id]); |
| 1505 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 2060 | + if ($globalDebug) { |
|
| 2061 | + echo 'Get Data...'."\n"; |
|
| 2062 | + } |
|
| 1506 | 2063 | $buffer = $Common->getData($value['host']); |
| 1507 | 2064 | $all_data = json_decode($buffer,true); |
| 1508 | 2065 | if ($buffer != '' && is_array($all_data)) { |
@@ -1531,16 +2088,25 @@ discard block |
||
| 1531 | 2088 | $data['arrival_airport_icao'] = $line['arrival']; |
| 1532 | 2089 | //$data['arrival_airport_time'] = $line['arrival_time']; |
| 1533 | 2090 | //$data['registration'] = $line['aircraft']; |
| 1534 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 2091 | + if (isset($line['route'])) { |
|
| 2092 | + $data['waypoints'] = $line['route']; |
|
| 2093 | + } |
|
| 2094 | + // route |
|
| 1535 | 2095 | $data['aircraft_icao'] = $line['plane_type']; |
| 1536 | 2096 | $data['id_source'] = $id_source; |
| 1537 | 2097 | $data['format_source'] = 'vam'; |
| 1538 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1539 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 2098 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 2099 | + $data['noarchive'] = true; |
|
| 2100 | + } |
|
| 2101 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2102 | + $data['source_name'] = $value['name']; |
|
| 2103 | + } |
|
| 1540 | 2104 | $SI->add($data); |
| 1541 | 2105 | unset($data); |
| 1542 | 2106 | } |
| 1543 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 2107 | + if ($globalDebug) { |
|
| 2108 | + echo 'No more data...'."\n"; |
|
| 2109 | + } |
|
| 1544 | 2110 | unset($buffer); |
| 1545 | 2111 | unset($all_data); |
| 1546 | 2112 | } |
@@ -1553,7 +2119,9 @@ discard block |
||
| 1553 | 2119 | ) |
| 1554 | 2120 | ) { |
| 1555 | 2121 | //$buffer = $Common->getData($hosts[$id]); |
| 1556 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 2122 | + if ($globalDebug) { |
|
| 2123 | + echo 'Get Data...'."\n"; |
|
| 2124 | + } |
|
| 1557 | 2125 | $buffer = $Common->getData($value['host']); |
| 1558 | 2126 | $all_data = json_decode($buffer,true); |
| 1559 | 2127 | if ($buffer != '') { |
@@ -1571,12 +2139,16 @@ discard block |
||
| 1571 | 2139 | $data['id_source'] = $id_source; |
| 1572 | 2140 | $data['format_source'] = 'blitzortung'; |
| 1573 | 2141 | $SI->add($data); |
| 1574 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2142 | + if ($globalDebug) { |
|
| 2143 | + echo '☈ Lightning added'."\n"; |
|
| 2144 | + } |
|
| 1575 | 2145 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
| 1576 | 2146 | unset($data); |
| 1577 | 2147 | } |
| 1578 | 2148 | } |
| 1579 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 2149 | + if ($globalDebug) { |
|
| 2150 | + echo 'No more data...'."\n"; |
|
| 2151 | + } |
|
| 1580 | 2152 | unset($buffer); |
| 1581 | 2153 | } |
| 1582 | 2154 | $last_exec[$id]['last'] = time(); |
@@ -1588,7 +2160,9 @@ discard block |
||
| 1588 | 2160 | $write = NULL; |
| 1589 | 2161 | $e = NULL; |
| 1590 | 2162 | $n = socket_select($read, $write, $e, $timeout); |
| 1591 | - if ($e != NULL) var_dump($e); |
|
| 2163 | + if ($e != NULL) { |
|
| 2164 | + var_dump($e); |
|
| 2165 | + } |
|
| 1592 | 2166 | if ($n > 0) { |
| 1593 | 2167 | $reset = 0; |
| 1594 | 2168 | foreach ($read as $nb => $r) { |
@@ -1610,13 +2184,17 @@ discard block |
||
| 1610 | 2184 | if ($buffer !== FALSE) { |
| 1611 | 2185 | if ($format === 'vrstcp') { |
| 1612 | 2186 | $buffer = explode('},{',$buffer); |
| 1613 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 2187 | + } else { |
|
| 2188 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 2189 | + } |
|
| 1614 | 2190 | } |
| 1615 | 2191 | // SBS format is CSV format |
| 1616 | 2192 | if ($buffer !== FALSE && $buffer !== '') { |
| 1617 | 2193 | $tt[$format] = 0; |
| 1618 | 2194 | if ($format === 'acarssbs3') { |
| 1619 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 2195 | + if ($globalDebug) { |
|
| 2196 | + echo 'ACARS : '.$buffer."\n"; |
|
| 2197 | + } |
|
| 1620 | 2198 | $ACARS->add(trim($buffer)); |
| 1621 | 2199 | $ACARS->deleteLiveAcarsData(); |
| 1622 | 2200 | } elseif ($format === 'raw') { |
@@ -1625,30 +2203,70 @@ discard block |
||
| 1625 | 2203 | if (is_array($data)) { |
| 1626 | 2204 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1627 | 2205 | $data['format_source'] = 'raw'; |
| 1628 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1629 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1630 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1631 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2206 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2207 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2208 | + } |
|
| 2209 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2210 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2211 | + } |
|
| 2212 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2213 | + $data['noarchive'] = true; |
|
| 2214 | + } |
|
| 2215 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2216 | + $SI->add($data); |
|
| 2217 | + } |
|
| 1632 | 2218 | } |
| 1633 | 2219 | } elseif ($format === 'ais') { |
| 1634 | 2220 | $ais_data = $AIS->parse_line(trim($buffer)); |
| 1635 | 2221 | $data = array(); |
| 1636 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 1637 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 1638 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 1639 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 1640 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 1641 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 1642 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 1643 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 1644 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 1645 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 1646 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 1647 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 1648 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1649 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1650 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1651 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2222 | + if (isset($ais_data['ident'])) { |
|
| 2223 | + $data['ident'] = $ais_data['ident']; |
|
| 2224 | + } |
|
| 2225 | + if (isset($ais_data['mmsi'])) { |
|
| 2226 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 2227 | + } |
|
| 2228 | + if (isset($ais_data['speed'])) { |
|
| 2229 | + $data['speed'] = $ais_data['speed']; |
|
| 2230 | + } |
|
| 2231 | + if (isset($ais_data['heading'])) { |
|
| 2232 | + $data['heading'] = $ais_data['heading']; |
|
| 2233 | + } |
|
| 2234 | + if (isset($ais_data['latitude'])) { |
|
| 2235 | + $data['latitude'] = $ais_data['latitude']; |
|
| 2236 | + } |
|
| 2237 | + if (isset($ais_data['longitude'])) { |
|
| 2238 | + $data['longitude'] = $ais_data['longitude']; |
|
| 2239 | + } |
|
| 2240 | + if (isset($ais_data['status'])) { |
|
| 2241 | + $data['status'] = $ais_data['status']; |
|
| 2242 | + } |
|
| 2243 | + if (isset($ais_data['statusid'])) { |
|
| 2244 | + $data['status_id'] = $ais_data['statusid']; |
|
| 2245 | + } |
|
| 2246 | + if (isset($ais_data['type'])) { |
|
| 2247 | + $data['type'] = $ais_data['type']; |
|
| 2248 | + } |
|
| 2249 | + if (isset($ais_data['imo'])) { |
|
| 2250 | + $data['imo'] = $ais_data['imo']; |
|
| 2251 | + } |
|
| 2252 | + if (isset($ais_data['callsign'])) { |
|
| 2253 | + $data['callsign'] = $ais_data['callsign']; |
|
| 2254 | + } |
|
| 2255 | + if (isset($ais_data['destination'])) { |
|
| 2256 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 2257 | + } |
|
| 2258 | + if (isset($ais_data['eta_ts'])) { |
|
| 2259 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 2260 | + } |
|
| 2261 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2262 | + $data['noarchive'] = true; |
|
| 2263 | + } |
|
| 2264 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2265 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2266 | + } |
|
| 2267 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2268 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2269 | + } |
|
| 1652 | 2270 | |
| 1653 | 2271 | if (isset($ais_data['timestamp'])) { |
| 1654 | 2272 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1657,7 +2275,9 @@ discard block |
||
| 1657 | 2275 | } |
| 1658 | 2276 | $data['format_source'] = 'aisnmea'; |
| 1659 | 2277 | $data['id_source'] = $id_source; |
| 1660 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 2278 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 2279 | + $MI->add($data); |
|
| 2280 | + } |
|
| 1661 | 2281 | unset($data); |
| 1662 | 2282 | } elseif ($format === 'flightgearsp') { |
| 1663 | 2283 | //echo $buffer."\n"; |
@@ -1675,12 +2295,18 @@ discard block |
||
| 1675 | 2295 | $data['speed'] = round($line[5]*1.94384); |
| 1676 | 2296 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1677 | 2297 | $data['format_source'] = 'flightgearsp'; |
| 1678 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1679 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2298 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2299 | + $data['noarchive'] = true; |
|
| 2300 | + } |
|
| 2301 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2302 | + $SI->add($data); |
|
| 2303 | + } |
|
| 1680 | 2304 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1681 | 2305 | } |
| 1682 | 2306 | } elseif ($format === 'acars') { |
| 1683 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 2307 | + if ($globalDebug) { |
|
| 2308 | + echo 'ACARS : '.$buffer."\n"; |
|
| 2309 | + } |
|
| 1684 | 2310 | $ACARS->add(trim($buffer)); |
| 1685 | 2311 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
| 1686 | 2312 | $ACARS->deleteLiveAcarsData(); |
@@ -1701,8 +2327,12 @@ discard block |
||
| 1701 | 2327 | $aircraft_type = $line[10]; |
| 1702 | 2328 | $aircraft_type = preg_split(':/:',$aircraft_type); |
| 1703 | 2329 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
| 1704 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1705 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2330 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2331 | + $data['noarchive'] = true; |
|
| 2332 | + } |
|
| 2333 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2334 | + $SI->add($data); |
|
| 2335 | + } |
|
| 1706 | 2336 | } |
| 1707 | 2337 | } |
| 1708 | 2338 | } elseif ($format === 'beast') { |
@@ -1712,28 +2342,62 @@ discard block |
||
| 1712 | 2342 | foreach($buffer as $all_data) { |
| 1713 | 2343 | $line = json_decode('{'.$all_data.'}',true); |
| 1714 | 2344 | $data = array(); |
| 1715 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
| 1716 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1717 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1718 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1719 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1720 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1721 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 2345 | + if (isset($line['Icao'])) { |
|
| 2346 | + $data['hex'] = $line['Icao']; |
|
| 2347 | + } |
|
| 2348 | + // hex |
|
| 2349 | + if (isset($line['Call'])) { |
|
| 2350 | + $data['ident'] = $line['Call']; |
|
| 2351 | + } |
|
| 2352 | + // ident |
|
| 2353 | + if (isset($line['Alt'])) { |
|
| 2354 | + $data['altitude'] = $line['Alt']; |
|
| 2355 | + } |
|
| 2356 | + // altitude |
|
| 2357 | + if (isset($line['Spd'])) { |
|
| 2358 | + $data['speed'] = $line['Spd']; |
|
| 2359 | + } |
|
| 2360 | + // speed |
|
| 2361 | + if (isset($line['Trak'])) { |
|
| 2362 | + $data['heading'] = $line['Trak']; |
|
| 2363 | + } |
|
| 2364 | + // heading |
|
| 2365 | + if (isset($line['Lat'])) { |
|
| 2366 | + $data['latitude'] = $line['Lat']; |
|
| 2367 | + } |
|
| 2368 | + // lat |
|
| 2369 | + if (isset($line['Long'])) { |
|
| 2370 | + $data['longitude'] = $line['Long']; |
|
| 2371 | + } |
|
| 2372 | + // long |
|
| 1722 | 2373 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1723 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 2374 | + if (isset($line['Sqk'])) { |
|
| 2375 | + $data['squawk'] = $line['Sqk']; |
|
| 2376 | + } |
|
| 2377 | + // squawk |
|
| 1724 | 2378 | $data['emergency'] = ''; // emergency |
| 1725 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 2379 | + if (isset($line['Reg'])) { |
|
| 2380 | + $data['registration'] = $line['Reg']; |
|
| 2381 | + } |
|
| 1726 | 2382 | /* |
| 1727 | 2383 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 1728 | 2384 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1729 | 2385 | */ |
| 1730 | 2386 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1731 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 2387 | + if (isset($line['Type'])) { |
|
| 2388 | + $data['aircraft_icao'] = $line['Type']; |
|
| 2389 | + } |
|
| 1732 | 2390 | $data['format_source'] = 'vrstcp'; |
| 1733 | 2391 | $data['id_source'] = $id_source; |
| 1734 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1735 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1736 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
| 2392 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2393 | + $data['noarchive'] = true; |
|
| 2394 | + } |
|
| 2395 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2396 | + $data['source_name'] = $value['name']; |
|
| 2397 | + } |
|
| 2398 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
| 2399 | + $SI->add($data); |
|
| 2400 | + } |
|
| 1737 | 2401 | unset($data); |
| 1738 | 2402 | } |
| 1739 | 2403 | } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
@@ -1746,22 +2410,46 @@ discard block |
||
| 1746 | 2410 | $data['hex'] = $lined['hexid']; |
| 1747 | 2411 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1748 | 2412 | $data['datetime'] = date('Y-m-d H:i:s');; |
| 1749 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1750 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1751 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1752 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1753 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1754 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1755 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 2413 | + if (isset($lined['ident'])) { |
|
| 2414 | + $data['ident'] = $lined['ident']; |
|
| 2415 | + } |
|
| 2416 | + if (isset($lined['lat'])) { |
|
| 2417 | + $data['latitude'] = $lined['lat']; |
|
| 2418 | + } |
|
| 2419 | + if (isset($lined['lon'])) { |
|
| 2420 | + $data['longitude'] = $lined['lon']; |
|
| 2421 | + } |
|
| 2422 | + if (isset($lined['speed'])) { |
|
| 2423 | + $data['speed'] = $lined['speed']; |
|
| 2424 | + } |
|
| 2425 | + if (isset($lined['squawk'])) { |
|
| 2426 | + $data['squawk'] = $lined['squawk']; |
|
| 2427 | + } |
|
| 2428 | + if (isset($lined['alt'])) { |
|
| 2429 | + $data['altitude'] = $lined['alt']; |
|
| 2430 | + } |
|
| 2431 | + if (isset($lined['heading'])) { |
|
| 2432 | + $data['heading'] = $lined['heading']; |
|
| 2433 | + } |
|
| 1756 | 2434 | $data['id_source'] = $id_source; |
| 1757 | 2435 | $data['format_source'] = 'tsv'; |
| 1758 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1759 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1760 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1761 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2436 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2437 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2438 | + } |
|
| 2439 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2440 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2441 | + } |
|
| 2442 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2443 | + $data['noarchive'] = true; |
|
| 2444 | + } |
|
| 2445 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2446 | + $SI->add($data); |
|
| 2447 | + } |
|
| 1762 | 2448 | unset($lined); |
| 1763 | 2449 | unset($data); |
| 1764 | - } else $error = true; |
|
| 2450 | + } else { |
|
| 2451 | + $error = true; |
|
| 2452 | + } |
|
| 1765 | 2453 | } elseif ($format === 'aprs' && $use_aprs) { |
| 1766 | 2454 | if ($aprs_connect === 0) { |
| 1767 | 2455 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1787,47 +2475,96 @@ discard block |
||
| 1787 | 2475 | $aprs_last_tx = time(); |
| 1788 | 2476 | $data = array(); |
| 1789 | 2477 | //print_r($line); |
| 1790 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1791 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
| 1792 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
| 1793 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
| 1794 | - if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code']; |
|
| 1795 | - if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
|
| 1796 | - if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
|
| 1797 | - if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
|
| 1798 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1799 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2478 | + if (isset($line['address'])) { |
|
| 2479 | + $data['hex'] = $line['address']; |
|
| 2480 | + } |
|
| 2481 | + if (isset($line['mmsi'])) { |
|
| 2482 | + $data['mmsi'] = $line['mmsi']; |
|
| 2483 | + } |
|
| 2484 | + if (isset($line['imo'])) { |
|
| 2485 | + $data['imo'] = $line['imo']; |
|
| 2486 | + } |
|
| 2487 | + if (isset($line['squawk'])) { |
|
| 2488 | + $data['squawk'] = $line['squawk']; |
|
| 2489 | + } |
|
| 2490 | + if (isset($line['arrival_code'])) { |
|
| 2491 | + $data['arrival_code'] = $line['arrival_code']; |
|
| 2492 | + } |
|
| 2493 | + if (isset($line['arrival_date'])) { |
|
| 2494 | + $data['arrival_date'] = $line['arrival_date']; |
|
| 2495 | + } |
|
| 2496 | + if (isset($line['typeid'])) { |
|
| 2497 | + $data['type_id'] = $line['typeid']; |
|
| 2498 | + } |
|
| 2499 | + if (isset($line['statusid'])) { |
|
| 2500 | + $data['status_id'] = $line['statusid']; |
|
| 2501 | + } |
|
| 2502 | + if (isset($line['timestamp'])) { |
|
| 2503 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 2504 | + } else { |
|
| 2505 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2506 | + } |
|
| 1800 | 2507 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1801 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 2508 | + if (isset($line['ident'])) { |
|
| 2509 | + $data['ident'] = $line['ident']; |
|
| 2510 | + } |
|
| 1802 | 2511 | $data['latitude'] = $line['latitude']; |
| 1803 | 2512 | $data['longitude'] = $line['longitude']; |
| 1804 | 2513 | //$data['verticalrate'] = $line[16]; |
| 1805 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 2514 | + if (isset($line['speed'])) { |
|
| 2515 | + $data['speed'] = $line['speed']; |
|
| 2516 | + } |
|
| 1806 | 2517 | //else $data['speed'] = 0; |
| 1807 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1808 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1809 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 2518 | + if (isset($line['altitude'])) { |
|
| 2519 | + $data['altitude'] = $line['altitude']; |
|
| 2520 | + } |
|
| 2521 | + if (isset($line['comment'])) { |
|
| 2522 | + $data['comment'] = $line['comment']; |
|
| 2523 | + } |
|
| 2524 | + if (isset($line['symbol'])) { |
|
| 2525 | + $data['type'] = $line['symbol']; |
|
| 2526 | + } |
|
| 1810 | 2527 | //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
| 1811 | 2528 | |
| 1812 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 2529 | + if (isset($line['heading']) && isset($line['format_source'])) { |
|
| 2530 | + $data['heading'] = $line['heading']; |
|
| 2531 | + } |
|
| 1813 | 2532 | //else echo 'No heading...'."\n"; |
| 1814 | 2533 | //else $data['heading'] = 0; |
| 1815 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 2534 | + if (isset($line['stealth'])) { |
|
| 2535 | + $data['aircraft_type'] = $line['stealth']; |
|
| 2536 | + } |
|
| 1816 | 2537 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
| 1817 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
| 1818 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
| 1819 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1820 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
| 2538 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
| 2539 | + $data['noarchive'] = true; |
|
| 2540 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
| 2541 | + $data['noarchive'] = false; |
|
| 2542 | + } |
|
| 2543 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2544 | + $data['noarchive'] = true; |
|
| 2545 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
| 2546 | + $data['noarchive'] = false; |
|
| 2547 | + } |
|
| 1821 | 2548 | $data['id_source'] = $id_source; |
| 1822 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1823 | - else $data['format_source'] = 'aprs'; |
|
| 2549 | + if (isset($line['format_source'])) { |
|
| 2550 | + $data['format_source'] = $line['format_source']; |
|
| 2551 | + } else { |
|
| 2552 | + $data['format_source'] = 'aprs'; |
|
| 2553 | + } |
|
| 1824 | 2554 | $data['source_name'] = $line['source']; |
| 1825 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
| 1826 | - else $data['source_type'] = 'flarm'; |
|
| 1827 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2555 | + if (isset($line['source_type'])) { |
|
| 2556 | + $data['source_type'] = $line['source_type']; |
|
| 2557 | + } else { |
|
| 2558 | + $data['source_type'] = 'flarm'; |
|
| 2559 | + } |
|
| 2560 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2561 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2562 | + } |
|
| 1828 | 2563 | $currentdate = date('Y-m-d H:i:s'); |
| 1829 | 2564 | $aprsdate = strtotime($data['datetime']); |
| 1830 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 2565 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { |
|
| 2566 | + $data['altitude_relative'] = 'AMSL'; |
|
| 2567 | + } |
|
| 1831 | 2568 | // Accept data if time <= system time + 20s |
| 1832 | 2569 | //if (($data['source_type'] === 'modes') || isset($line['stealth']) && ($line['stealth'] === 0 || $line['stealth'] === '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
| 1833 | 2570 | if ( |
@@ -1839,7 +2576,9 @@ discard block |
||
| 1839 | 2576 | $send = $SI->add($data); |
| 1840 | 2577 | } elseif ($data['source_type'] === 'ais') { |
| 1841 | 2578 | $data['type'] = ''; |
| 1842 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
| 2579 | + if (isset($globalMarine) && $globalMarine) { |
|
| 2580 | + $send = $MI->add($data); |
|
| 2581 | + } |
|
| 1843 | 2582 | } elseif (isset($line['stealth']) && $line['stealth'] != 0) { |
| 1844 | 2583 | echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
| 1845 | 2584 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
@@ -1847,8 +2586,12 @@ discard block |
||
| 1847 | 2586 | $line['symbol'] === 'Glider' || |
| 1848 | 2587 | $line['symbol'] === 'No. Plane' || |
| 1849 | 2588 | $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter')) { |
| 1850 | - if ($line['symbol'] === 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
| 1851 | - if ($line['symbol'] === 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2589 | + if ($line['symbol'] === 'Ballon') { |
|
| 2590 | + $data['aircraft_icao'] = 'BALL'; |
|
| 2591 | + } |
|
| 2592 | + if ($line['symbol'] === 'Glider') { |
|
| 2593 | + $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2594 | + } |
|
| 1852 | 2595 | $send = $SI->add($data); |
| 1853 | 2596 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1854 | 2597 | $line['symbol'] === 'Yacht (Sail)' || |
@@ -1879,9 +2622,13 @@ discard block |
||
| 1879 | 2622 | //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
| 1880 | 2623 | // } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
| 1881 | 2624 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1882 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
| 2625 | + if (isset($globalTracker) && $globalTracker) { |
|
| 2626 | + $send = $TI->add($data); |
|
| 2627 | + } |
|
| 1883 | 2628 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
| 1884 | - if (!isset($data['altitude'])) $data['altitude'] = 0; |
|
| 2629 | + if (!isset($data['altitude'])) { |
|
| 2630 | + $data['altitude'] = 0; |
|
| 2631 | + } |
|
| 1885 | 2632 | $Source->deleteOldLocationByType('gs'); |
| 1886 | 2633 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
| 1887 | 2634 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
@@ -1890,7 +2637,9 @@ discard block |
||
| 1890 | 2637 | } |
| 1891 | 2638 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
| 1892 | 2639 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1893 | - if ($globalDebug) echo '# Weather Station added'."\n"; |
|
| 2640 | + if ($globalDebug) { |
|
| 2641 | + echo '# Weather Station added'."\n"; |
|
| 2642 | + } |
|
| 1894 | 2643 | $Source->deleteOldLocationByType('wx'); |
| 1895 | 2644 | $weather_data = json_encode($line); |
| 1896 | 2645 | if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
@@ -1900,7 +2649,9 @@ discard block |
||
| 1900 | 2649 | } |
| 1901 | 2650 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
| 1902 | 2651 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1903 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2652 | + if ($globalDebug) { |
|
| 2653 | + echo '☈ Lightning added'."\n"; |
|
| 2654 | + } |
|
| 1904 | 2655 | $Source->deleteOldLocationByType('lightning'); |
| 1905 | 2656 | if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
| 1906 | 2657 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
@@ -1912,8 +2663,7 @@ discard block |
||
| 1912 | 2663 | print_r($line); |
| 1913 | 2664 | } |
| 1914 | 2665 | unset($data); |
| 1915 | - } |
|
| 1916 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 2666 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 1917 | 2667 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
| 1918 | 2668 | } |
| 1919 | 2669 | /* |
@@ -1922,7 +2672,9 @@ discard block |
||
| 1922 | 2672 | } |
| 1923 | 2673 | */ |
| 1924 | 2674 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1925 | - elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
| 2675 | + elseif ($line === true && $globalDebug) { |
|
| 2676 | + echo '!! Failed : '.$buffer."!!\n"; |
|
| 2677 | + } |
|
| 1926 | 2678 | if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
| 1927 | 2679 | $Source->deleteOldLocationByType('lightning'); |
| 1928 | 2680 | $Source->deleteOldLocationByType('wx'); |
@@ -1958,27 +2710,47 @@ discard block |
||
| 1958 | 2710 | $data['ground'] = $line[21]; |
| 1959 | 2711 | $data['emergency'] = $line[19]; |
| 1960 | 2712 | $data['format_source'] = 'sbs'; |
| 1961 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1962 | - elseif ($line[0] == 'MLAT') $data['source_name'] = 'MLAT'; |
|
| 1963 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1964 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 2713 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2714 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2715 | + } elseif ($line[0] == 'MLAT') { |
|
| 2716 | + $data['source_name'] = 'MLAT'; |
|
| 2717 | + } |
|
| 2718 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2719 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2720 | + } |
|
| 2721 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2722 | + $data['noarchive'] = true; |
|
| 2723 | + } |
|
| 1965 | 2724 | $data['id_source'] = $id_source; |
| 1966 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1967 | - else $error = true; |
|
| 2725 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2726 | + $send = $SI->add($data); |
|
| 2727 | + } else { |
|
| 2728 | + $error = true; |
|
| 2729 | + } |
|
| 1968 | 2730 | unset($data); |
| 1969 | - } else $error = true; |
|
| 2731 | + } else { |
|
| 2732 | + $error = true; |
|
| 2733 | + } |
|
| 1970 | 2734 | if ($error) { |
| 1971 | 2735 | if (count($line) > 1 && ($line[0] === 'STA' || $line[0] === 'AIR' || $line[0] === 'SEL' || $line[0] === 'ID' || $line[0] === 'CLK')) { |
| 1972 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
| 2736 | + if ($globalDebug) { |
|
| 2737 | + echo "Not a message. Ignoring... \n"; |
|
| 2738 | + } |
|
| 1973 | 2739 | } else { |
| 1974 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
| 2740 | + if ($globalDebug) { |
|
| 2741 | + echo "Wrong line format. Ignoring... \n"; |
|
| 2742 | + } |
|
| 1975 | 2743 | if ($globalDebug) { |
| 1976 | 2744 | echo $buffer; |
| 1977 | 2745 | //print_r($line); |
| 1978 | 2746 | } |
| 1979 | 2747 | //socket_close($r); |
| 1980 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
| 1981 | - if ($format === 'aprs') $aprs_connect = 0; |
|
| 2748 | + if ($globalDebug) { |
|
| 2749 | + echo "Reconnect after an error...\n"; |
|
| 2750 | + } |
|
| 2751 | + if ($format === 'aprs') { |
|
| 2752 | + $aprs_connect = 0; |
|
| 2753 | + } |
|
| 1982 | 2754 | $sourceer[$nb] = $globalSources[$nb]; |
| 1983 | 2755 | connect_all($sourceer); |
| 1984 | 2756 | $sourceer = array(); |
@@ -1986,10 +2758,14 @@ discard block |
||
| 1986 | 2758 | } |
| 1987 | 2759 | } |
| 1988 | 2760 | // Sleep for xxx microseconds |
| 1989 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
| 2761 | + if (isset($globalSBSSleep)) { |
|
| 2762 | + usleep($globalSBSSleep); |
|
| 2763 | + } |
|
| 1990 | 2764 | } else { |
| 1991 | 2765 | if ($format === 'flightgearmp') { |
| 1992 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 2766 | + if ($globalDebug) { |
|
| 2767 | + echo "Reconnect FlightGear MP..."; |
|
| 2768 | + } |
|
| 1993 | 2769 | //@socket_close($r); |
| 1994 | 2770 | sleep($globalMinFetch); |
| 1995 | 2771 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1998,10 +2774,15 @@ discard block |
||
| 1998 | 2774 | break; |
| 1999 | 2775 | |
| 2000 | 2776 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 2001 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 2002 | - else $tt[$format] = 0; |
|
| 2777 | + if (isset($tt[$format])) { |
|
| 2778 | + $tt[$format]++; |
|
| 2779 | + } else { |
|
| 2780 | + $tt[$format] = 0; |
|
| 2781 | + } |
|
| 2003 | 2782 | if ($tt[$format] > 30 || $buffer === FALSE) { |
| 2004 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
| 2783 | + if ($globalDebug) { |
|
| 2784 | + echo "ERROR : Reconnect ".$format."..."; |
|
| 2785 | + } |
|
| 2005 | 2786 | //@socket_close($r); |
| 2006 | 2787 | sleep(2); |
| 2007 | 2788 | $aprs_connect = 0; |
@@ -2019,11 +2800,17 @@ discard block |
||
| 2019 | 2800 | } else { |
| 2020 | 2801 | $error = socket_strerror(socket_last_error()); |
| 2021 | 2802 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 2022 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2023 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
| 2803 | + if ($globalDebug) { |
|
| 2804 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2805 | + } |
|
| 2806 | + if (isset($globalDebug)) { |
|
| 2807 | + echo "Restarting...\n"; |
|
| 2808 | + } |
|
| 2024 | 2809 | // Restart the script if possible |
| 2025 | 2810 | if (is_array($sockets)) { |
| 2026 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 2811 | + if ($globalDebug) { |
|
| 2812 | + echo "Shutdown all sockets..."; |
|
| 2813 | + } |
|
| 2027 | 2814 | |
| 2028 | 2815 | foreach ($sockets as $sock) { |
| 2029 | 2816 | @socket_shutdown($sock,2); |
@@ -2031,25 +2818,45 @@ discard block |
||
| 2031 | 2818 | } |
| 2032 | 2819 | |
| 2033 | 2820 | } |
| 2034 | - if ($globalDebug) echo "Waiting..."; |
|
| 2821 | + if ($globalDebug) { |
|
| 2822 | + echo "Waiting..."; |
|
| 2823 | + } |
|
| 2035 | 2824 | sleep(2); |
| 2036 | 2825 | $time = time(); |
| 2037 | 2826 | //connect_all($hosts); |
| 2038 | 2827 | $aprs_connect = 0; |
| 2039 | - if ($reset%5 === 0) sleep(20); |
|
| 2040 | - if ($reset%10 === 0) sleep(100); |
|
| 2041 | - if ($reset%20 === 0) sleep(200); |
|
| 2042 | - if ($reset > 100) exit('Too many attempts...'); |
|
| 2043 | - if ($globalDebug) echo "Restart all connections..."; |
|
| 2828 | + if ($reset%5 === 0) { |
|
| 2829 | + sleep(20); |
|
| 2830 | + } |
|
| 2831 | + if ($reset%10 === 0) { |
|
| 2832 | + sleep(100); |
|
| 2833 | + } |
|
| 2834 | + if ($reset%20 === 0) { |
|
| 2835 | + sleep(200); |
|
| 2836 | + } |
|
| 2837 | + if ($reset > 100) { |
|
| 2838 | + exit('Too many attempts...'); |
|
| 2839 | + } |
|
| 2840 | + if ($globalDebug) { |
|
| 2841 | + echo "Restart all connections..."; |
|
| 2842 | + } |
|
| 2044 | 2843 | connect_all($globalSources); |
| 2045 | 2844 | } |
| 2046 | 2845 | } |
| 2047 | 2846 | } |
| 2048 | 2847 | if ($globalDaemon === false) { |
| 2049 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 2050 | - if (isset($SI)) $SI->checkAll(); |
|
| 2051 | - if (isset($TI)) $TI->checkAll(); |
|
| 2052 | - if (isset($MI)) $MI->checkAll(); |
|
| 2848 | + if ($globalDebug) { |
|
| 2849 | + echo 'Check all...'."\n"; |
|
| 2850 | + } |
|
| 2851 | + if (isset($SI)) { |
|
| 2852 | + $SI->checkAll(); |
|
| 2853 | + } |
|
| 2854 | + if (isset($TI)) { |
|
| 2855 | + $TI->checkAll(); |
|
| 2856 | + } |
|
| 2857 | + if (isset($MI)) { |
|
| 2858 | + $MI->checkAll(); |
|
| 2859 | + } |
|
| 2053 | 2860 | } |
| 2054 | 2861 | } |
| 2055 | 2862 | } |